Commit 367e26d8 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2926] Code Cleanup

parent a36aa008
...@@ -140,11 +140,11 @@ GSList* conference_participant_list_update(gchar** participants, conference_obj_ ...@@ -140,11 +140,11 @@ GSList* conference_participant_list_update(gchar** participants, conference_obj_
conf->participant_list = NULL; conf->participant_list = NULL;
} }
DEBUG("conference_participant_list_update\n"); DEBUG("Conference: Participant list update");
for (part = participants; *part; part++) { for (part = participants; *part; part++) {
call_id = (gchar*)(*part); call_id = (gchar*)(*part);
DEBUG(" adding %s", call_id); DEBUG("Adding %s", call_id);
conference_add_participant(call_id, conf); conference_add_participant(call_id, conf);
} }
......
...@@ -1042,7 +1042,7 @@ void calltree_add_history_entry (callable_obj_t * c) ...@@ -1042,7 +1042,7 @@ void calltree_add_history_entry (callable_obj_t * c)
void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
{ {
DEBUG("calltree_add_conference conf->_confID %s\n", conf->_confID); DEBUG("Calltree: Add conference %s", conf->_confID);
GdkPixbuf *pixbuf=NULL; GdkPixbuf *pixbuf=NULL;
GdkPixbuf *pixbuf_security=NULL; GdkPixbuf *pixbuf_security=NULL;
...@@ -1066,8 +1066,8 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1066,8 +1066,8 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
if(!conf) { if(!conf) {
DEBUG("Error conference is null!!"); ERROR("Calltree: Error: Conference is null!!");
return; return;
} }
// description = g_markup_printf_escaped("<b>%s</b>", conf->_confID); // description = g_markup_printf_escaped("<b>%s</b>", conf->_confID);
...@@ -1075,14 +1075,9 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1075,14 +1075,9 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
gtk_tree_store_append (tab->store, &iter, NULL); gtk_tree_store_append (tab->store, &iter, NULL);
// _debug
if( tab == current_calls ) if( tab == current_calls )
{ {
if(!(conf->_state))
DEBUG("Error conf->_state is NULL");
switch(conf->_state) switch(conf->_state)
{ {
case CONFERENCE_STATE_ACTIVE_ATACHED: case CONFERENCE_STATE_ACTIVE_ATACHED:
...@@ -1127,14 +1122,14 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1127,14 +1122,14 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
// Every participant to a conference must be secured, the conference is not secured elsewhere // Every participant to a conference must be secured, the conference is not secured elsewhere
conf->_conference_secured = TRUE; conf->_conference_secured = TRUE;
DEBUG("Determine if conference is secured"); DEBUG("Calltree: Determine if conference is secured");
// participant = conf->participant; // participant = conf->participant;
// participant = dbus_get_participant_list(conf->_confID); // participant = dbus_get_participant_list(conf->_confID);
conference_participant = conf->participant_list; conference_participant = conf->participant_list;
if(conference_participant) { if(conference_participant) {
DEBUG(" determine if at least one participant uses srtp"); DEBUG("Calltree: Determine if at least one participant uses SRTP");
// participant = conf->participant; // participant = conf->participant;
// participant = dbus_get_participant_list(conf->_confID); // participant = dbus_get_participant_list(conf->_confID);
...@@ -1153,12 +1148,12 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1153,12 +1148,12 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
} }
if(g_strcasecmp(srtp_enabled,"true") == 0) { if(g_strcasecmp(srtp_enabled,"true") == 0) {
DEBUG(" srtp enabled for participant %s\n", call_id); DEBUG("Calltree: SRTP enabled for participant %s", call_id);
conf->_conf_srtp_enabled = TRUE; conf->_conf_srtp_enabled = TRUE;
break; break;
} }
else { else {
DEBUG(" srtp is not enabled for participant %s\n", call_id); DEBUG("Calltree: SRTP is not enabled for participant %s", call_id);
} }
} }
...@@ -1167,7 +1162,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1167,7 +1162,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
} }
DEBUG(" determine if all conference participant are secured"); DEBUG("Calltree: Determine if all conference participant are secured");
if(conf->_conf_srtp_enabled) { if(conf->_conf_srtp_enabled) {
// participant = conf->participant; // participant = conf->participant;
...@@ -1181,12 +1176,12 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1181,12 +1176,12 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
if(call != NULL) { if(call != NULL) {
if(call->_srtp_state == 0) { if(call->_srtp_state == 0) {
DEBUG(" participant %s is not secured", call_id); DEBUG("Calltree: Participant %s is not secured", call_id);
conf->_conference_secured = FALSE; conf->_conference_secured = FALSE;
break; break;
} }
else { else {
DEBUG(" participant %s is secured", call_id); DEBUG("Calltree: Participant %s is secured", call_id);
} }
} }
conference_participant = conference_next_participant(conference_participant); conference_participant = conference_next_participant(conference_participant);
...@@ -1196,21 +1191,21 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1196,21 +1191,21 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
if(conf->_conf_srtp_enabled) { if(conf->_conf_srtp_enabled) {
if(conf->_conference_secured) { if(conf->_conference_secured) {
DEBUG("Conference is secured"); DEBUG("Calltree: Conference is secured");
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL); pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL);
} }
else { else {
DEBUG("Conference is not secured"); DEBUG("Calltree: Conference is not secured");
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL); pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL);
} }
} }
DEBUG("add conference to tree store"); DEBUG("Calltree: Add conference to tree store");
gtk_tree_store_set(tab->store, &iter, gtk_tree_store_set(tab->store, &iter,
0, pixbuf, // Icon 0, pixbuf, // Icon
1, description, // Description 1, description, // Description
2, pixbuf_security, 2, pixbuf_security,
3, conf, // Pointer 3, conf, // Pointer
-1); -1);
...@@ -1218,15 +1213,15 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1218,15 +1213,15 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
g_object_unref(G_OBJECT(pixbuf)); g_object_unref(G_OBJECT(pixbuf));
// participant = conf->participant; // participant = conf->participant;
// participant = dbus_get_participant_list(conf->_confID); // participant = dbus_get_participant_list(conf->_confID);
conference_participant = conf->participant_list; conference_participant = conf->participant_list;
if(conference_participant) { if(conference_participant) {
DEBUG("Add conference participants\n"); DEBUG("Calltre: Adding conference participant");
// for (pl = participant; *pl; pl++) // for (pl = participant; *pl; pl++)
while(conference_participant) { while(conference_participant) {
DEBUG("OK");
call_id = (gchar*)(conference_participant->data); call_id = (gchar*)(conference_participant->data);
call = calllist_get (tab, call_id); call = calllist_get (tab, call_id);
// create_new_call_from_details (conf_id, conference_details, &c); // create_new_call_from_details (conf_id, conference_details, &c);
...@@ -1244,14 +1239,13 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1244,14 +1239,13 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
} }
*/ */
gtk_tree_view_set_model(GTK_TREE_VIEW(tab->view), GTK_TREE_MODEL(tab->store)); gtk_tree_view_set_model(GTK_TREE_VIEW(tab->view), GTK_TREE_MODEL(tab->store));
path = gtk_tree_model_get_path(model, &iter);
gtk_tree_view_expand_row(GTK_TREE_VIEW(tab->view), path, FALSE); path = gtk_tree_model_get_path(model, &iter);
update_actions(); gtk_tree_view_expand_row(GTK_TREE_VIEW(tab->view), path, FALSE);
update_actions();
} }
......
...@@ -258,7 +258,7 @@ conference_changed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, ...@@ -258,7 +258,7 @@ conference_changed_cb(DBusGProxy *proxy UNUSED, const gchar* confID,
static void static void
conference_created_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo UNUSED ) conference_created_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo UNUSED )
{ {
DEBUG ("Conference added %s\n", confID); DEBUG ("DBUS: Conference %s added", confID);
conference_obj_t* new_conf; conference_obj_t* new_conf;
callable_obj_t* call; callable_obj_t* call;
...@@ -267,19 +267,18 @@ conference_created_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo ...@@ -267,19 +267,18 @@ conference_created_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
gchar** part; gchar** part;
create_new_conference(CONFERENCE_STATE_ACTIVE_ATACHED, confID, &new_conf); create_new_conference(CONFERENCE_STATE_ACTIVE_ATACHED, confID, &new_conf);
// new_conf->_confID = g_strdup(confID);
participants = (gchar**) dbus_get_participant_list(new_conf->_confID); participants = (gchar**) dbus_get_participant_list(new_conf->_confID);
// Update conference list
conference_participant_list_update(participants, new_conf); conference_participant_list_update(participants, new_conf);
// participant = new_conf->participant; // Add conference ID in in each calls
for (part = participants; *part; part++) for (part = participants; *part; part++) {
{
call_id = (gchar*) (*part); call_id = (gchar*) (*part);
call = calllist_get(current_calls, call_id); call = calllist_get(current_calls, call_id);
call->_confID = g_strdup(confID); call->_confID = g_strdup(confID);
} }
conferencelist_add(new_conf); conferencelist_add(new_conf);
calltree_add_conference(current_calls, new_conf); calltree_add_conference(current_calls, new_conf);
...@@ -2159,12 +2158,12 @@ dbus_get_conference_list(void) ...@@ -2159,12 +2158,12 @@ dbus_get_conference_list(void)
} }
gchar** gchar**
dbus_get_participant_list(const char * confID) dbus_get_participant_list(const char *confID)
{ {
GError *error = NULL; GError *error = NULL;
gchar **list = NULL; gchar **list = NULL;
DEBUG("get participant list") DEBUG("DBUS: Get conference %s participant list", confID);
org_sflphone_SFLphone_CallManager_get_participant_list(callManagerProxy, org_sflphone_SFLphone_CallManager_get_participant_list(callManagerProxy,
confID, &list, &error); confID, &list, &error);
......
...@@ -77,21 +77,21 @@ CallManager::placeCallFirstAccount (const std::string& callID, ...@@ -77,21 +77,21 @@ CallManager::placeCallFirstAccount (const std::string& callID,
void void
CallManager::refuse (const std::string& callID) CallManager::refuse (const std::string& callID)
{ {
_debug ("CallManager: refuse received"); _debug ("CallManager: Refuse %s", callID.c_str());
Manager::instance().refuseCall (callID); Manager::instance().refuseCall (callID);
} }
void void
CallManager::accept (const std::string& callID) CallManager::accept (const std::string& callID)
{ {
_debug ("CallManager: accept received"); _debug ("CallManager: Accept received");
Manager::instance().answerCall (callID); Manager::instance().answerCall (callID);
} }
void void
CallManager::hangUp (const std::string& callID) CallManager::hangUp (const std::string& callID)
{ {
_debug ("CallManager::hangUp received %s", callID.c_str()); _debug ("CallManager: HangUp received %s", callID.c_str());
Manager::instance().hangupCall (callID); Manager::instance().hangupCall (callID);
} }
...@@ -202,7 +202,7 @@ CallManager::holdConference (const std::string& confID) ...@@ -202,7 +202,7 @@ CallManager::holdConference (const std::string& confID)
void void
CallManager::unholdConference (const std::string& confID) CallManager::unholdConference (const std::string& confID)
{ {
_debug ("CallManager::unHoldConference received %s", confID.c_str()); _debug ("CallManager: Unhold Conference %s", confID.c_str());
Manager::instance().unHoldConference (confID); Manager::instance().unHoldConference (confID);
} }
...@@ -221,6 +221,7 @@ CallManager::getConferenceList (void) ...@@ -221,6 +221,7 @@ CallManager::getConferenceList (void)
std::vector< std::string > std::vector< std::string >
CallManager::getParticipantList (const std::string& confID) CallManager::getParticipantList (const std::string& confID)
{ {
_debug("CallManager: Get Participant list for conference %s", confID.c_str());
return Manager::instance().getParticipantList (confID); return Manager::instance().getParticipantList (confID);
} }
......
...@@ -725,6 +725,9 @@ ManagerImpl::createConference (const CallID& id1, const CallID& id2) { ...@@ -725,6 +725,9 @@ ManagerImpl::createConference (const CallID& id1, const CallID& id2) {
conf->add(id1); conf->add(id1);
conf->add(id2); conf->add(id2);
// Add conference to map
_conferencemap.insert( std::pair<CallID, Conference*>(conf->getConfID(), conf));
// broadcast a signal over dbus // broadcast a signal over dbus
_dbus->getCallManager()->conferenceCreated(conf->getConfID()); _dbus->getCallManager()->conferenceCreated(conf->getConfID());
...@@ -793,7 +796,7 @@ ManagerImpl::getConferenceFromCallID (const CallID& call_id) { ...@@ -793,7 +796,7 @@ ManagerImpl::getConferenceFromCallID (const CallID& call_id) {
} }
void ManagerImpl::holdConference (const CallID& id) { void ManagerImpl::holdConference (const CallID& id) {
_debug ("ManagerImpl: holdConference()"); _debug ("Manager: Hold conference()");
Conference *conf; Conference *conf;
ConferenceMap::iterator iter_conf = _conferencemap.find(id); ConferenceMap::iterator iter_conf = _conferencemap.find(id);
...@@ -831,7 +834,7 @@ void ManagerImpl::holdConference (const CallID& id) { ...@@ -831,7 +834,7 @@ void ManagerImpl::holdConference (const CallID& id) {
void ManagerImpl::unHoldConference (const CallID& id) { void ManagerImpl::unHoldConference (const CallID& id) {
_debug ("ManagerImpl::unHoldConference()"); _debug ("Manager: Unhold conference()");
Conference *conf; Conference *conf;
ConferenceMap::iterator iter_conf = _conferencemap.find(id); ConferenceMap::iterator iter_conf = _conferencemap.find(id);
...@@ -898,9 +901,8 @@ bool ManagerImpl::participToConference (const CallID& call_id) { ...@@ -898,9 +901,8 @@ bool ManagerImpl::participToConference (const CallID& call_id) {
} }
} }
void ManagerImpl::addParticipant (const CallID& call_id, void ManagerImpl::addParticipant (const CallID& call_id, const CallID& conference_id) {
const CallID& conference_id) { _debug ("ManagerImpl: Add participant %s to %s", call_id.c_str(), conference_id.c_str());
_debug ("ManagerImpl::addParticipant(%s, %s)", call_id.c_str(), conference_id.c_str());
std::map<std::string, std::string> call_details = getCallDetails(call_id); std::map<std::string, std::string> call_details = getCallDetails(call_id);
...@@ -1037,8 +1039,6 @@ void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id ...@@ -1037,8 +1039,6 @@ void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id
_debug ("Manager: Join participants %s, %s", call_id1.c_str(), call_id2.c_str()); _debug ("Manager: Join participants %s, %s", call_id1.c_str(), call_id2.c_str());
std::map<std::string, std::string> call1_details = getCallDetails(call_id1); std::map<std::string, std::string> call1_details = getCallDetails(call_id1);
std::map<std::string, std::string> call2_details = getCallDetails(call_id2); std::map<std::string, std::string> call2_details = getCallDetails(call_id2);
...@@ -1127,7 +1127,7 @@ void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id ...@@ -1127,7 +1127,7 @@ void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id
void ManagerImpl::detachParticipant (const CallID& call_id, void ManagerImpl::detachParticipant (const CallID& call_id,
const CallID& current_id) { const CallID& current_id) {
_debug ("ManagerImpl::detachParticipant(%s)", call_id.c_str()); _debug ("Manager: Detach participant %s", call_id.c_str());
CallID current_call_id = current_id; CallID current_call_id = current_id;
...@@ -4302,7 +4302,8 @@ std::vector<std::string> ManagerImpl::getConferenceList (void) { ...@@ -4302,7 +4302,8 @@ std::vector<std::string> ManagerImpl::getConferenceList (void) {
std::vector<std::string> ManagerImpl::getParticipantList ( std::vector<std::string> ManagerImpl::getParticipantList (
const std::string& confID) { const std::string& confID) {
_debug ("ManagerImpl::getParticipantList");
_debug ("ManagerImpl: Get participant list %s", confID.c_str());
std::vector<std::string> v; std::vector<std::string> v;
ConferenceMap::iterator iter_conf = _conferencemap.find(confID); ConferenceMap::iterator iter_conf = _conferencemap.find(confID);
...@@ -4322,6 +4323,9 @@ std::vector<std::string> ManagerImpl::getParticipantList ( ...@@ -4322,6 +4323,9 @@ std::vector<std::string> ManagerImpl::getParticipantList (
iter_participant++; iter_participant++;
} }
} }
else {
_warn("Manager: Warning: Did not found conference %s", confID.c_str());
}
return v; return v;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment