Commit e3dde95d authored by Alexandre Savard's avatar Alexandre Savard

[#2006] Add getConfList method over dbus

Conference list is filled after receiving conferenceChanged signals
parent 129e083c
......@@ -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;
......
......@@ -21,6 +21,7 @@
#define __CALLTAB_H__
#include <calllist.h>
#include <conferencelist.h>
#include <gtk/gtk.h>
calltab_t* active_calltree;
......
......@@ -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);
......
......@@ -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)
......
......@@ -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
......
......@@ -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"/>
......
......@@ -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;
......
......@@ -27,6 +27,7 @@
#include <accountlist.h>
#include <calllist.h>
#include <conferencelist.h>
#include <sflnotify.h>
/** @file dbus.h
......
......@@ -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"/>
......
......@@ -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)
......
......@@ -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);
......
......@@ -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;
}
......@@ -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.
......
Markdown is supported
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