diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 8eb45b1865c6eaa2694fa262b19866555af4aa1c..2c04b9112f72dcce85a665384471f22ded987293 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -244,6 +244,7 @@ gboolean sflphone_init() account_list_init (); codec_list_init(); + conferencelist_init(); // Fetch the configured accounts sflphone_fill_account_list(FALSE); @@ -251,6 +252,9 @@ gboolean sflphone_init() // Fetch the audio codecs sflphone_fill_codec_list(); + // Fetch the conference list + sflphone_fill_conference_list(); + return TRUE; } } @@ -849,6 +853,14 @@ sflphone_join_participant(callable_obj_t* selected_call, callable_obj_t* dragged dbus_join_participant(selected_call, dragged_call); } + void +sflphone_add_conference() +{ + DEBUG("sflphone add a conference to tree view"); + + // dbus_join_participant(selected_call, dragged_call); +} + void sflphone_rec_call() { @@ -960,6 +972,29 @@ void sflphone_fill_call_list (void) } } + +void sflphone_fill_conference_list(void) +{ + gchar** conferences = (gchar**)dbus_get_conference_list(); + gchar** pl; + gchar* conf_id; + gchar* c; + + DEBUG("sflphone_fill_conference_list"); + + if(conferences) + { + for (pl = conferences; *conferences; conferences++) + { + c = g_new0(gchar,1); + conf_id = (gchar*)(*conferences); + c = g_strdup(conf_id); + + conferencelist_add(c); + } + } +} + void sflphone_fill_history (void) { GHashTable *entries; diff --git a/sflphone-client-gnome/src/contacts/calltab.h b/sflphone-client-gnome/src/contacts/calltab.h index 25c3ddb70f99effcd6f507e3a169821e9ca25eb5..dfa4dfda53480c08be64e68c3950cd2b8f315d2a 100644 --- a/sflphone-client-gnome/src/contacts/calltab.h +++ b/sflphone-client-gnome/src/contacts/calltab.h @@ -21,6 +21,7 @@ #define __CALLTAB_H__ #include <calllist.h> +#include <conferencelist.h> #include <gtk/gtk.h> calltab_t* active_calltree; diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 08b088eb7467247f1c0d4d718398c696c22a276c..b0f25a54e66f69d567e450cbfbf85389ef12a8d8 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <glib/gprintf.h> #include <calllist.h> +#include <conferencelist.h> #include <toolbar.h> #include <mainwindow.h> #include <history.h> @@ -62,7 +63,7 @@ popup_menu (GtkWidget *widget, static void selected(GtkTreeSelection *sel, void* data UNUSED ) { - g_print("selected_cb\n"); + GtkTreeIter iter; GValue val; GtkTreeModel *model = (GtkTreeModel*)active_calltree->store; @@ -85,7 +86,11 @@ selected(GtkTreeSelection *sel, void* data UNUSED ) previous_id = ((callable_obj_t*)g_value_get_pointer(&val))->_callID; selected_call = (callable_obj_t*)g_value_get_pointer(&val); - printf(" source path %s, %s\n", string_path, previous_id); + DEBUG("selected_cb\n"); + DEBUG(" source path %s, %s\n", string_path, previous_id); + + conferencelist_reset (); + sflphone_fill_conference_list(); g_value_unset(&val); toolbar_update_buttons(); @@ -608,6 +613,16 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c) } + +void calltree_add_conference(calltab_t *tab) +{ + if (tab == history || tab==contacts) + return; + + +} + + void calltree_display (calltab_t *tab) { @@ -676,8 +691,8 @@ static void drag_begin_cb(GtkWidget *widget, GdkDragContext *dc, gpointer data) static void drag_end_cb(GtkWidget * widget, GdkDragContext * context, gpointer data) { - g_print("drag_end_cb\n"); - g_print(" dragged path %s, call_id %s on previous_id %s\n", dragged_path, call_id, previous_id); + DEBUG("drag_end_cb\n"); + DEBUG(" dragged path %s, call_id %s on previous_id %s\n", dragged_path, call_id, previous_id); if(selected_call != NULL && dragged_call != NULL) sflphone_join_participant(selected_call, dragged_call); diff --git a/sflphone-client-gnome/src/contacts/conferencelist.c b/sflphone-client-gnome/src/contacts/conferencelist.c index 5d38920133dfcdc22664896df74d3cc3187367e7..5e96ec393d79b5afd115a949167ee4fe3fdfe9cd 100644 --- a/sflphone-client-gnome/src/contacts/conferencelist.c +++ b/sflphone-client-gnome/src/contacts/conferencelist.c @@ -59,6 +59,7 @@ conferencelist_add(const gchar* conf_id) gchar* c = (gchar*)conferencelist_get(conf_id); if(!c) { + g_print("Conference id(s): %s\n", conf_id); g_queue_push_tail (conferenceQueue, (gpointer)conf_id); } } @@ -89,8 +90,8 @@ conferencelist_get (const gchar* conf_id) } -gchar* -calllist_get_nth (const gchar* conf_id, guint n ) +gchar* +conferencelist_get_nth (const gchar* conf_id, guint n ) { GList* c = g_queue_peek_nth(conferenceQueue, n); if (c) diff --git a/sflphone-client-gnome/src/contacts/conferencelist.h b/sflphone-client-gnome/src/contacts/conferencelist.h index 82681620854392b03cd34b48eea1490024d21cd5..2c6b31f7a45d62b8631aa76516e54c2db02acd37 100644 --- a/sflphone-client-gnome/src/contacts/conferencelist.h +++ b/sflphone-client-gnome/src/contacts/conferencelist.h @@ -61,7 +61,7 @@ conferencelist_get_size (const gchar* conf_id); * @param n The position of the call you want * @return A call or NULL */ gchar* -conferencelist_get_nth (const gchar* conf_id); +conferencelist_get_nth (const gchar* conf_id, guint n ); /** Return the call corresponding to the callID * @param n The callID of the call you want diff --git a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml index b42b3c3e8146cf24bd58751fd189349dd628443d..5a5ce8d3ec02f8ac80277d04f7d03a95681c2318 100644 --- a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml @@ -61,9 +61,15 @@ <arg type="s" name="callID" direction="in"/> </method> - <signal name="displayCoference"> - <arg type="s" name="confID" direction="out"/> - </signal> + <method name="getConferenceDetails"> + <arg type="s" name="callID" direction="in"/> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/> + <arg type="a{ss}" name="infos" direction="out"/> + </method> + + <method name="getConferenceList"> + <arg type="as" name="list" direction="out"/> + </method> <method name="setRecording"> <arg type="s" name="callID" direction="in"/> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index bf3a03d2bbe26aef31e78d103f5aeb7a4c620c50..6b34563f85ab40981bff7bacab42045afe87d774 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -1782,6 +1782,20 @@ gchar** dbus_get_call_list (void) return list; } +gchar** dbus_get_conference_list (void) +{ + GError *error = NULL; + gchar **list = NULL; + + org_sflphone_SFLphone_CallManager_get_conference_list (callManagerProxy, &list, &error); + if (error){ + ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_conference_list"); + g_error_free (error); + } + + return list; +} + void dbus_set_accounts_order (const gchar* order) { GError *error = NULL; diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index 7e241c9cf790092367be1d91758fb5de4689b8c2..fb5da35a88464f0c1a94f95bee7c3350265b07f4 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -27,6 +27,7 @@ #include <accountlist.h> #include <calllist.h> +#include <conferencelist.h> #include <sflnotify.h> /** @file dbus.h diff --git a/sflphone-common/src/dbus/callmanager-introspec.xml b/sflphone-common/src/dbus/callmanager-introspec.xml index 26e8d03e92af7c49ef96b6e6fa47c6e1237fbc3d..679d779ba4541abdb433f96a9729af4039912dfb 100644 --- a/sflphone-common/src/dbus/callmanager-introspec.xml +++ b/sflphone-common/src/dbus/callmanager-introspec.xml @@ -61,9 +61,15 @@ <arg type="s" name="callID" direction="in"/> </method> - <signal name="displayCoference"> - <arg type="s" name="confID" direction="out"/> - </signal> + <method name="getConferenceDetails"> + <arg type="s" name="callID" direction="in"/> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/> + <arg type="a{ss}" name="infos" direction="out"/> + </method> + + <method name="getConferenceList"> + <arg type="as" name="list" direction="out"/> + </method> <method name="setRecording"> <arg type="s" name="callID" direction="in"/> diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp index a07256f3ae21a8d7493a60f861bdf4a46ce9347a..c0019364b4a34c00b24d22d23bc182abb0c1edb8 100644 --- a/sflphone-common/src/dbus/callmanager.cpp +++ b/sflphone-common/src/dbus/callmanager.cpp @@ -131,8 +131,19 @@ CallManager::detachParticipant (const std::string& callID) Manager::instance().detachParticipant(callID); } +std::map< std::string, std::string > +CallManager::getConferenceDetails (const std::string& callID) +{ + _debug ("CallManager::getCallDetails received\n"); + return Manager::instance().getConferenceDetails (callID); +} - +std::vector< std::string > +CallManager::getConferenceList (void) +{ + _debug("CallManager::getConferenceList\n"); + return Manager::instance().getConferenceList(); +} void CallManager::setRecording (const std::string& callID) diff --git a/sflphone-common/src/dbus/callmanager.h b/sflphone-common/src/dbus/callmanager.h index 9f231d99cd862c072c1b7f193fd0932f6f3ef6a1..fc3c16c468a07eb0da9efdf4389553daa1ee0ef9 100644 --- a/sflphone-common/src/dbus/callmanager.h +++ b/sflphone-common/src/dbus/callmanager.h @@ -50,10 +50,11 @@ public: double getVolume( const std::string& device ); void joinParticipant( const std::string& sel_callID, const std::string& drag_callID ); void detachParticipant( const std::string& callID ); + std::vector< std::string > getConferenceList (void); + std::map< std::string, std::string > getConferenceDetails ( const std::string& callID ); void setRecording( const std::string& callID ); bool getIsRecording(const std::string& callID); std::string getCurrentCodecName(const std::string& callID); - std::map< std::string, std::string > getCallDetails( const std::string& callID ); std::vector< std::string > getCallList (void); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 2a312ea453169d3c43a95aca3c6cf63031ac4a26..06c1cf56596f1f1187f3be3e223c9ed3b08ac170 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3478,3 +3478,68 @@ ManagerImpl::getCallList (void) return v; } + + +std::map< std::string, std::string > +ManagerImpl::getConferenceDetails(const CallID& callID) +{ + + std::map<std::string, std::string> call_details; + AccountID accountid; + Account *account; + VoIPLink *link; + Call *call = NULL; + std::stringstream type; + + + // We need here to retrieve the call information attached to the call ID + // To achieve that, we need to get the voip link attached to the call + // But to achieve that, we need to get the account the call was made with + + // So first we fetch the account + accountid = getAccountFromCall (callID); + _debug ("%s\n",callID.c_str()); + // Then the VoIP link this account is linked with (IAX2 or SIP) + + if ( (account=getAccount (accountid)) != 0) { + link = account->getVoIPLink (); + + if (link) { + call = link->getCall (callID); + } + } + + if (call) { + type << call->getCallType (); + call_details.insert (std::pair<std::string, std::string> ("ACCOUNTID", accountid)); + call_details.insert (std::pair<std::string, std::string> ("PEER_NUMBER", call->getPeerNumber ())); + call_details.insert (std::pair<std::string, std::string> ("PEER_NAME", call->getPeerName ())); + call_details.insert (std::pair<std::string, std::string> ("CALL_STATE", call->getStateStr ())); + call_details.insert (std::pair<std::string, std::string> ("CALL_TYPE", type.str ())); + } else { + _debug ("Error: Managerimpl - getCallDetails ()\n"); + call_details.insert (std::pair<std::string, std::string> ("ACCOUNTID", AccountNULL)); + call_details.insert (std::pair<std::string, std::string> ("PEER_NUMBER", "Unknown")); + call_details.insert (std::pair<std::string, std::string> ("PEER_NAME", "Unknown")); + call_details.insert (std::pair<std::string, std::string> ("CALL_STATE", "UNKNOWN")); + call_details.insert (std::pair<std::string, std::string> ("CALL_TYPE", "0")); + } + + return call_details; +} + + +std::vector< std::string > +ManagerImpl::getConferenceList (void) +{ + _debug("ManagerImpl::getConferenceList\n"); + std::vector< std::string > v; + + ConferenceMap::iterator iter = _conferencemap.begin(); + while (iter != _conferencemap.end ()) { + v.push_back (iter->first); + iter++; + } + + return v; +} diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index 37e162f14c5129c5d63ec759973e1d1f0a111505..2c0b0cb0849142144a03992e8f4f41c361021439 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -70,7 +70,8 @@ typedef std::set<CallID> CallIDSet; /** To send multiple string */ typedef std::list<std::string> TokenList; -/** To store conference objects by call ids */ +/** To store conference objects by call ids + used to retreive the conference according to a call */ typedef std::map<CallID, Conference*> ConferenceCallMap; /** To store conference objects by conference ids */ @@ -349,6 +350,19 @@ class ManagerImpl { */ std::vector< std::string > getCallList (void); + /** + * Retrieve details about a given call + * @param callID The account identifier + * @return std::map< std::string, std::string > The call details + */ + std::map< std::string, std::string > getConferenceDetails(const CallID& callID); + + /** + * Get call list + * @return std::vector<std::string> A list of call IDs + */ + std::vector< std::string > getConferenceList (void); + /** * Save the details of an existing account, given the account ID * This will load the configuration map with the given data.