From 786b96cf8c0bd2cf8529ffe157ca26819ff66bc2 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.net> Date: Mon, 31 Aug 2009 15:51:17 -0400 Subject: [PATCH] [#2006] Hold/unHold conference --- sflphone-client-gnome/src/actions.c | 10 ++-- sflphone-client-gnome/src/contacts/calltree.c | 18 ++++-- sflphone-client-gnome/src/menus.c | 6 +- sflphone-common/src/managerimpl.cpp | 60 +++++++++++++++++++ 4 files changed, 83 insertions(+), 11 deletions(-) diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 8f39264d30..2a6dcc9457 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -898,15 +898,17 @@ sflphone_add_conference() } void -sflphone_conference_on_hold() +sflphone_conference_on_hold(const conference_obj_t * c) { - + DEBUG("sflphone_conference_on_hold"); + dbus_hold_conference(c); } void -sflphone_conference_off_hold() +sflphone_conference_off_hold(const conference_obj_t * c) { - + DEBUG("sflphone_conference_off_hold"); + dbus_unhold_conference(c); } diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 62f7139524..e74fe3c680 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -981,14 +981,22 @@ static void drag_end_cb(GtkWidget * widget, GdkDragContext * context, gpointer d if(dragged_path_depth == 1) { - // TODO: dragged a conference call on a call - // TODO: dragged a conference call on a conference - - else if(selected_type == A_CONFERENCE && dragged_type == NULL) + + if(selected_type == A_CALL && dragged_type == A_CALL) + { + // TODO: dragged a conference call on a call + + } + else if(selected_type == A_CALL && dragged_type == A_CONFERENCE) + { + // TODO: dragged a conference call on a conference + } + else { // TODO: dragged a conference call on a NULL element - sflphone_detach_participant(selected_call_id); + // sflphone_detach_participant(selected_call_id); } + sflphone_detach_participant(selected_call_id); } else // dragged_path_depth == 2 { diff --git a/sflphone-client-gnome/src/menus.c b/sflphone-client-gnome/src/menus.c index ccfd6e0e1b..f3afbd6c28 100644 --- a/sflphone-client-gnome/src/menus.c +++ b/sflphone-client-gnome/src/menus.c @@ -240,12 +240,14 @@ conference_hold (void* foo UNUSED) if(selectedConf->_state == CONFERENCE_STATE_HOLD) { gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( holdMenu ), gtk_image_new_from_file( ICONS_DIR "/icon_unhold.svg")); - sflphone_conference_off_hold(); + selectedConf->_state = CONFERENCE_STATE_ACTIVE; + sflphone_conference_off_hold(selectedConf); } else { gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( holdMenu ), gtk_image_new_from_file( ICONS_DIR "/icon_hold.svg")); - sflphone_conference_on_hold(); + selectedConf->_state = CONFERENCE_STATE_HOLD; + sflphone_conference_on_hold(selectedConf); } } } diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index c7f2761bf3..d5cebdd6f4 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -754,6 +754,36 @@ ManagerImpl::removeConference(const ConfID& conference_id) void ManagerImpl::holdConference(const CallID& id) { + _debug ("ManagerImpl::holdConference()\n"); + + Conference *conf; + ConferenceMap::iterator iter_conf = _conferencemap.find(id); + + AccountID currentAccountId; + + Call* call = NULL; + + if(iter_conf != _conferencemap.end()) + { + conf = iter_conf->second; + + ConferenceCallMap::iterator iter_participant = _conferencecall.begin(); + + while(iter_participant != _conferencecall.end()) + { + _debug("ManagerImpl::hangupConference participant %s\n", iter_participant->first.c_str()); + currentAccountId = getAccountFromCall (iter_participant->first); + call = getAccountLink (currentAccountId)->getCall (iter_participant->first); + + if(call->getConfId() == id) + onHoldCall (iter_participant->first); + + iter_participant++; + + } + + } + } @@ -762,6 +792,36 @@ void ManagerImpl::unHoldConference(const CallID& id) { + _debug ("ManagerImpl::unHoldConference()\n"); + + Conference *conf; + ConferenceMap::iterator iter_conf = _conferencemap.find(id); + + AccountID currentAccountId; + + Call* call = NULL; + + if(iter_conf != _conferencemap.end()) + { + conf = iter_conf->second; + + ConferenceCallMap::iterator iter_participant = _conferencecall.begin(); + + while(iter_participant != _conferencecall.end()) + { + _debug("ManagerImpl::hangupConference participant %s\n", iter_participant->first.c_str()); + currentAccountId = getAccountFromCall (iter_participant->first); + call = getAccountLink (currentAccountId)->getCall (iter_participant->first); + + if(call->getConfId() == id) + offHoldCall (iter_participant->first); + + iter_participant++; + + } + + } + } bool -- GitLab