From 858c85ca71a954c3714ee56e4446f4bd8bfc4c6c Mon Sep 17 00:00:00 2001 From: Julien Bonjean <julien@bonjean.info> Date: Thu, 4 Mar 2010 16:22:06 -0500 Subject: [PATCH] [#2916] Added support for shortcuts --- sflphone-client-gnome/src/Makefile.am | 6 +- sflphone-client-gnome/src/config/Makefile.am | 1 + .../src/config/preferencesdialog.c | 6 + .../src/config/shortcuts-config.c | 107 + .../src/config/shortcuts-config.h | 48 + .../dbus/configurationmanager-introspec.xml | 9 + sflphone-client-gnome/src/dbus/dbus.c | 3314 +++++++++-------- sflphone-client-gnome/src/dbus/dbus.h | 2 + sflphone-client-gnome/src/main.c | 6 + sflphone-common/.cproject | 3 + .../dbus/configurationmanager-introspec.xml | 7 + .../src/dbus/configurationmanager.cpp | 1116 +++--- .../src/dbus/configurationmanager.h | 6 + 13 files changed, 2402 insertions(+), 2229 deletions(-) create mode 100644 sflphone-client-gnome/src/config/shortcuts-config.c create mode 100644 sflphone-client-gnome/src/config/shortcuts-config.h diff --git a/sflphone-client-gnome/src/Makefile.am b/sflphone-client-gnome/src/Makefile.am index 1f2eb25028..30e2a818e6 100644 --- a/sflphone-client-gnome/src/Makefile.am +++ b/sflphone-client-gnome/src/Makefile.am @@ -24,11 +24,13 @@ sflphone_client_gnome_SOURCES = \ sliders.c \ statusicon.c \ codeclist.c \ - reqaccount.c + reqaccount.c \ + shortcuts.c noinst_HEADERS = actions.h sflnotify.h mainwindow.h dialpad.h codeclist.h \ reqaccount.h errors.h sflphone_const.h uimanager.h \ - accountlist.h sliders.h statusicon.h callable_obj.h conference_obj.h + accountlist.h sliders.h statusicon.h callable_obj.h conference_obj.h \ + shortcuts.h sflphone_client_gnome_LDADD = $(DEPS_LIBS) $(NOTIFY_LIBS) $(SFLPHONEGTK_LIBS) $(LIBSEXY_LIBS) $(LOG4C) diff --git a/sflphone-client-gnome/src/config/Makefile.am b/sflphone-client-gnome/src/config/Makefile.am index 3a4f01d7d7..e39b6dde11 100644 --- a/sflphone-client-gnome/src/config/Makefile.am +++ b/sflphone-client-gnome/src/config/Makefile.am @@ -4,6 +4,7 @@ noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = \ addressbook-config.c \ + shortcuts-config.c \ assistant.c \ preferencesdialog.c \ accountlistconfigdialog.c \ diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index c5f6db485d..b24137b22b 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -30,6 +30,7 @@ #include <mainwindow.h> #include <audioconf.h> #include <addressbook-config.h> +#include <shortcuts-config.h> #include <hooks-config.h> #include <utils.h> @@ -519,6 +520,11 @@ show_preferences_dialog () gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Hooks"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + // Shortcuts tab + tab = create_shortcuts_settings(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Shortcuts"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook) , 0); result = gtk_dialog_run(dialog); diff --git a/sflphone-client-gnome/src/config/shortcuts-config.c b/sflphone-client-gnome/src/config/shortcuts-config.c new file mode 100644 index 0000000000..91e4d140a9 --- /dev/null +++ b/sflphone-client-gnome/src/config/shortcuts-config.c @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2010 Savoir-Faire Linux inc. + * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "shortcuts-config.h" +#include "shortcuts.h" + +#include <gdk/gdkx.h> + +GtkWidget* +create_shortcuts_settings() +{ + GtkWidget *vbox, *result_frame, *window, *treeview, *scrolled_window, *table; + GtkListStore *store; + GtkTreeIter iter; + guint i = 0; + + vbox = gtk_vbox_new(FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + + gnome_main_section_new(_("General"), &result_frame); + + treeview = gtk_tree_view_new(); + setup_tree_view(treeview); + + store = gtk_list_store_new(COLUMNS, G_TYPE_STRING, G_TYPE_INT, G_TYPE_UINT); + + Accelerator* list = shortcuts_get_list(); + + while (list[i].action != NULL) + { + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, ACTION, list[i].action, MASK, + (gint) list[i].mask, VALUE, XKeycodeToKeysym(GDK_DISPLAY(), + list[i].value, 0), -1); + i++; + } + + gtk_tree_view_set_model(GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store)); + g_object_unref(store); + + gtk_container_add(GTK_CONTAINER (result_frame), treeview); + gtk_box_pack_start(GTK_BOX(vbox), result_frame, FALSE, FALSE, 0); + + gtk_widget_show_all(vbox); + + return vbox; +} + +/* + * Create a tree view with two columns. The first is an action and the + * second is a keyboard accelerator. + */ +static void +setup_tree_view(GtkWidget *treeview) +{ + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes("Action", renderer, "text", + ACTION, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW (treeview), column); + + renderer = gtk_cell_renderer_accel_new(); + g_object_set(renderer, "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_GTK, + "editable", TRUE, NULL); + column = gtk_tree_view_column_new_with_attributes("Shortcut", renderer, + "accel-mods", MASK, "accel-key", VALUE, NULL); + + gtk_tree_view_append_column(GTK_TREE_VIEW (treeview), column); + g_signal_connect (G_OBJECT (renderer), "accel_edited", G_CALLBACK (accel_edited), (gpointer) treeview); +} + +static void +accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key, + GdkModifierType mask, guint hardware_keycode, GtkTreeView *treeview) +{ + GtkTreeModel *model; + GtkTreeIter iter; + + // Update treeview + model = gtk_tree_view_get_model(treeview); + if (gtk_tree_model_get_iter_from_string(model, &iter, path)) + gtk_list_store_set(GTK_LIST_STORE (model), &iter, MASK, (gint) mask, VALUE, + accel_key, -1); + + gint code = XKeysymToKeycode(GDK_DISPLAY(), accel_key); + + // Update GDK bindings + shortcuts_update_bindings(atoi(path), code); +} diff --git a/sflphone-client-gnome/src/config/shortcuts-config.h b/sflphone-client-gnome/src/config/shortcuts-config.h new file mode 100644 index 0000000000..61306699f0 --- /dev/null +++ b/sflphone-client-gnome/src/config/shortcuts-config.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Savoir-Faire Linux inc. + * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _SHORTCUTS_CONFIG +#define _SHORTCUTS_CONFIG + +#include <gtk/gtk.h> +#include <glib/gtypes.h> + +#include "actions.h" +#include <utils.h> + +G_BEGIN_DECLS + +enum +{ + ACTION = 0, MASK, VALUE, COLUMNS +}; + +GtkWidget* +create_shortcuts_settings(); + +static void +setup_tree_view(GtkWidget *treeview); + +static void +accel_edited(GtkCellRendererAccel *renderer, gchar *path, guint accel_key, + GdkModifierType mask, guint hardware_keycode, GtkTreeView *treeview); + +G_END_DECLS + +#endif // _SHORTCUTS_CONFIG diff --git a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml index fa1433399a..f7a2b79ead 100644 --- a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml @@ -162,6 +162,8 @@ <method name="addAccount"> <!--* Add a new account to the SFLphone-daemon list. If no details are specified, default parameters are used. + A REGISTER is automatically sent and configuration is + saved if account created successfully. @param[in] input details @param[out] output accountID @@ -546,5 +548,12 @@ <arg type="as" name="list" direction="out"/> </method> + <method name="getShortcuts"> + <arg type="a{si}" name="shortcutsMap" direction="out"/> + </method> + + <method name="setShortcuts"> + <arg type="a{si}" name="shortcutsMap" direction="in"/> + </method> </interface> </node> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 3d2c6fe829..bfa9b58369 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -43,1704 +43,1618 @@ DBusGProxy * callManagerProxy; DBusGProxy * configurationManagerProxy; DBusGProxy * instanceProxy; - static void -incoming_call_cb (DBusGProxy *proxy UNUSED, - const gchar* accountID, - const gchar* callID, - const gchar* from, - void * foo UNUSED ) +static void +incoming_call_cb(DBusGProxy *proxy UNUSED, const gchar* accountID, + const gchar* callID, const gchar* from, void * foo UNUSED ) { - DEBUG("Incoming call (%s) from %s", callID, from); + DEBUG("Incoming call (%s) from %s", callID, from); - callable_obj_t * c; - gchar *peer_name, *peer_number; - // We receive the from field under a formatted way. We want to extract the number and the name of the caller - peer_name = call_get_peer_name (from); - peer_number = call_get_peer_number (from); + callable_obj_t * c; + gchar *peer_name, *peer_number; + // We receive the from field under a formatted way. We want to extract the number and the name of the caller + peer_name = call_get_peer_name(from); + peer_number = call_get_peer_number(from); - DEBUG(" peer name: %s", peer_name); - DEBUG(" peer number: %s", peer_number); + DEBUG(" peer name: %s", peer_name); + DEBUG(" peer number: %s", peer_number); - create_new_call (CALL, CALL_STATE_INCOMING, g_strdup(callID), g_strdup(accountID), peer_name, peer_number, &c); + create_new_call(CALL, CALL_STATE_INCOMING, g_strdup(callID), g_strdup( + accountID), peer_name, peer_number, &c); #if GTK_CHECK_VERSION(2,10,0) - status_tray_icon_blink (TRUE); - popup_main_window (); + status_tray_icon_blink(TRUE); + popup_main_window(); #endif - set_timestamp (&c->_time_start); - notify_incoming_call (c); - sflphone_incoming_call (c); + set_timestamp(&c->_time_start); + notify_incoming_call(c); + sflphone_incoming_call(c); } - static void -zrtp_negotiation_failed_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - const gchar* reason, - const gchar* severity, - void * foo UNUSED ) +static void +zrtp_negotiation_failed_cb(DBusGProxy *proxy UNUSED, const gchar* callID, + const gchar* reason, const gchar* severity, void * foo UNUSED ) { - DEBUG ("Zrtp negotiation failed."); - main_window_zrtp_negotiation_failed(callID, reason, severity); - callable_obj_t * c = NULL; - c = calllist_get(current_calls, callID); - if(c) { - notify_zrtp_negotiation_failed(c); + DEBUG ("Zrtp negotiation failed."); + main_window_zrtp_negotiation_failed(callID, reason, severity); + callable_obj_t * c = NULL; + c = calllist_get(current_calls, callID); + if (c) + { + notify_zrtp_negotiation_failed(c); } } - static void -curent_selected_codec (DBusGProxy *proxy UNUSED, - const gchar* callID, - const gchar* codecName, - void * foo UNUSED ) +static void +curent_selected_codec(DBusGProxy *proxy UNUSED, const gchar* callID, + const gchar* codecName, void * foo UNUSED ) { - // DEBUG ("%s codec decided for call %s",codecName,callID); - // sflphone_display_selected_codec (codecName); + // DEBUG ("%s codec decided for call %s",codecName,callID); + // sflphone_display_selected_codec (codecName); } - static void -volume_changed_cb (DBusGProxy *proxy UNUSED, - const gchar* device, - const gdouble value, - void * foo UNUSED ) +static void +volume_changed_cb(DBusGProxy *proxy UNUSED, const gchar* device, const gdouble value, + void * foo UNUSED ) { - DEBUG ("Volume of %s changed to %f.",device, value); - set_slider(device, value); + DEBUG ("Volume of %s changed to %f.",device, value); + set_slider(device, value); } - static void -voice_mail_cb (DBusGProxy *proxy UNUSED, - const gchar* accountID, - const guint nb, - void * foo UNUSED ) +static void +voice_mail_cb(DBusGProxy *proxy UNUSED, const gchar* accountID, const guint nb, + void * foo UNUSED ) { - DEBUG ("%d Voice mail waiting!",nb); - sflphone_notify_voice_mail (accountID , nb); + DEBUG ("%d Voice mail waiting!",nb); + sflphone_notify_voice_mail(accountID, nb); } - static void -incoming_message_cb (DBusGProxy *proxy UNUSED, - const gchar* accountID UNUSED, - const gchar* msg, - void * foo UNUSED ) +static void +incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar* accountID UNUSED, + const gchar* msg, void * foo UNUSED ) { - DEBUG ("Message %s!",msg); + DEBUG ("Message %s!",msg); } - static void -call_state_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - const gchar* state, - void * foo UNUSED ) +static void +call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state, + void * foo UNUSED ) { - DEBUG ("Call %s state %s",callID, state); - callable_obj_t * c = calllist_get(current_calls, callID); - if(c) + DEBUG ("Call %s state %s",callID, state); + callable_obj_t * c = calllist_get(current_calls, callID); + if (c) { - if ( strcmp(state, "HUNGUP") == 0 ) + if (strcmp(state, "HUNGUP") == 0) { - if(c->_state==CALL_STATE_CURRENT) + if (c->_state == CALL_STATE_CURRENT) { - // peer hung up, the conversation was established, so _stop has been initialized with the current time value - DEBUG("call state current"); - set_timestamp (&c->_time_stop); - calltree_update_call( history, c, NULL); + // peer hung up, the conversation was established, so _stop has been initialized with the current time value + DEBUG("call state current"); + set_timestamp(&c->_time_stop); + calltree_update_call(history, c, NULL); } - stop_notification(); - sflphone_hung_up (c); - calltree_update_call( history, c, NULL ); - status_bar_display_account(); + stop_notification(); + sflphone_hung_up(c); + calltree_update_call(history, c, NULL ); + status_bar_display_account(); } - else if ( strcmp(state, "UNHOLD_CURRENT") == 0 ) + else if (strcmp(state, "UNHOLD_CURRENT") == 0) { - sflphone_current (c); + sflphone_current(c); } - else if ( strcmp(state, "UNHOLD_RECORD") == 0 ) + else if (strcmp(state, "UNHOLD_RECORD") == 0) { - sflphone_record (c); + sflphone_record(c); } - else if ( strcmp(state, "HOLD") == 0 ) + else if (strcmp(state, "HOLD") == 0) { - sflphone_hold (c); + sflphone_hold(c); } - else if ( strcmp(state, "RINGING") == 0 ) + else if (strcmp(state, "RINGING") == 0) { - sflphone_ringing (c); + sflphone_ringing(c); } - else if ( strcmp(state, "CURRENT") == 0 ) + else if (strcmp(state, "CURRENT") == 0) { - sflphone_current (c); + sflphone_current(c); } - else if ( strcmp(state, "FAILURE") == 0 ) + else if (strcmp(state, "FAILURE") == 0) { - sflphone_fail (c); + sflphone_fail(c); } - else if ( strcmp(state, "BUSY") == 0 ) + else if (strcmp(state, "BUSY") == 0) { - sflphone_busy (c); + sflphone_busy(c); } } - else + else { - // The callID is unknow, threat it like a new call - // If it were an incoming call, we won't be here - // It means that a new call has been initiated with an other client (cli for instance) - if ( strcmp(state, "RINGING") == 0 || strcmp(state, "CURRENT") == 0) + // The callID is unknow, threat it like a new call + // If it were an incoming call, we won't be here + // It means that a new call has been initiated with an other client (cli for instance) + if (strcmp(state, "RINGING") == 0 || strcmp(state, "CURRENT") == 0) { - callable_obj_t *new_call; - GHashTable *call_details; - gchar *type; + callable_obj_t *new_call; + GHashTable *call_details; + gchar *type; - DEBUG ("New ringing call! accountID: %s", callID); + DEBUG ("New ringing call! accountID: %s", callID); - // We fetch the details associated to the specified call - call_details = dbus_get_call_details (callID); - create_new_call_from_details (callID, call_details, &new_call); + // We fetch the details associated to the specified call + call_details = dbus_get_call_details(callID); + create_new_call_from_details(callID, call_details, &new_call); - // Restore the callID to be synchronous with the daemon - new_call->_callID = g_strdup(callID); - type = g_hash_table_lookup (call_details, "CALL_TYPE"); + // Restore the callID to be synchronous with the daemon + new_call->_callID = g_strdup(callID); + type = g_hash_table_lookup(call_details, "CALL_TYPE"); - if (g_strcasecmp (type, "0") == 0) + if (g_strcasecmp(type, "0") == 0) { - // DEBUG("incoming\n"); - new_call->_history_state = INCOMING; + // DEBUG("incoming\n"); + new_call->_history_state = INCOMING; } - else + else { - // DEBUG("outgoing\n"); - new_call->_history_state = OUTGOING; + // DEBUG("outgoing\n"); + new_call->_history_state = OUTGOING; } - calllist_add (current_calls, new_call); - calllist_add (history, new_call); - calltree_add_call (current_calls, new_call, NULL); - update_actions (); - calltree_display (current_calls); + calllist_add(current_calls, new_call); + calllist_add(history, new_call); + calltree_add_call(current_calls, new_call, NULL); + update_actions(); + calltree_display(current_calls); - //sflphone_incoming_call (new_call); + //sflphone_incoming_call (new_call); } } } static void -conference_changed_cb (DBusGProxy *proxy UNUSED, - const gchar* confID, - const gchar* state, - void * foo UNUSED ) +conference_changed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, + const gchar* state, void * foo UNUSED ) { - - // sflphone_display_transfer_status("Transfer successfull"); - conference_obj_t* changed_conf = conferencelist_get(confID); - gchar** participants; - gchar** part; - DEBUG("conference new state %s\n", state); + // sflphone_display_transfer_status("Transfer successfull"); + conference_obj_t* changed_conf = conferencelist_get(confID); + gchar** participants; + gchar** part; + + DEBUG("conference new state %s\n", state); - if(changed_conf) + if (changed_conf) { - // remove old conference from calltree - calltree_remove_conference (current_calls, changed_conf, NULL); + // remove old conference from calltree + calltree_remove_conference(current_calls, changed_conf, NULL); - // update conference state - if ( strcmp(state, "ACTIVE_ATACHED") == 0 ) { - changed_conf->_state = CONFERENCE_STATE_ACTIVE_ATACHED; - } - else if ( strcmp(state, "ACTIVE_DETACHED") == 0 ) { - changed_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED; - } - else if ( strcmp(state, "HOLD") == 0 ) { - changed_conf->_state = CONFERENCE_STATE_HOLD; - } - else { - DEBUG("Error: conference state not recognized"); - } - + // update conference state + if (strcmp(state, "ACTIVE_ATACHED") == 0) + { + changed_conf->_state = CONFERENCE_STATE_ACTIVE_ATACHED; + } + else if (strcmp(state, "ACTIVE_DETACHED") == 0) + { + changed_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED; + } + else if (strcmp(state, "HOLD") == 0) + { + changed_conf->_state = CONFERENCE_STATE_HOLD; + } + else + { + DEBUG("Error: conference state not recognized"); + } - participants = (gchar**)dbus_get_participant_list(changed_conf->_confID); + participants = (gchar**) dbus_get_participant_list(changed_conf->_confID); - // update conferece participants - conference_participant_list_update(participants, changed_conf); - - // add new conference to calltree - calltree_add_conference (current_calls, changed_conf); + // update conferece participants + conference_participant_list_update(participants, changed_conf); + + // add new conference to calltree + calltree_add_conference(current_calls, changed_conf); } } - 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 ("Conference added %s\n", confID); - conference_obj_t* new_conf; - callable_obj_t* call; - gchar* call_id; - gchar** participants; - gchar** part; + conference_obj_t* new_conf; + callable_obj_t* call; + gchar* call_id; + gchar** participants; + gchar** part; - create_new_conference(CONFERENCE_STATE_ACTIVE_ATACHED, confID, &new_conf); - // new_conf->_confID = g_strdup(confID); + 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); - conference_participant_list_update(participants, new_conf); + conference_participant_list_update(participants, new_conf); - // participant = new_conf->participant; - for (part = participants; *part; part++) - { - call_id = (gchar*)(*part); - call = calllist_get (current_calls, call_id); - call->_confID = g_strdup(confID); + // participant = new_conf->participant; + for (part = participants; *part; part++) + { + call_id = (gchar*) (*part); + call = calllist_get(current_calls, call_id); + call->_confID = g_strdup(confID); } - conferencelist_add(new_conf); - calltree_add_conference (current_calls, new_conf); + conferencelist_add(new_conf); + calltree_add_conference(current_calls, new_conf); } - static void -conference_removed_cb (DBusGProxy *proxy UNUSED, - const gchar* confID, - void * foo UNUSED ) +conference_removed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo UNUSED ) { - DEBUG ("Conference removed %s\n", confID); + DEBUG ("Conference removed %s\n", confID); - conference_obj_t * c = conferencelist_get(confID); - calltree_remove_conference (current_calls, c, NULL); - conferencelist_remove(c->_confID); + conference_obj_t * c = conferencelist_get(confID); + calltree_remove_conference(current_calls, c, NULL); + conferencelist_remove(c->_confID); } - - static void -accounts_changed_cb (DBusGProxy *proxy UNUSED, - void * foo UNUSED ) +static void +accounts_changed_cb(DBusGProxy *proxy UNUSED, void * foo UNUSED ) { - DEBUG ("Accounts changed"); - sflphone_fill_account_list (); - sflphone_fill_ip2ip_profile(); - account_list_config_dialog_fill(); + DEBUG ("Accounts changed"); + sflphone_fill_account_list(); + sflphone_fill_ip2ip_profile(); + account_list_config_dialog_fill(); - // Update the status bar in case something happened - // Should fix ticket #1215 - status_bar_display_account(); + // Update the status bar in case something happened + // Should fix ticket #1215 + status_bar_display_account(); } - - static void -transfer_succeded_cb (DBusGProxy *proxy UNUSED, - void * foo UNUSED ) +static void +transfer_succeded_cb(DBusGProxy *proxy UNUSED, void * foo UNUSED ) { - DEBUG ("Transfer succeded\n"); - sflphone_display_transfer_status("Transfer successfull"); + DEBUG ("Transfer succeded\n"); + sflphone_display_transfer_status("Transfer successfull"); } - - static void -transfer_failed_cb (DBusGProxy *proxy UNUSED, - void * foo UNUSED ) +static void +transfer_failed_cb(DBusGProxy *proxy UNUSED, void * foo UNUSED ) { - DEBUG ("Transfer failed\n"); - sflphone_display_transfer_status("Transfer failed"); + DEBUG ("Transfer failed\n"); + sflphone_display_transfer_status("Transfer failed"); } -static void -secure_sdes_on_cb(DBusGProxy *proxy UNUSED, - const gchar *callID, - void *foo UNUSED) +static void +secure_sdes_on_cb(DBusGProxy *proxy UNUSED, const gchar *callID, void *foo UNUSED) { - DEBUG("SRTP using SDES is on"); - callable_obj_t *c = calllist_get(current_calls, callID); - if(c) { - sflphone_srtp_sdes_on(c); - notify_secure_on(c); + DEBUG("SRTP using SDES is on"); + callable_obj_t *c = calllist_get(current_calls, callID); + if (c) + { + sflphone_srtp_sdes_on(c); + notify_secure_on(c); } } - static void -secure_sdes_off_cb(DBusGProxy *proxy UNUSED, - const gchar *callID, - void *foo UNUSED) +secure_sdes_off_cb(DBusGProxy *proxy UNUSED, const gchar *callID, void *foo UNUSED) { - DEBUG("SRTP using SDES is off"); - callable_obj_t *c = calllist_get(current_calls, callID); - if(c) { - sflphone_srtp_sdes_off(c); - notify_secure_off(c); + DEBUG("SRTP using SDES is off"); + callable_obj_t *c = calllist_get(current_calls, callID); + if (c) + { + sflphone_srtp_sdes_off(c); + notify_secure_off(c); } } - static void -secure_zrtp_on_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - const gchar* cipher, - void * foo UNUSED ) +static void +secure_zrtp_on_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* cipher, + void * foo UNUSED ) { - DEBUG ("SRTP using ZRTP is ON secure_on_cb"); - callable_obj_t * c = calllist_get(current_calls, callID); - if(c) { - c->_srtp_cipher = g_strdup(cipher); - - sflphone_srtp_zrtp_on (c); - notify_secure_on(c); + DEBUG ("SRTP using ZRTP is ON secure_on_cb"); + callable_obj_t * c = calllist_get(current_calls, callID); + if (c) + { + c->_srtp_cipher = g_strdup(cipher); + + sflphone_srtp_zrtp_on(c); + notify_secure_on(c); } } - static void -secure_zrtp_off_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - void * foo UNUSED ) +static void +secure_zrtp_off_cb(DBusGProxy *proxy UNUSED, const gchar* callID, void * foo UNUSED ) { - DEBUG ("SRTP using ZRTP is OFF"); - callable_obj_t * c = calllist_get(current_calls, callID); - if(c) { - sflphone_srtp_zrtp_off (c); - notify_secure_off (c); + DEBUG ("SRTP using ZRTP is OFF"); + callable_obj_t * c = calllist_get(current_calls, callID); + if (c) + { + sflphone_srtp_zrtp_off(c); + notify_secure_off(c); } } - static void -show_zrtp_sas_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - const gchar* sas, - const gboolean verified, - void * foo UNUSED ) +static void +show_zrtp_sas_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* sas, + const gboolean verified, void * foo UNUSED ) { - DEBUG ("Showing SAS"); - callable_obj_t * c = calllist_get(current_calls, callID); - if(c) { - sflphone_srtp_zrtp_show_sas (c, sas, verified); + DEBUG ("Showing SAS"); + callable_obj_t * c = calllist_get(current_calls, callID); + if (c) + { + sflphone_srtp_zrtp_show_sas(c, sas, verified); } } - static void -confirm_go_clear_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - void * foo UNUSED ) +static void +confirm_go_clear_cb(DBusGProxy *proxy UNUSED, const gchar* callID, void * foo UNUSED ) { - DEBUG ("Confirm Go Clear request"); - callable_obj_t * c = calllist_get(current_calls, callID); - if(c) { - sflphone_confirm_go_clear (c); + DEBUG ("Confirm Go Clear request"); + callable_obj_t * c = calllist_get(current_calls, callID); + if (c) + { + sflphone_confirm_go_clear(c); } } - static void -zrtp_not_supported_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - void * foo UNUSED ) +static void +zrtp_not_supported_cb(DBusGProxy *proxy UNUSED, const gchar* callID, void * foo UNUSED ) { - DEBUG ("ZRTP not supported on the other end"); - callable_obj_t * c = calllist_get(current_calls, callID); - if(c) { - sflphone_srtp_zrtp_not_supported (c); - notify_zrtp_not_supported(c); + DEBUG ("ZRTP not supported on the other end"); + callable_obj_t * c = calllist_get(current_calls, callID); + if (c) + { + sflphone_srtp_zrtp_not_supported(c); + notify_zrtp_not_supported(c); } } - static void -sip_call_state_cb (DBusGProxy *proxy UNUSED, - const gchar* callID, - const gchar* description, - const guint code, - void * foo UNUSED ) +static void +sip_call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, + const gchar* description, const guint code, void * foo UNUSED ) { - callable_obj_t * c = NULL; - c = calllist_get(current_calls, callID); + callable_obj_t * c = NULL; + c = calllist_get(current_calls, callID); - if(c != NULL) { - DEBUG("sip_call_state_cb received code %d", code); - sflphone_call_state_changed(c, description, code); + if (c != NULL) + { + DEBUG("sip_call_state_cb received code %d", code); + sflphone_call_state_changed(c, description, code); } } - static void -error_alert(DBusGProxy *proxy UNUSED, - int errCode, - void * foo UNUSED ) +static void +error_alert(DBusGProxy *proxy UNUSED, int errCode, void * foo UNUSED ) { - ERROR ("Error notifying : (%i)", errCode); - sflphone_throw_exception( errCode ); + ERROR ("Error notifying : (%i)", errCode); + sflphone_throw_exception(errCode); } - gboolean -dbus_connect () -{ - - GError *error = NULL; - connection = NULL; - instanceProxy = NULL; - - g_type_init (); - - connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); +gboolean +dbus_connect() +{ - if (error) - { - ERROR ("Failed to open connection to bus: %s", - error->message); - g_error_free (error); - return FALSE; - } - - /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */ - - - instanceProxy = dbus_g_proxy_new_for_name (connection, - "org.sflphone.SFLphone", - "/org/sflphone/SFLphone/Instance", - "org.sflphone.SFLphone.Instance"); - /* - instanceProxy = dbus_g_proxy_new_for_name_owner (connection, - "org.sflphone.SFLphone", - "/org/sflphone/SFLphone/Instance", - "org.sflphone.SFLphone.Instance", - &error); - */ - - if (instanceProxy==NULL) - { - ERROR ("Failed to get proxy to Instance"); - return FALSE; - } - - - DEBUG ("DBus connected to Instance"); - - - callManagerProxy = dbus_g_proxy_new_for_name (connection, - "org.sflphone.SFLphone", - "/org/sflphone/SFLphone/CallManager", - "org.sflphone.SFLphone.CallManager"); - - /* - callManagerProxy = dbus_g_proxy_new_for_name_owner (connection, - "org.sflphone.SFLphone", - "/org/sflphone/SFLphone/CallManager", - "org.sflphone.SFLphone.CallManager", - &error); - */ - if (callManagerProxy==NULL) - { - ERROR ("Failed to get proxy to CallManagers"); - return FALSE; - } - - DEBUG ("DBus connected to CallManager"); - /* STRING STRING STRING Marshaller */ - /* Incoming call */ - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_STRING, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "incomingCall", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "incomingCall", G_CALLBACK(incoming_call_cb), NULL, NULL); - - dbus_g_proxy_add_signal (callManagerProxy, - "zrtpNegotiationFailed", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "zrtpNegotiationFailed", G_CALLBACK(zrtp_negotiation_failed_cb), NULL, NULL); - - /* Current codec */ - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_STRING, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "currentSelectedCodec", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "currentSelectedCodec", G_CALLBACK(curent_selected_codec), NULL, NULL); - - /* Register a marshaller for STRING,STRING */ - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "callStateChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "callStateChanged", G_CALLBACK(call_state_cb), NULL, NULL); - - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_INT, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "voiceMailNotify", G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "voiceMailNotify", G_CALLBACK(voice_mail_cb), NULL, NULL); - - dbus_g_proxy_add_signal (callManagerProxy, - "incomingMessage", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "incomingMessage", G_CALLBACK(incoming_message_cb), NULL, NULL); - - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_DOUBLE, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "volumeChanged", G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "volumeChanged", G_CALLBACK(volume_changed_cb), NULL, NULL); - - dbus_g_proxy_add_signal (callManagerProxy, - "transferSucceded", G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "transferSucceded", G_CALLBACK(transfer_succeded_cb), NULL, NULL); - - dbus_g_proxy_add_signal (callManagerProxy, - "transferFailed", G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "transferFailed", G_CALLBACK(transfer_failed_cb), NULL, NULL); - - /* Conference related callback */ - - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "conferenceChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "conferenceChanged", G_CALLBACK(conference_changed_cb), NULL, NULL); - - dbus_g_proxy_add_signal (callManagerProxy, - "conferenceCreated", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "conferenceCreated", G_CALLBACK(conference_created_cb), NULL, NULL); - - dbus_g_proxy_add_signal (callManagerProxy, - "conferenceRemoved", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "conferenceRemoved", G_CALLBACK(conference_removed_cb), NULL, NULL); - - /* Security related callbacks */ - - dbus_g_proxy_add_signal (callManagerProxy, - "secureSdesOn", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "secureSdesOn", G_CALLBACK(secure_sdes_on_cb), NULL, NULL); - - dbus_g_proxy_add_signal (callManagerProxy, - "secureSdesOff", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "secureSdesOff", G_CALLBACK(secure_sdes_off_cb), NULL, NULL); - - /* Register a marshaller for STRING,STRING,BOOL */ - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_BOOL, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "showSAS", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "showSAS", G_CALLBACK(show_zrtp_sas_cb), NULL, NULL); - - - dbus_g_proxy_add_signal (callManagerProxy, - "secureZrtpOn", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "secureZrtpOn", G_CALLBACK(secure_zrtp_on_cb), NULL, NULL); - - /* Register a marshaller for STRING*/ - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_add_signal (callManagerProxy, - "secureZrtpOff", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "secureZrtpOff", G_CALLBACK(secure_zrtp_off_cb), NULL, NULL); - dbus_g_proxy_add_signal (callManagerProxy, - "zrtpNotSuppOther", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "zrtpNotSuppOther", G_CALLBACK(zrtp_not_supported_cb), NULL, NULL); - dbus_g_proxy_add_signal (callManagerProxy, - "confirmGoClear", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "confirmGoClear", G_CALLBACK(confirm_go_clear_cb), NULL, NULL); - - /* VOID STRING STRING INT */ - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_INT, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); - - - dbus_g_proxy_add_signal (callManagerProxy, - "sipCallStateChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (callManagerProxy, - "sipCallStateChanged", G_CALLBACK(sip_call_state_cb), NULL, NULL); - - configurationManagerProxy = dbus_g_proxy_new_for_name (connection, - "org.sflphone.SFLphone", - "/org/sflphone/SFLphone/ConfigurationManager", - "org.sflphone.SFLphone.ConfigurationManager"); - - - /* - configurationManagerProxy = dbus_g_proxy_new_for_name_owner (connection, - "org.sflphone.SFLphone", - "/org/sflphone/SFLphone/ConfigurationManager", - "org.sflphone.SFLphone.ConfigurationManager", - &error); - */ - if (!configurationManagerProxy) - { - ERROR ("Failed to get proxy to ConfigurationManager"); - return FALSE; - } - DEBUG ("DBus connected to ConfigurationManager"); - dbus_g_proxy_add_signal (configurationManagerProxy, - "accountsChanged", G_TYPE_INVALID); - dbus_g_proxy_connect_signal (configurationManagerProxy, - "accountsChanged", G_CALLBACK(accounts_changed_cb), NULL, NULL); - - dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__INT, - G_TYPE_NONE, G_TYPE_INT , G_TYPE_INVALID); - dbus_g_proxy_add_signal (configurationManagerProxy, - "errorAlert", G_TYPE_INT , G_TYPE_INVALID); - dbus_g_proxy_connect_signal (configurationManagerProxy, - "errorAlert", G_CALLBACK(error_alert), NULL, NULL); - - /* Defines a default timeout for the proxies */ + GError *error = NULL; + connection = NULL; + instanceProxy = NULL; + + g_type_init(); + + connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + + if (error) + { + ERROR ("Failed to open connection to bus: %s", + error->message); + g_error_free(error); + return FALSE; + } + + /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */ + + instanceProxy = dbus_g_proxy_new_for_name(connection, + "org.sflphone.SFLphone", "/org/sflphone/SFLphone/Instance", + "org.sflphone.SFLphone.Instance"); + /* + instanceProxy = dbus_g_proxy_new_for_name_owner (connection, + "org.sflphone.SFLphone", + "/org/sflphone/SFLphone/Instance", + "org.sflphone.SFLphone.Instance", + &error); + */ + + if (instanceProxy == NULL) + { + ERROR ("Failed to get proxy to Instance"); + return FALSE; + } + + DEBUG ("DBus connected to Instance"); + + callManagerProxy = dbus_g_proxy_new_for_name(connection, + "org.sflphone.SFLphone", "/org/sflphone/SFLphone/CallManager", + "org.sflphone.SFLphone.CallManager"); + + /* + callManagerProxy = dbus_g_proxy_new_for_name_owner (connection, + "org.sflphone.SFLphone", + "/org/sflphone/SFLphone/CallManager", + "org.sflphone.SFLphone.CallManager", + &error); + */ + if (callManagerProxy == NULL) + { + ERROR ("Failed to get proxy to CallManagers"); + return FALSE; + } + + DEBUG ("DBus connected to CallManager"); + /* STRING STRING STRING Marshaller */ + /* Incoming call */ + dbus_g_object_register_marshaller( + g_cclosure_user_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "incomingCall", G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "incomingCall", + G_CALLBACK(incoming_call_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "zrtpNegotiationFailed", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "zrtpNegotiationFailed", + G_CALLBACK(zrtp_negotiation_failed_cb), NULL, NULL); + + /* Current codec */ + dbus_g_object_register_marshaller( + g_cclosure_user_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "currentSelectedCodec", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "currentSelectedCodec", + G_CALLBACK(curent_selected_codec), NULL, NULL); + + /* Register a marshaller for STRING,STRING */ + dbus_g_object_register_marshaller( + g_cclosure_user_marshal_VOID__STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "callStateChanged", G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "callStateChanged", + G_CALLBACK(call_state_cb), NULL, NULL); + + dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_INT, + G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "voiceMailNotify", G_TYPE_STRING, + G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "voiceMailNotify", + G_CALLBACK(voice_mail_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "incomingMessage", G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "incomingMessage", + G_CALLBACK(incoming_message_cb), NULL, NULL); + + dbus_g_object_register_marshaller( + g_cclosure_user_marshal_VOID__STRING_DOUBLE, G_TYPE_NONE, G_TYPE_STRING, + G_TYPE_DOUBLE, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "volumeChanged", G_TYPE_STRING, + G_TYPE_DOUBLE, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "volumeChanged", + G_CALLBACK(volume_changed_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "transferSucceded", G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "transferSucceded", + G_CALLBACK(transfer_succeded_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "transferFailed", G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "transferFailed", + G_CALLBACK(transfer_failed_cb), NULL, NULL); + + /* Conference related callback */ + + dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING, + G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "conferenceChanged", G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "conferenceChanged", + G_CALLBACK(conference_changed_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "conferenceCreated", G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "conferenceCreated", + G_CALLBACK(conference_created_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "conferenceRemoved", G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "conferenceRemoved", + G_CALLBACK(conference_removed_cb), NULL, NULL); + + /* Security related callbacks */ + + dbus_g_proxy_add_signal(callManagerProxy, "secureSdesOn", G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "secureSdesOn", + G_CALLBACK(secure_sdes_on_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "secureSdesOff", G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "secureSdesOff", + G_CALLBACK(secure_sdes_off_cb), NULL, NULL); + + /* Register a marshaller for STRING,STRING,BOOL */ + dbus_g_object_register_marshaller( + g_cclosure_user_marshal_VOID__STRING_STRING_BOOL, G_TYPE_NONE, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "showSAS", G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "showSAS", + G_CALLBACK(show_zrtp_sas_cb), NULL, NULL); + + dbus_g_proxy_add_signal(callManagerProxy, "secureZrtpOn", G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "secureZrtpOn", + G_CALLBACK(secure_zrtp_on_cb), NULL, NULL); + + /* Register a marshaller for STRING*/ + dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING, + G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_add_signal(callManagerProxy, "secureZrtpOff", G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "secureZrtpOff", + G_CALLBACK(secure_zrtp_off_cb), NULL, NULL); + dbus_g_proxy_add_signal(callManagerProxy, "zrtpNotSuppOther", G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "zrtpNotSuppOther", + G_CALLBACK(zrtp_not_supported_cb), NULL, NULL); + dbus_g_proxy_add_signal(callManagerProxy, "confirmGoClear", G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "confirmGoClear", + G_CALLBACK(confirm_go_clear_cb), NULL, NULL); + + /* VOID STRING STRING INT */ + dbus_g_object_register_marshaller( + g_cclosure_user_marshal_VOID__STRING_STRING_INT, G_TYPE_NONE, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); + + dbus_g_proxy_add_signal(callManagerProxy, "sipCallStateChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(callManagerProxy, "sipCallStateChanged", + G_CALLBACK(sip_call_state_cb), NULL, NULL); + + configurationManagerProxy = dbus_g_proxy_new_for_name(connection, + "org.sflphone.SFLphone", "/org/sflphone/SFLphone/ConfigurationManager", + "org.sflphone.SFLphone.ConfigurationManager"); + + /* + configurationManagerProxy = dbus_g_proxy_new_for_name_owner (connection, + "org.sflphone.SFLphone", + "/org/sflphone/SFLphone/ConfigurationManager", + "org.sflphone.SFLphone.ConfigurationManager", + &error); + */ + if (!configurationManagerProxy) + { + ERROR ("Failed to get proxy to ConfigurationManager"); + return FALSE; + } + DEBUG ("DBus connected to ConfigurationManager"); + dbus_g_proxy_add_signal(configurationManagerProxy, "accountsChanged", + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(configurationManagerProxy, "accountsChanged", + G_CALLBACK(accounts_changed_cb), NULL, NULL); + + dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__INT, + G_TYPE_NONE, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_add_signal(configurationManagerProxy, "errorAlert", G_TYPE_INT, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(configurationManagerProxy, "errorAlert", + G_CALLBACK(error_alert), NULL, NULL); + + /* Defines a default timeout for the proxies */ #if HAVE_DBUS_G_PROXY_SET_DEFAULT_TIMEOUT - dbus_g_proxy_set_default_timeout(callManagerProxy, DEFAULT_DBUS_TIMEOUT); - dbus_g_proxy_set_default_timeout(instanceProxy, DEFAULT_DBUS_TIMEOUT); - dbus_g_proxy_set_default_timeout(configurationManagerProxy, DEFAULT_DBUS_TIMEOUT); + dbus_g_proxy_set_default_timeout(callManagerProxy, DEFAULT_DBUS_TIMEOUT); + dbus_g_proxy_set_default_timeout(instanceProxy, DEFAULT_DBUS_TIMEOUT); + dbus_g_proxy_set_default_timeout(configurationManagerProxy, DEFAULT_DBUS_TIMEOUT); #endif - - return TRUE; + + return TRUE; } - void -dbus_clean () +void +dbus_clean() { - g_object_unref (callManagerProxy); - g_object_unref (configurationManagerProxy); - g_object_unref (instanceProxy); + g_object_unref(callManagerProxy); + g_object_unref(configurationManagerProxy); + g_object_unref(instanceProxy); } - - void -dbus_hold (const callable_obj_t * c) +void +dbus_hold(const callable_obj_t * c) { - DEBUG("dbus_hold %s\n", c->_callID); + DEBUG("dbus_hold %s\n", c->_callID); - GError *error = NULL; - org_sflphone_SFLphone_CallManager_hold ( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_hold(callManagerProxy, c->_callID, &error); + if (error) { - ERROR ("Failed to call hold() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call hold() on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_unhold (const callable_obj_t * c) +void +dbus_unhold(const callable_obj_t * c) { - DEBUG("dbus_unhold %s\n", c->_callID); + DEBUG("dbus_unhold %s\n", c->_callID); - GError *error = NULL; - org_sflphone_SFLphone_CallManager_unhold ( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_unhold(callManagerProxy, c->_callID, &error); + if (error) { - ERROR ("Failed to call unhold() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call unhold() on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_hold_conference (const conference_obj_t * c) +void +dbus_hold_conference(const conference_obj_t * c) { - DEBUG("dbus_hold_conference %s\n", c->_confID); + DEBUG("dbus_hold_conference %s\n", c->_confID); - GError *error = NULL; - org_sflphone_SFLphone_CallManager_hold_conference ( callManagerProxy, c->_confID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_hold_conference(callManagerProxy, + c->_confID, &error); + if (error) { - ERROR ("Failed to call hold() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call hold() on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_unhold_conference (const conference_obj_t * c) +void +dbus_unhold_conference(const conference_obj_t * c) { - DEBUG("dbus_unhold_conference %s\n", c->_confID); + DEBUG("dbus_unhold_conference %s\n", c->_confID); - GError *error = NULL; - org_sflphone_SFLphone_CallManager_unhold_conference ( callManagerProxy, c->_confID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_unhold_conference(callManagerProxy, + c->_confID, &error); + if (error) { - ERROR ("Failed to call unhold() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call unhold() on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_hang_up (const callable_obj_t * c) +void +dbus_hang_up(const callable_obj_t * c) { - DEBUG("dbus_hang_up %s\n", c->_callID); - - GError *error = NULL; - org_sflphone_SFLphone_CallManager_hang_up ( callManagerProxy, c->_callID, &error); - if (error) + DEBUG("dbus_hang_up %s\n", c->_callID); + + GError *error = NULL; + org_sflphone_SFLphone_CallManager_hang_up(callManagerProxy, c->_callID, + &error); + if (error) { - ERROR ("Failed to call hang_up() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call hang_up() on CallManager: %s", + error->message); + g_error_free(error); } } - - void -dbus_hang_up_conference (const conference_obj_t * c) +void +dbus_hang_up_conference(const conference_obj_t * c) { - DEBUG("dbus_hang_up_conference %s\n", c->_confID); - - GError *error = NULL; - org_sflphone_SFLphone_CallManager_hang_up_conference ( callManagerProxy, c->_confID, &error); - if (error) + DEBUG("dbus_hang_up_conference %s\n", c->_confID); + + GError *error = NULL; + org_sflphone_SFLphone_CallManager_hang_up_conference(callManagerProxy, + c->_confID, &error); + if (error) { - ERROR ("Failed to call hang_up() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call hang_up() on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_transfert (const callable_obj_t * c) +void +dbus_transfert(const callable_obj_t * c) { - GError *error = NULL; - org_sflphone_SFLphone_CallManager_transfert ( callManagerProxy, c->_callID, c->_trsft_to, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_transfert(callManagerProxy, c->_callID, + c->_trsft_to, &error); + if (error) { - ERROR ("Failed to call transfert() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call transfert() on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_accept (const callable_obj_t * c) +void +dbus_accept(const callable_obj_t * c) { #if GTK_CHECK_VERSION(2,10,0) - status_tray_icon_blink( FALSE ); + status_tray_icon_blink(FALSE); #endif - DEBUG("dbus_accept %s\n", c->_callID); + DEBUG("dbus_accept %s\n", c->_callID); - GError *error = NULL; - org_sflphone_SFLphone_CallManager_accept ( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_accept(callManagerProxy, c->_callID, &error); + if (error) { - ERROR ("Failed to call accept(%s) on CallManager: %s", c->_callID, - (error->message == NULL ? g_quark_to_string(error->domain): error->message)); - g_error_free (error); + ERROR ("Failed to call accept(%s) on CallManager: %s", c->_callID, + (error->message == NULL ? g_quark_to_string(error->domain): error->message)); + g_error_free(error); } } - void -dbus_refuse (const callable_obj_t * c) +void +dbus_refuse(const callable_obj_t * c) { #if GTK_CHECK_VERSION(2,10,0) - status_tray_icon_blink( FALSE ); + status_tray_icon_blink(FALSE); #endif - DEBUG("dbus_refuse %s\n", c->_callID); + DEBUG("dbus_refuse %s\n", c->_callID); - GError *error = NULL; - org_sflphone_SFLphone_CallManager_refuse ( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_refuse(callManagerProxy, c->_callID, &error); + if (error) { - ERROR ("Failed to call refuse() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call refuse() on CallManager: %s", + error->message); + g_error_free(error); } } - - void -dbus_place_call (const callable_obj_t * c) +void +dbus_place_call(const callable_obj_t * c) { - DEBUG("dbus_place_call %s\n", c->_callID); + DEBUG("dbus_place_call %s\n", c->_callID); - GError *error = NULL; - org_sflphone_SFLphone_CallManager_place_call ( callManagerProxy, c->_accountID, c->_callID, c->_peer_number, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_place_call(callManagerProxy, c->_accountID, + c->_callID, c->_peer_number, &error); + if (error) { - ERROR ("Failed to call placeCall() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call placeCall() on CallManager: %s", + error->message); + g_error_free(error); } } -gchar** dbus_account_list() { - GError *error = NULL; - char ** array; +gchar** +dbus_account_list() +{ + GError *error = NULL; + char ** array; - if(!org_sflphone_SFLphone_ConfigurationManager_get_account_list ( configurationManagerProxy, &array, &error)) + if (!org_sflphone_SFLphone_ConfigurationManager_get_account_list( + configurationManagerProxy, &array, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_account_list) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_account_list) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR("Error while calling get_account_list: %s", error->message); + ERROR("Error while calling get_account_list: %s", error->message); } - g_error_free (error); - return NULL; + g_error_free(error); + return NULL; } - else{ - DEBUG ("DBus called get_account_list() on ConfigurationManager"); - return array; + else + { + DEBUG ("DBus called get_account_list() on ConfigurationManager"); + return array; } } - -GHashTable* dbus_account_details(gchar * accountID) +GHashTable* +dbus_account_details(gchar * accountID) { - GError *error = NULL; - GHashTable * details; + GError *error = NULL; + GHashTable * details; - if(!org_sflphone_SFLphone_ConfigurationManager_get_account_details( configurationManagerProxy, accountID, &details, &error)) + if (!org_sflphone_SFLphone_ConfigurationManager_get_account_details( + configurationManagerProxy, accountID, &details, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_account_details) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_account_details) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR("Error while calling get_account_details: %s", error->message); + ERROR("Error while calling get_account_details: %s", error->message); } - g_error_free (error); - return NULL; + g_error_free(error); + return NULL; } - else{ - return details; + else + { + return details; } } - void +void dbus_set_credential(account_t *a, int index) { - DEBUG("Sending credential %d to server", index); - GError *error = NULL; - GHashTable * credential = g_ptr_array_index(a->credential_information, index); - - if(credential == NULL) { - DEBUG("Credential %d was deleted", index); - } else { - org_sflphone_SFLphone_ConfigurationManager_set_credential ( - configurationManagerProxy, - a->accountID, - index, - credential, - &error); - } - - if (error) { - ERROR ("Failed to call set_credential() on ConfigurationManager: %s", - error->message); - g_error_free (error); - } -} - void -dbus_set_number_of_credential(account_t *a, int number) -{ - DEBUG("Sending number of credential %d to server", number); - GError *error = NULL; - - org_sflphone_SFLphone_ConfigurationManager_set_number_of_credential( configurationManagerProxy, a->accountID, number, &error); - - if (error) { - ERROR ("Failed to call set_number_of_credential() on ConfigurationManager: %s", - error->message); - g_error_free (error); - } -} - void + DEBUG("Sending credential %d to server", index); + GError *error = NULL; + GHashTable * credential = g_ptr_array_index(a->credential_information, index); + + if (credential == NULL) + { + DEBUG("Credential %d was deleted", index); + } + else + { + org_sflphone_SFLphone_ConfigurationManager_set_credential( + configurationManagerProxy, a->accountID, index, credential, &error); + } + + if (error) + { + ERROR ("Failed to call set_credential() on ConfigurationManager: %s", + error->message); + g_error_free(error); + } +} +void +dbus_set_number_of_credential(account_t *a, int number) +{ + DEBUG("Sending number of credential %d to server", number); + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_set_number_of_credential( + configurationManagerProxy, a->accountID, number, &error); + + if (error) + { + ERROR ("Failed to call set_number_of_credential() on ConfigurationManager: %s", + error->message); + g_error_free(error); + } +} +void dbus_delete_all_credential(account_t *a) { - DEBUG("Deleting all credentials\n"); - GError *error = NULL; - - org_sflphone_SFLphone_ConfigurationManager_delete_all_credential(configurationManagerProxy, a->accountID, &error); - - if (error) { - ERROR ("Failed to call deleteAllCredential on ConfigurationManager: %s", - error->message); - g_error_free (error); - } + DEBUG("Deleting all credentials\n"); + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_delete_all_credential( + configurationManagerProxy, a->accountID, &error); + + if (error) + { + ERROR ("Failed to call deleteAllCredential on ConfigurationManager: %s", + error->message); + g_error_free(error); + } } - int +int dbus_get_number_of_credential(gchar * accountID) { - GError *error = NULL; - int number = 0; + GError *error = NULL; + int number = 0; + + DEBUG("Getting number of credential for account %s", accountID); - DEBUG("Getting number of credential for account %s", accountID); - - if(!org_sflphone_SFLphone_ConfigurationManager_get_number_of_credential( configurationManagerProxy, accountID, &number, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_account_details) exception %s: %s", dbus_g_error_get_name(error), error->message); + if (!org_sflphone_SFLphone_ConfigurationManager_get_number_of_credential( + configurationManagerProxy, accountID, &number, &error)) + { + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) + { + ERROR ("Caught remote method (get_account_details) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else { - ERROR("Error while calling get_account_details: %s", error->message); + else + { + ERROR("Error while calling get_account_details: %s", error->message); } - g_error_free (error); - return 0; - } else { - DEBUG("%d credential(s) found for account %s", number, accountID); - return number; + g_error_free(error); + return 0; + } + else + { + DEBUG("%d credential(s) found for account %s", number, accountID); + return number; } } -GHashTable* dbus_get_credential(gchar * accountID, int index) +GHashTable* +dbus_get_credential(gchar * accountID, int index) { - GError *error = NULL; - GHashTable * details; + GError *error = NULL; + GHashTable * details; - if(!org_sflphone_SFLphone_ConfigurationManager_get_credential( configurationManagerProxy, accountID, index, &details, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_account_details) exception %s: %s", dbus_g_error_get_name(error), error->message); - } else { - ERROR("Error while calling get_account_details: %s", error->message); + if (!org_sflphone_SFLphone_ConfigurationManager_get_credential( + configurationManagerProxy, accountID, index, &details, &error)) + { + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) + { + ERROR ("Caught remote method (get_account_details) exception %s: %s", dbus_g_error_get_name(error), error->message); + } + else + { + ERROR("Error while calling get_account_details: %s", error->message); } - g_error_free (error); - return NULL; - } else { - return details; + g_error_free(error); + return NULL; + } + else + { + return details; } } -GHashTable* dbus_get_ip2_ip_details(void) +GHashTable* +dbus_get_ip2_ip_details(void) { - GError *error = NULL; - GHashTable * details; - if(!org_sflphone_SFLphone_ConfigurationManager_get_ip2_ip_details( configurationManagerProxy, &details, &error)) + GError *error = NULL; + GHashTable * details; + if (!org_sflphone_SFLphone_ConfigurationManager_get_ip2_ip_details( + configurationManagerProxy, &details, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_ip2_ip_details) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_ip2_ip_details) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR("Error while calling get_ip2_ip_details: %s", error->message); + ERROR("Error while calling get_ip2_ip_details: %s", error->message); } - g_error_free (error); - return NULL; + g_error_free(error); + return NULL; } - else{ - return details; + else + { + return details; } } - void +void dbus_set_ip2ip_details(GHashTable * properties) { - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_ip2_ip_details ( - configurationManagerProxy, - properties, - &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_ip2_ip_details( + configurationManagerProxy, properties, &error); + if (error) { - ERROR ("Failed to call set_ip_2ip_details() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call set_ip_2ip_details() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } - void -dbus_send_register ( gchar* accountID , const guint enable) +void +dbus_send_register(gchar* accountID, const guint enable) { - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_send_register(configurationManagerProxy, accountID, enable ,&error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_send_register( + configurationManagerProxy, accountID, enable, &error); + if (error) { - ERROR ("Failed to call send_register() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call send_register() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } - void +void dbus_remove_account(gchar * accountID) { - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_remove_account ( - configurationManagerProxy, - accountID, - &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_remove_account( + configurationManagerProxy, accountID, &error); + if (error) { - ERROR ("Failed to call remove_account() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call remove_account() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } - void +void dbus_set_account_details(account_t *a) { - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_account_details ( - configurationManagerProxy, - a->accountID, - a->properties, - &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_account_details( + configurationManagerProxy, a->accountID, a->properties, &error); + if (error) { - ERROR ("Failed to call set_account_details() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call set_account_details() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } - gchar* +gchar* dbus_add_account(account_t *a) { - gchar* accountId; - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_add_account ( - configurationManagerProxy, - a->properties, - &accountId, - &error); - if (error) + gchar* accountId; + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_add_account( + configurationManagerProxy, a->properties, &accountId, &error); + if (error) { - ERROR ("Failed to call add_account() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call add_account() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return accountId; + return accountId; } - void +void dbus_set_volume(const gchar * device, gdouble value) { - GError *error = NULL; - org_sflphone_SFLphone_CallManager_set_volume( - callManagerProxy, - device, - value, - &error); + GError *error = NULL; + org_sflphone_SFLphone_CallManager_set_volume(callManagerProxy, device, value, + &error); - if (error) + if (error) { - ERROR ("Failed to call set_volume() on callManagerProxy: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call set_volume() on callManagerProxy: %s", + error->message); + g_error_free(error); } } - - gdouble +gdouble dbus_get_volume(const gchar * device) { - gdouble value; - GError *error = NULL; + gdouble value; + GError *error = NULL; - org_sflphone_SFLphone_CallManager_get_volume( - callManagerProxy, - device, - &value, - &error); + org_sflphone_SFLphone_CallManager_get_volume(callManagerProxy, device, + &value, &error); - if (error) + if (error) { - ERROR ("Failed to call get_volume() on callManagerProxy: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call get_volume() on callManagerProxy: %s", + error->message); + g_error_free(error); } - return value; + return value; } - - void +void dbus_play_dtmf(const gchar * key) { - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_CallManager_play_dt_mf( - callManagerProxy, - key, - &error); + org_sflphone_SFLphone_CallManager_play_dt_mf(callManagerProxy, key, &error); - if (error) + if (error) { - ERROR ("Failed to call playDTMF() on callManagerProxy: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call playDTMF() on callManagerProxy: %s", + error->message); + g_error_free(error); } } - void -dbus_start_tone(const int start , const guint type ) +void +dbus_start_tone(const int start, const guint type) { - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_CallManager_start_tone( - callManagerProxy, - start, - type, - &error); + org_sflphone_SFLphone_CallManager_start_tone(callManagerProxy, start, type, + &error); - if (error) + if (error) { - ERROR ("Failed to call startTone() on callManagerProxy: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call startTone() on callManagerProxy: %s", + error->message); + g_error_free(error); } } - void +void dbus_register(int pid, gchar * name) { - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_Instance_register( - instanceProxy, - pid, - name, - &error); + org_sflphone_SFLphone_Instance_register(instanceProxy, pid, name, &error); - if (error) + if (error) { - ERROR ("Failed to call register() on instanceProxy: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call register() on instanceProxy: %s", + error->message); + g_error_free(error); } } - void +void dbus_unregister(int pid) { - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_Instance_unregister( - instanceProxy, - pid, - &error); + org_sflphone_SFLphone_Instance_unregister(instanceProxy, pid, &error); - if (error) + if (error) { - ERROR ("Failed to call unregister() on instanceProxy: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call unregister() on instanceProxy: %s", + error->message); + g_error_free(error); } } - gchar** +gchar** dbus_codec_list() { - GError *error = NULL; - gchar** array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_codec_list ( - configurationManagerProxy, - &array, - &error); + GError *error = NULL; + gchar** array = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_codec_list( + configurationManagerProxy, &array, &error); - if (error) + if (error) { - ERROR ("Failed to call get_codec_list() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call get_codec_list() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return array; + return array; } - gchar** -dbus_codec_details( int payload ) +gchar** +dbus_codec_details(int payload) { - GError *error = NULL; - gchar ** array; - org_sflphone_SFLphone_ConfigurationManager_get_codec_details ( - configurationManagerProxy, - payload, - &array, - &error); + GError *error = NULL; + gchar ** array; + org_sflphone_SFLphone_ConfigurationManager_get_codec_details( + configurationManagerProxy, payload, &array, &error); - if (error) + if (error) { - ERROR ("Failed to call get_codec_details() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call get_codec_details() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return array; + return array; } -gchar* dbus_get_current_codec_name (const callable_obj_t * c) +gchar* +dbus_get_current_codec_name(const callable_obj_t * c) { - gchar* codecName= ""; - GError* error = NULL; + gchar* codecName = ""; + GError* error = NULL; - org_sflphone_SFLphone_CallManager_get_current_codec_name ( - callManagerProxy, - c->_callID, - &codecName, - &error); - if(error) + org_sflphone_SFLphone_CallManager_get_current_codec_name(callManagerProxy, + c->_callID, &codecName, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - DEBUG("dbus_get_current_codec_name : codecName : %s", codecName); + DEBUG("dbus_get_current_codec_name : codecName : %s", codecName); - return codecName; + return codecName; } -gchar** dbus_get_active_codec_list (gchar *accountID) { +gchar** +dbus_get_active_codec_list(gchar *accountID) +{ - gchar ** array; - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_active_codec_list ( - configurationManagerProxy, - accountID, - &array, - &error); + gchar ** array; + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_active_codec_list( + configurationManagerProxy, accountID, &array, &error); - if (error) + if (error) { - ERROR ("Failed to call get_active_codec_list() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call get_active_codec_list() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return array; + return array; } - void +void dbus_set_active_codec_list(const gchar** list, const gchar *accountID) { - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_active_codec_list ( - configurationManagerProxy, - list, - accountID, - &error); + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_active_codec_list( + configurationManagerProxy, list, accountID, &error); - if (error) + if (error) { - ERROR ("Failed to call set_active_codec_list() on ConfigurationManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call set_active_codec_list() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } /** * Get a list of input supported audio plugins */ - gchar** +gchar** dbus_get_input_audio_plugin_list() { - gchar** array; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_input_audio_plugin_list( - configurationManagerProxy, - &array, - &error); - if(error) + gchar** array; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_input_audio_plugin_list( + configurationManagerProxy, &array, &error); + if (error) { - ERROR("Failed to call get_input_audio_plugin_list() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call get_input_audio_plugin_list() on ConfigurationManager: %s", error->message); + g_error_free(error); } - return array; + return array; } /** * Get a list of output supported audio plugins */ - gchar** +gchar** dbus_get_output_audio_plugin_list() { - gchar** array; - GError* error = NULL; + gchar** array; + GError* error = NULL; - if(!org_sflphone_SFLphone_ConfigurationManager_get_output_audio_plugin_list( configurationManagerProxy, &array, &error)) + if (!org_sflphone_SFLphone_ConfigurationManager_get_output_audio_plugin_list( + configurationManagerProxy, &array, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_output_audio_plugin_list) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_output_audio_plugin_list) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR("Error while calling get_out_audio_plugin_list: %s", error->message); + ERROR("Error while calling get_out_audio_plugin_list: %s", error->message); } - g_error_free (error); - return NULL; + g_error_free(error); + return NULL; } - else{ - return array; + else + { + return array; } } - void +void dbus_set_input_audio_plugin(gchar* audioPlugin) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_input_audio_plugin( - configurationManagerProxy, - audioPlugin, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_input_audio_plugin( + configurationManagerProxy, audioPlugin, &error); + if (error) { - ERROR("Failed to call set_input_audio_plugin() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call set_input_audio_plugin() on ConfigurationManager: %s", error->message); + g_error_free(error); } } - void +void dbus_set_output_audio_plugin(gchar* audioPlugin) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_output_audio_plugin( - configurationManagerProxy, - audioPlugin, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_output_audio_plugin( + configurationManagerProxy, audioPlugin, &error); + if (error) { - ERROR("Failed to call set_output_audio_plugin() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call set_output_audio_plugin() on ConfigurationManager: %s", error->message); + g_error_free(error); } } /** * Get all output devices index supported by current audio manager */ -gchar** dbus_get_audio_output_device_list() +gchar** +dbus_get_audio_output_device_list() { - gchar** array; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_output_device_list( - configurationManagerProxy, - &array, - &error); - if(error) + gchar** array; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_audio_output_device_list( + configurationManagerProxy, &array, &error); + if (error) { - ERROR("Failed to call get_audio_output_device_list() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call get_audio_output_device_list() on ConfigurationManager: %s", error->message); + g_error_free(error); } - return array; + return array; } /** * Set audio output device from its index */ - void +void dbus_set_audio_output_device(const int index) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_audio_output_device( - configurationManagerProxy, - index, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_audio_output_device( + configurationManagerProxy, index, &error); + if (error) { - ERROR("Failed to call set_audio_output_device() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call set_audio_output_device() on ConfigurationManager: %s", error->message); + g_error_free(error); } } /** * Get all input devices index supported by current audio manager */ - gchar** +gchar** dbus_get_audio_input_device_list() { - gchar** array; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_input_device_list( - configurationManagerProxy, - &array, - &error); - if(error) + gchar** array; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_audio_input_device_list( + configurationManagerProxy, &array, &error); + if (error) { - ERROR("Failed to call get_audio_input_device_list() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call get_audio_input_device_list() on ConfigurationManager: %s", error->message); + g_error_free(error); } - return array; + return array; } /** * Set audio input device from its index */ - void +void dbus_set_audio_input_device(const int index) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_audio_input_device( - configurationManagerProxy, - index, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_audio_input_device( + configurationManagerProxy, index, &error); + if (error) { - ERROR("Failed to call set_audio_input_device() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call set_audio_input_device() on ConfigurationManager: %s", error->message); + g_error_free(error); } } /** * Get output device index and input device index */ - gchar** +gchar** dbus_get_current_audio_devices_index() { - gchar** array; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_current_audio_devices_index( - configurationManagerProxy, - &array, - &error); - if(error) + gchar** array; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_current_audio_devices_index( + configurationManagerProxy, &array, &error); + if (error) { - ERROR("Failed to call get_current_audio_devices_index() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call get_current_audio_devices_index() on ConfigurationManager: %s", error->message); + g_error_free(error); } - return array; + return array; } /** * Get index */ - int +int dbus_get_audio_device_index(const gchar *name) { - int index; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_device_index( - configurationManagerProxy, - name, - &index, - &error); - if(error) + int index; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_audio_device_index( + configurationManagerProxy, name, &index, &error); + if (error) { - ERROR("Failed to call get_audio_device_index() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call get_audio_device_index() on ConfigurationManager: %s", error->message); + g_error_free(error); } - return index; + return index; } /** * Get audio plugin */ - gchar* +gchar* dbus_get_current_audio_output_plugin() { - gchar* plugin=""; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_current_audio_output_plugin( - configurationManagerProxy, - &plugin, - &error); - if(error) + gchar* plugin = ""; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_current_audio_output_plugin( + configurationManagerProxy, &plugin, &error); + if (error) { - ERROR("Failed to call get_current_audio_output_plugin() on ConfigurationManager: %s", error->message); - g_error_free(error); + ERROR("Failed to call get_current_audio_output_plugin() on ConfigurationManager: %s", error->message); + g_error_free(error); } - return plugin; + return plugin; } - - gchar* +gchar* dbus_get_ringtone_choice() { - gchar* tone; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_ringtone_choice( - configurationManagerProxy, - &tone, - &error); - if(error) + gchar* tone; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_ringtone_choice( + configurationManagerProxy, &tone, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return tone; + return tone; } - void -dbus_set_ringtone_choice( const gchar* tone ) +void +dbus_set_ringtone_choice(const gchar* tone) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_ringtone_choice( - configurationManagerProxy, - tone, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_ringtone_choice( + configurationManagerProxy, tone, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - int +int dbus_is_ringtone_enabled() { - int res; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_is_ringtone_enabled( - configurationManagerProxy, - &res, - &error); - if(error) + int res; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_is_ringtone_enabled( + configurationManagerProxy, &res, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return res; + return res; } - void +void dbus_ringtone_enabled() { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_ringtone_enabled( - configurationManagerProxy, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_ringtone_enabled( + configurationManagerProxy, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - gboolean +gboolean dbus_is_md5_credential_hashing() { - int res; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_is_md5_credential_hashing( - configurationManagerProxy, - &res, - &error); - if(error) + int res; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_is_md5_credential_hashing( + configurationManagerProxy, &res, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return res; + return res; } - void +void dbus_set_md5_credential_hashing(gboolean enabled) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_md5_credential_hashing( - configurationManagerProxy, - enabled, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_md5_credential_hashing( + configurationManagerProxy, enabled, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - int +int dbus_is_iax2_enabled() { - int res; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_is_iax2_enabled( - configurationManagerProxy, - &res, - &error); - if(error) + int res; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_is_iax2_enabled( + configurationManagerProxy, &res, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return res; + return res; } - int +int dbus_get_dialpad() { - int state; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_dialpad( - configurationManagerProxy, - &state, - &error); - if(error) + int state; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_dialpad( + configurationManagerProxy, &state, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return state; + return state; } -void dbus_set_dialpad (gboolean display) +void +dbus_set_dialpad(gboolean display) { - - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_dialpad( - configurationManagerProxy, - display, - &error); - if(error) + + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_dialpad( + configurationManagerProxy, display, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - int +int dbus_get_searchbar() { - int state; - GError* error = NULL; - if(!org_sflphone_SFLphone_ConfigurationManager_get_searchbar( configurationManagerProxy, &state, &error)) + int state; + GError* error = NULL; + if (!org_sflphone_SFLphone_ConfigurationManager_get_searchbar( + configurationManagerProxy, &state, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_searchbar) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_searchbar) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR("Error while calling get_searchbar: %s", error->message); + ERROR("Error while calling get_searchbar: %s", error->message); } - g_error_free (error); - return -1; + g_error_free(error); + return -1; } - else + else { - return state; + return state; } } - void -dbus_set_searchbar( ) +void +dbus_set_searchbar() { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_searchbar( - configurationManagerProxy, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_searchbar( + configurationManagerProxy, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - int +int dbus_get_volume_controls() { - int state; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_volume_controls( - configurationManagerProxy, - &state, - &error); - if(error) + int state; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_volume_controls( + configurationManagerProxy, &state, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return state; + return state; } - void -dbus_set_volume_controls (gboolean display) +void +dbus_set_volume_controls(gboolean display) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_volume_controls( - configurationManagerProxy, - display, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_volume_controls( + configurationManagerProxy, display, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } @@ -1748,831 +1662,925 @@ void dbus_join_participant(const gchar* sel_callID, const gchar* drag_callID) { - DEBUG("dbus_join_participant %s and %s\n", sel_callID, drag_callID); + DEBUG("dbus_join_participant %s and %s\n", sel_callID, drag_callID); - GError* error = NULL; - - org_sflphone_SFLphone_CallManager_join_participant ( - callManagerProxy, - sel_callID, - drag_callID, - &error); - if(error) + GError* error = NULL; + + org_sflphone_SFLphone_CallManager_join_participant(callManagerProxy, + sel_callID, drag_callID, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - + } void dbus_add_participant(const gchar* callID, const gchar* confID) { - DEBUG("dbus_add_participant %s and %s\n", callID, confID); + DEBUG("dbus_add_participant %s and %s\n", callID, confID); - GError* error = NULL; - - org_sflphone_SFLphone_CallManager_add_participant ( - callManagerProxy, - callID, - confID, - &error); - if(error) + GError* error = NULL; + + org_sflphone_SFLphone_CallManager_add_participant(callManagerProxy, callID, + confID, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - + } void dbus_add_main_participant(const gchar* confID) { - DEBUG("dbus_add_participant %s\n", confID); + DEBUG("dbus_add_participant %s\n", confID); - GError* error = NULL; + GError* error = NULL; - org_sflphone_SFLphone_CallManager_add_main_participant ( - callManagerProxy, - confID, - &error); - if(error) + org_sflphone_SFLphone_CallManager_add_main_participant(callManagerProxy, + confID, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - - void +void dbus_detach_participant(const gchar* callID) { - DEBUG("dbus_detach_participant %s\n", callID); + DEBUG("dbus_detach_participant %s\n", callID); - GError* error = NULL; - org_sflphone_SFLphone_CallManager_detach_participant( - callManagerProxy, - callID, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_CallManager_detach_participant(callManagerProxy, + callID, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - -} +} dbus_join_conference(const gchar* sel_confID, const gchar* drag_confID) { - DEBUG("dbus_join_conference %s and %s\n", sel_confID, drag_confID); + DEBUG("dbus_join_conference %s and %s\n", sel_confID, drag_confID); - GError* error = NULL; - - org_sflphone_SFLphone_CallManager_join_conference ( - callManagerProxy, - sel_confID, - drag_confID, - &error); - if(error) + GError* error = NULL; + + org_sflphone_SFLphone_CallManager_join_conference(callManagerProxy, + sel_confID, drag_confID, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - -} - +} - void +void dbus_set_record(const gchar* id) { - DEBUG("dbus_set_record %s\n", id); + DEBUG("dbus_set_record %s\n", id); - GError* error = NULL; - org_sflphone_SFLphone_CallManager_set_recording ( - callManagerProxy, - id, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_CallManager_set_recording(callManagerProxy, id, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - - gboolean +gboolean dbus_get_is_recording(const callable_obj_t * c) { - DEBUG("dbus_get_is_recording %s\n", c->_callID); - GError* error = NULL; - gboolean isRecording; - org_sflphone_SFLphone_CallManager_get_is_recording ( - callManagerProxy, - c->_callID, - &isRecording, - &error); - if(error) + DEBUG("dbus_get_is_recording %s\n", c->_callID); + GError* error = NULL; + gboolean isRecording; + org_sflphone_SFLphone_CallManager_get_is_recording(callManagerProxy, + c->_callID, &isRecording, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - //DEBUG("RECORDING: %i",isRecording); - return isRecording; + //DEBUG("RECORDING: %i",isRecording); + return isRecording; } - void +void dbus_set_record_path(const gchar* path) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_record_path ( - configurationManagerProxy, - path, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_record_path( + configurationManagerProxy, path, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - gchar* +gchar* dbus_get_record_path(void) { - GError* error = NULL; - gchar *path; - org_sflphone_SFLphone_ConfigurationManager_get_record_path ( - configurationManagerProxy, - &path, - &error); - if(error) + GError* error = NULL; + gchar *path; + org_sflphone_SFLphone_ConfigurationManager_get_record_path( + configurationManagerProxy, &path, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return path; + return path; } -void dbus_set_history_limit (const guint days) +void +dbus_set_history_limit(const guint days) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_history_limit( - configurationManagerProxy, - days, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_history_limit( + configurationManagerProxy, days, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } -void dbus_set_history_enabled () +void +dbus_set_history_enabled() { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_history_enabled( - configurationManagerProxy, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_history_enabled( + configurationManagerProxy, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } -gchar* dbus_get_history_enabled () +gchar* +dbus_get_history_enabled() { - gchar* state; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_history_enabled( - configurationManagerProxy, - &state, - &error); - if(error) + gchar* state; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_history_enabled( + configurationManagerProxy, &state, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return state; + return state; } - - -guint dbus_get_history_limit (void) +guint +dbus_get_history_limit(void) { - GError* error = NULL; - gint days=30; - org_sflphone_SFLphone_ConfigurationManager_get_history_limit( - configurationManagerProxy, - &days, - &error); - if(error) + GError* error = NULL; + gint days = 30; + org_sflphone_SFLphone_ConfigurationManager_get_history_limit( + configurationManagerProxy, &days, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return (guint)days; + return (guint) days; } - void -dbus_start_hidden( void ) +void +dbus_start_hidden(void) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_start_hidden( - configurationManagerProxy, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_start_hidden( + configurationManagerProxy, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - - int -dbus_is_start_hidden( void ) +int +dbus_is_start_hidden(void) { - GError* error = NULL; - int state; - org_sflphone_SFLphone_ConfigurationManager_is_start_hidden( - configurationManagerProxy, - &state, - &error); - if(error) + GError* error = NULL; + int state; + org_sflphone_SFLphone_ConfigurationManager_is_start_hidden( + configurationManagerProxy, &state, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return state; + return state; } - int -dbus_popup_mode( void ) +int +dbus_popup_mode(void) { - GError* error = NULL; - int state; - org_sflphone_SFLphone_ConfigurationManager_popup_mode( - configurationManagerProxy, - &state, - &error); - if(error) + GError* error = NULL; + int state; + org_sflphone_SFLphone_ConfigurationManager_popup_mode( + configurationManagerProxy, &state, &error); + if (error) { - g_error_free(error); + g_error_free(error); } - return state; + return state; } - void -dbus_switch_popup_mode( void ) +void +dbus_switch_popup_mode(void) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_switch_popup_mode( - configurationManagerProxy, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_switch_popup_mode( + configurationManagerProxy, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - void -dbus_set_notify( void ) +void +dbus_set_notify(void) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_notify( - configurationManagerProxy, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_notify( + configurationManagerProxy, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - guint -dbus_get_notify( void ) +guint +dbus_get_notify(void) { - gint level; - GError* error = NULL; - if( !org_sflphone_SFLphone_ConfigurationManager_get_notify( configurationManagerProxy,&level, &error) ) + gint level; + GError* error = NULL; + if (!org_sflphone_SFLphone_ConfigurationManager_get_notify( + configurationManagerProxy, &level, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_notify) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_notify) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR ("Error while calling get_notify: %s", error->message); + ERROR ("Error while calling get_notify: %s", error->message); } - g_error_free (error); - return 0; + g_error_free(error); + return 0; } - else{ - return (guint)level; + else + { + return (guint) level; } } - void -dbus_set_audio_manager( int api ) +void +dbus_set_audio_manager(int api) { - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_audio_manager( - configurationManagerProxy, - api, - &error); - if(error) + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_audio_manager( + configurationManagerProxy, api, &error); + if (error) { - g_error_free(error); + g_error_free(error); } } - int -dbus_get_audio_manager( void ) +int +dbus_get_audio_manager(void) { - int api; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_manager( - configurationManagerProxy, - &api, - &error); - if(error) + int api; + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_audio_manager( + configurationManagerProxy, &api, &error); + if (error) { - ERROR("Error calling dbus_get_audio_manager"); - g_error_free(error); + ERROR("Error calling dbus_get_audio_manager"); + g_error_free(error); } - return api; + return api; } /* - void -dbus_set_sip_address( const gchar* address ) -{ - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_sip_address( - configurationManagerProxy, - address, - &error); - if(error) - { - g_error_free(error); - } -} -*/ + void + dbus_set_sip_address( const gchar* address ) + { + GError* error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_sip_address( + configurationManagerProxy, + address, + &error); + if(error) + { + g_error_free(error); + } + } + */ - /* +/* - gint -dbus_get_sip_address( void ) -{ - GError* error = NULL; - gint address; - org_sflphone_SFLphone_ConfigurationManager_get_sip_address( - configurationManagerProxy, - &address, - &error); - if(error) - { - g_error_free(error); - } - return address; -} + gint + dbus_get_sip_address( void ) + { + GError* error = NULL; + gint address; + org_sflphone_SFLphone_ConfigurationManager_get_sip_address( + configurationManagerProxy, + &address, + &error); + if(error) + { + g_error_free(error); + } + return address; + } */ -GHashTable* dbus_get_addressbook_settings (void) { +GHashTable* +dbus_get_addressbook_settings(void) +{ - GError *error = NULL; - GHashTable *results = NULL; + GError *error = NULL; + GHashTable *results = NULL; - //DEBUG ("Calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings"); + //DEBUG ("Calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings"); - org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings (configurationManagerProxy, &results, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings( + configurationManagerProxy, &results, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings"); + g_error_free(error); } - return results; + return results; } -void dbus_set_addressbook_settings (GHashTable * settings){ +void +dbus_set_addressbook_settings(GHashTable * settings) +{ - GError *error = NULL; + GError *error = NULL; - DEBUG ("Calling org_sflphone_SFLphone_ConfigurationManager_set_addressbook_settings"); + DEBUG ("Calling org_sflphone_SFLphone_ConfigurationManager_set_addressbook_settings"); - org_sflphone_SFLphone_ConfigurationManager_set_addressbook_settings (configurationManagerProxy, settings, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_addressbook_settings"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_set_addressbook_settings( + configurationManagerProxy, settings, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_addressbook_settings"); + g_error_free(error); } } -gchar** dbus_get_addressbook_list (void) { +gchar** +dbus_get_addressbook_list(void) +{ - GError *error = NULL; - gchar** array; + GError *error = NULL; + gchar** array; - org_sflphone_SFLphone_ConfigurationManager_get_addressbook_list (configurationManagerProxy, &array, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_list"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_get_addressbook_list( + configurationManagerProxy, &array, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_list"); + g_error_free(error); } - return array; + return array; } -void dbus_set_addressbook_list (const gchar** list){ +void +dbus_set_addressbook_list(const gchar** list) +{ - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_addressbook_list(configurationManagerProxy, list, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_addressbook_list"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_set_addressbook_list( + configurationManagerProxy, list, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_addressbook_list"); + g_error_free(error); } } -GHashTable* dbus_get_hook_settings (void) { +GHashTable* +dbus_get_hook_settings(void) +{ - GError *error = NULL; - GHashTable *results = NULL; + GError *error = NULL; + GHashTable *results = NULL; - //DEBUG ("Calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings"); + //DEBUG ("Calling org_sflphone_SFLphone_ConfigurationManager_get_addressbook_settings"); - org_sflphone_SFLphone_ConfigurationManager_get_hook_settings (configurationManagerProxy, &results, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_hook_settings"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_get_hook_settings( + configurationManagerProxy, &results, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_hook_settings"); + g_error_free(error); } - return results; + return results; } -void dbus_set_hook_settings (GHashTable * settings){ +void +dbus_set_hook_settings(GHashTable * settings) +{ - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_hook_settings (configurationManagerProxy, settings, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_hook_settings"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_set_hook_settings( + configurationManagerProxy, settings, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_hook_settings"); + g_error_free(error); } } -GHashTable* dbus_get_call_details (const gchar *callID) +GHashTable* +dbus_get_call_details(const gchar *callID) { - GError *error = NULL; - GHashTable *details = NULL; + GError *error = NULL; + GHashTable *details = NULL; - org_sflphone_SFLphone_CallManager_get_call_details (callManagerProxy, callID, &details, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_call_details"); - g_error_free (error); + org_sflphone_SFLphone_CallManager_get_call_details(callManagerProxy, callID, + &details, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_call_details"); + g_error_free(error); } - return details; + return details; } -gchar** dbus_get_call_list (void) +gchar** +dbus_get_call_list(void) { - GError *error = NULL; - gchar **list = NULL; + GError *error = NULL; + gchar **list = NULL; - org_sflphone_SFLphone_CallManager_get_call_list (callManagerProxy, &list, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_call_list"); - g_error_free (error); + org_sflphone_SFLphone_CallManager_get_call_list(callManagerProxy, &list, + &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_call_list"); + g_error_free(error); } - return list; + return list; } -gchar** dbus_get_conference_list (void) +gchar** +dbus_get_conference_list(void) { - GError *error = NULL; - gchar **list = NULL; + 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); + 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; + return list; } - -gchar** dbus_get_participant_list (const char * confID) +gchar** +dbus_get_participant_list(const char * confID) { - GError *error = NULL; - gchar **list = NULL; + GError *error = NULL; + gchar **list = NULL; - DEBUG("get participant list") + DEBUG("get participant list") - org_sflphone_SFLphone_CallManager_get_participant_list (callManagerProxy, confID, &list, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_participant_list"); - g_error_free (error); + org_sflphone_SFLphone_CallManager_get_participant_list(callManagerProxy, + confID, &list, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_participant_list"); + g_error_free(error); } - return list; + return list; } - -GHashTable* dbus_get_conference_details (const gchar *confID) +GHashTable* +dbus_get_conference_details(const gchar *confID) { - GError *error = NULL; - GHashTable *details = NULL; + GError *error = NULL; + GHashTable *details = NULL; - org_sflphone_SFLphone_CallManager_get_conference_details (callManagerProxy, confID, &details, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_conference_details"); - g_error_free (error); + org_sflphone_SFLphone_CallManager_get_conference_details(callManagerProxy, + confID, &details, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_conference_details"); + g_error_free(error); } - return details; + return details; } -void dbus_set_accounts_order (const gchar* order) { +void +dbus_set_accounts_order(const gchar* order) +{ - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_accounts_order (configurationManagerProxy, order, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_accounts_order"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_set_accounts_order( + configurationManagerProxy, order, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_accounts_order"); + g_error_free(error); } } -GHashTable* dbus_get_history (void) +GHashTable* +dbus_get_history(void) { - GError *error = NULL; - GHashTable *entries = NULL; + GError *error = NULL; + GHashTable *entries = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_history (configurationManagerProxy, &entries, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_history"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_get_history( + configurationManagerProxy, &entries, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_history"); + g_error_free(error); } - return entries; + return entries; } -void dbus_set_history (GHashTable* entries) +void +dbus_set_history(GHashTable* entries) { - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_history (configurationManagerProxy, entries, &error); - if (error){ - ERROR ("Error calling org_sflphone_SFLphone_CallManager_set_history"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_set_history( + configurationManagerProxy, entries, &error); + if (error) + { + ERROR ("Error calling org_sflphone_SFLphone_CallManager_set_history"); + g_error_free(error); } } - void -dbus_confirm_sas (const callable_obj_t * c) +void +dbus_confirm_sas(const callable_obj_t * c) { - GError *error = NULL; - org_sflphone_SFLphone_CallManager_set_sa_sverified ( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_set_sa_sverified(callManagerProxy, + c->_callID, &error); + if (error) { - ERROR ("Failed to call setSASVerified() on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call setSASVerified() on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_reset_sas (const callable_obj_t * c) +void +dbus_reset_sas(const callable_obj_t * c) { - GError *error = NULL; - org_sflphone_SFLphone_CallManager_reset_sa_sverified ( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_reset_sa_sverified(callManagerProxy, + c->_callID, &error); + if (error) { - ERROR ("Failed to call resetSASVerified on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call resetSASVerified on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_set_confirm_go_clear (const callable_obj_t * c) +void +dbus_set_confirm_go_clear(const callable_obj_t * c) { - GError *error = NULL; - org_sflphone_SFLphone_CallManager_set_confirm_go_clear( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_set_confirm_go_clear(callManagerProxy, + c->_callID, &error); + if (error) { - ERROR ("Failed to call set_confirm_go_clear on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call set_confirm_go_clear on CallManager: %s", + error->message); + g_error_free(error); } } - void -dbus_request_go_clear (const callable_obj_t * c) +void +dbus_request_go_clear(const callable_obj_t * c) { - GError *error = NULL; - org_sflphone_SFLphone_CallManager_request_go_clear( callManagerProxy, c->_callID, &error); - if (error) + GError *error = NULL; + org_sflphone_SFLphone_CallManager_request_go_clear(callManagerProxy, + c->_callID, &error); + if (error) { - ERROR ("Failed to call request_go_clear on CallManager: %s", - error->message); - g_error_free (error); + ERROR ("Failed to call request_go_clear on CallManager: %s", + error->message); + g_error_free(error); } } - gchar** +gchar** dbus_get_supported_tls_method() { - GError *error = NULL; - gchar** array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_supported_tls_method (configurationManagerProxy, &array, &error); + GError *error = NULL; + gchar** array = NULL; + org_sflphone_SFLphone_ConfigurationManager_get_supported_tls_method( + configurationManagerProxy, &array, &error); - if (error != NULL) { - ERROR ("Failed to call get_supported_tls_method() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call get_supported_tls_method() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return array; + return array; } -GHashTable* dbus_get_tls_settings_default(void) +GHashTable* +dbus_get_tls_settings_default(void) { - GError *error = NULL; - GHashTable *results = NULL; + GError *error = NULL; + GHashTable *results = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default(configurationManagerProxy, &results, &error); - if (error != NULL){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default( + configurationManagerProxy, &results, &error); + if (error != NULL) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default"); + g_error_free(error); } - return results; + return results; } - -gchar * dbus_get_address_from_interface_name(gchar* interface) +gchar * +dbus_get_address_from_interface_name(gchar* interface) { - GError *error = NULL; - gchar * address; + GError *error = NULL; + gchar * address; - org_sflphone_SFLphone_ConfigurationManager_get_addr_from_interface_name ( configurationManagerProxy, interface, &address, &error); - if (error != NULL){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_addr_from_interface_name\n"); - g_error_free (error); + org_sflphone_SFLphone_ConfigurationManager_get_addr_from_interface_name( + configurationManagerProxy, interface, &address, &error); + if (error != NULL) + { + ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_addr_from_interface_name\n"); + g_error_free(error); } - return address; + return address; } - -gchar ** dbus_get_all_ip_interface(void) +gchar ** +dbus_get_all_ip_interface(void) { - GError *error = NULL; - gchar ** array; + GError *error = NULL; + gchar ** array; - if(!org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface ( configurationManagerProxy, &array, &error)) + if (!org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface( + configurationManagerProxy, &array, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_all_ip_interface) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_all_ip_interface) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR("Error while calling get_all_ip_interface: %s", error->message); + ERROR("Error while calling get_all_ip_interface: %s", error->message); } - g_error_free (error); - return NULL; + g_error_free(error); + return NULL; } - else{ - DEBUG ("DBus called get_all_ip_interface() on ConfigurationManager"); - return array; + else + { + DEBUG ("DBus called get_all_ip_interface() on ConfigurationManager"); + return array; } } -gchar ** dbus_get_all_ip_interface_by_name(void) +gchar ** +dbus_get_all_ip_interface_by_name(void) { - GError *error = NULL; - gchar ** array; + GError *error = NULL; + gchar ** array; - if(!org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface_by_name ( configurationManagerProxy, &array, &error)) + if (!org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface_by_name( + configurationManagerProxy, &array, &error)) { - if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) { - ERROR ("Caught remote method (get_all_ip_interface) exception %s: %s", dbus_g_error_get_name(error), error->message); + ERROR ("Caught remote method (get_all_ip_interface) exception %s: %s", dbus_g_error_get_name(error), error->message); } - else + else { - ERROR("Error while calling get_all_ip_interface: %s", error->message); + ERROR("Error while calling get_all_ip_interface: %s", error->message); } - g_error_free (error); - return NULL; + g_error_free(error); + return NULL; } - else{ - DEBUG ("DBus called get_all_ip_interface() on ConfigurationManager"); - return array; + else + { + DEBUG ("DBus called get_all_ip_interface() on ConfigurationManager"); + return array; } } -guint dbus_get_window_width (void) { +guint +dbus_get_window_width(void) +{ - GError *error = NULL; - guint value; + GError *error = NULL; + guint value; - org_sflphone_SFLphone_ConfigurationManager_get_window_width (configurationManagerProxy, &value, &error); + org_sflphone_SFLphone_ConfigurationManager_get_window_width( + configurationManagerProxy, &value, &error); - if (error != NULL) { - ERROR ("Failed to call get_window_width() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call get_window_width() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return value; + return value; } -guint dbus_get_window_height (void) { +guint +dbus_get_window_height(void) +{ - GError *error = NULL; - guint value; + GError *error = NULL; + guint value; - org_sflphone_SFLphone_ConfigurationManager_get_window_height (configurationManagerProxy, &value, &error); + org_sflphone_SFLphone_ConfigurationManager_get_window_height( + configurationManagerProxy, &value, &error); - if (error != NULL) { - ERROR ("Failed to call get_window_height() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call get_window_height() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return value; + return value; } -void dbus_set_window_width (const guint width) { +void +dbus_set_window_width(const guint width) +{ - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_window_width (configurationManagerProxy, width, &error); + org_sflphone_SFLphone_ConfigurationManager_set_window_width( + configurationManagerProxy, width, &error); - if (error != NULL) { - ERROR ("Failed to call set_window_width() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call set_window_width() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } +void +dbus_set_window_height(const guint height) +{ -void dbus_set_window_height (const guint height) { - - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_window_height (configurationManagerProxy, height, &error); + org_sflphone_SFLphone_ConfigurationManager_set_window_height( + configurationManagerProxy, height, &error); - if (error != NULL) { - ERROR ("Failed to call set_window_height() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call set_window_height() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } -guint dbus_get_window_position_x (void) { +guint +dbus_get_window_position_x(void) +{ - GError *error = NULL; - guint value; + GError *error = NULL; + guint value; - org_sflphone_SFLphone_ConfigurationManager_get_window_position_x (configurationManagerProxy, &value, &error); + org_sflphone_SFLphone_ConfigurationManager_get_window_position_x( + configurationManagerProxy, &value, &error); - if (error != NULL) { - ERROR ("Failed to call get_window_position_x() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call get_window_position_x() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return value; + return value; } -guint dbus_get_window_position_y (void) { +guint +dbus_get_window_position_y(void) +{ - GError *error = NULL; - guint value; + GError *error = NULL; + guint value; - org_sflphone_SFLphone_ConfigurationManager_get_window_position_y (configurationManagerProxy, &value, &error); + org_sflphone_SFLphone_ConfigurationManager_get_window_position_y( + configurationManagerProxy, &value, &error); - if (error != NULL) { - ERROR ("Failed to call get_window_position_y() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call get_window_position_y() on ConfigurationManager: %s", + error->message); + g_error_free(error); } - return value; + return value; } -void dbus_set_window_position_x (const guint posx) { +void +dbus_set_window_position_x(const guint posx) +{ - GError *error = NULL; + GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_window_position_x (configurationManagerProxy, posx, &error); + org_sflphone_SFLphone_ConfigurationManager_set_window_position_x( + configurationManagerProxy, posx, &error); - if (error != NULL) { - ERROR ("Failed to call set_window_position_x() on ConfigurationManager: %s", - error->message); - g_error_free (error); + if (error != NULL) + { + ERROR ("Failed to call set_window_position_x() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } -void dbus_set_window_position_y (const guint posy) { +void +dbus_set_window_position_y(const guint posy) +{ + + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_set_window_position_y( + configurationManagerProxy, posy, &error); - GError *error = NULL; + if (error != NULL) + { + ERROR ("Failed to call set_window_position_y() on ConfigurationManager: %s", + error->message); + g_error_free(error); + } +} - org_sflphone_SFLphone_ConfigurationManager_set_window_position_y (configurationManagerProxy, posy, &error); +GHashTable* +dbus_get_shortcuts(void) +{ + GError *error = NULL; + GHashTable * shortcuts; + if (!org_sflphone_SFLphone_ConfigurationManager_get_shortcuts( + configurationManagerProxy, &shortcuts, &error)) + { + if (error->domain == DBUS_GERROR && error->code + == DBUS_GERROR_REMOTE_EXCEPTION) + { + ERROR ("Caught remote method (get_shortcuts) exception %s: %s", dbus_g_error_get_name(error), error->message); + } + else + { + ERROR("Error while calling get_shortcuts: %s", error->message); + } + g_error_free(error); + return NULL; + } + else + { + return shortcuts; + } +} - if (error != NULL) { - ERROR ("Failed to call set_window_position_y() on ConfigurationManager: %s", - error->message); - g_error_free (error); +void +dbus_set_shortcuts(GHashTable * shortcuts) +{ + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_shortcuts( + configurationManagerProxy, shortcuts, &error); + if (error) + { + ERROR ("Failed to call set_shortcuts() on ConfigurationManager: %s", + error->message); + g_error_free(error); } } diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index acc961fba4..b30126ea28 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -606,5 +606,7 @@ guint dbus_get_window_position_y (void); void dbus_set_window_position_x (const guint posx); void dbus_set_window_position_y (const guint posy); +GHashTable* dbus_get_shortcuts(void); +void dbus_set_shortcuts(GHashTable * shortcuts); #endif diff --git a/sflphone-client-gnome/src/main.c b/sflphone-client-gnome/src/main.c index fffd9a831b..0d7fb98e60 100644 --- a/sflphone-client-gnome/src/main.c +++ b/sflphone-client-gnome/src/main.c @@ -29,6 +29,8 @@ #include <gtk/gtk.h> #include <stdlib.h> +#include "shortcuts.h" + /** * Stop logging engine */ @@ -120,6 +122,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\n"); // Update the GUI update_actions (); + shortcuts_initialize_bindings(); + /* start the main loop */ gtk_main(); } @@ -127,6 +131,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\n"); // Cleanly stop logging shutdown_logging(); + shortcuts_destroy_bindings(); + return 0; } diff --git a/sflphone-common/.cproject b/sflphone-common/.cproject index 0a0ee533da..2f2b2a83bb 100644 --- a/sflphone-common/.cproject +++ b/sflphone-common/.cproject @@ -43,6 +43,9 @@ </tool> </toolChain> </folderInfo> +<sourceEntries> +<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/> +</sourceEntries> </configuration> </storageModule> <storageModule moduleId="scannerConfiguration"> diff --git a/sflphone-common/src/dbus/configurationmanager-introspec.xml b/sflphone-common/src/dbus/configurationmanager-introspec.xml index 33f0192c2c..f7a2b79ead 100644 --- a/sflphone-common/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-common/src/dbus/configurationmanager-introspec.xml @@ -548,5 +548,12 @@ <arg type="as" name="list" direction="out"/> </method> + <method name="getShortcuts"> + <arg type="a{si}" name="shortcutsMap" direction="out"/> + </method> + + <method name="setShortcuts"> + <arg type="a{si}" name="shortcutsMap" direction="in"/> + </method> </interface> </node> diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index 275800cb54..0e5f759227 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -25,455 +25,480 @@ #include "../manager.h" #include "sip/sipvoiplink.h" -const char* ConfigurationManager::SERVER_PATH = "/org/sflphone/SFLphone/ConfigurationManager"; - - - -ConfigurationManager::ConfigurationManager (DBus::Connection& connection) - : DBus::ObjectAdaptor (connection, SERVER_PATH) -{ -} - - -std::map< std::string, std::string > -ConfigurationManager::getAccountDetails (const std::string& accountID) -{ - return Manager::instance().getAccountDetails (accountID); -} - -std::map< std::string, std::string > -ConfigurationManager::getTlsSettingsDefault (void) -{ - - std::map<std::string, std::string> tlsSettingsDefault; - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_LISTENER_PORT, DEFAULT_SIP_TLS_PORT)); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_CA_LIST_FILE, "")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_CERTIFICATE_FILE, "")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_PRIVATE_KEY_FILE, "")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_PASSWORD, "")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_METHOD, "TLSv1")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_CIPHERS, "")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_SERVER_NAME, "")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_VERIFY_SERVER, "true")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_VERIFY_CLIENT, "true")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_REQUIRE_CLIENT_CERTIFICATE, "true")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_SEC, "2")); - tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_MSEC, "0")); - - return tlsSettingsDefault; -} - -std::map< std::string, std::string > -ConfigurationManager::getIp2IpDetails (void) -{ - - std::map<std::string, std::string> ip2ipAccountDetails; - - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ACCOUNT_ID, IP2IP_PROFILE)); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, Manager::instance().getConfigString (IP2IP_PROFILE, SRTP_KEY_EXCHANGE))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (SRTP_ENABLE, Manager::instance().getConfigString (IP2IP_PROFILE, SRTP_ENABLE))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, Manager::instance().getConfigString (IP2IP_PROFILE, SRTP_RTP_FALLBACK))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_DISPLAY_SAS))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_HELLO_HASH))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE))); - - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, Manager::instance().getConfigString(IP2IP_PROFILE, LOCAL_INTERFACE))); - ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_PORT, Manager::instance().getConfigString (IP2IP_PROFILE, LOCAL_PORT))); - - std::map<std::string, std::string> tlsSettings; - tlsSettings = getTlsSettings (IP2IP_PROFILE); - std::copy (tlsSettings.begin(), tlsSettings.end(), std::inserter (ip2ipAccountDetails, ip2ipAccountDetails.end())); - - return ip2ipAccountDetails; - -} - -void -ConfigurationManager::setIp2IpDetails (const std::map< std::string, std::string >& details) -{ - std::map<std::string, std::string> map_cpy = details; - std::map<std::string, std::string>::iterator it; - - it = map_cpy.find (LOCAL_INTERFACE); - - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_INTERFACE, it->second); - } - - it = map_cpy.find (LOCAL_PORT); - - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_PORT, it->second); - } - - it = map_cpy.find (SRTP_ENABLE); - - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, SRTP_ENABLE, it->second); - } - - it = map_cpy.find (SRTP_RTP_FALLBACK); - - if (it != details.end()) { - Manager::instance().setConfig(IP2IP_PROFILE, SRTP_RTP_FALLBACK, it->second); - } - - it = map_cpy.find (SRTP_KEY_EXCHANGE); - - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, SRTP_KEY_EXCHANGE, it->second); - } +const char* ConfigurationManager::SERVER_PATH = + "/org/sflphone/SFLphone/ConfigurationManager"; + +ConfigurationManager::ConfigurationManager(DBus::Connection& connection) : + DBus::ObjectAdaptor(connection, SERVER_PATH) { + shortcutsKeys.push_back("pick_up"); + shortcutsKeys.push_back("hang_up"); + shortcutsKeys.push_back("popup_window"); +} + +std::map<std::string, std::string> ConfigurationManager::getAccountDetails( + const std::string& accountID) { + return Manager::instance().getAccountDetails(accountID); +} + +std::map<std::string, std::string> ConfigurationManager::getTlsSettingsDefault( + void) { + + std::map<std::string, std::string> tlsSettingsDefault; + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_LISTENER_PORT, DEFAULT_SIP_TLS_PORT)); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_CA_LIST_FILE, "")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_CERTIFICATE_FILE, "")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_PRIVATE_KEY_FILE, "")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>(TLS_PASSWORD, + "")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>(TLS_METHOD, + "TLSv1")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>(TLS_CIPHERS, + "")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_SERVER_NAME, "")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_VERIFY_SERVER, "true")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_VERIFY_CLIENT, "true")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_REQUIRE_CLIENT_CERTIFICATE, "true")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_NEGOTIATION_TIMEOUT_SEC, "2")); + tlsSettingsDefault.insert(std::pair<std::string, std::string>( + TLS_NEGOTIATION_TIMEOUT_MSEC, "0")); + + return tlsSettingsDefault; +} + +std::map<std::string, std::string> ConfigurationManager::getIp2IpDetails(void) { + + std::map<std::string, std::string> ip2ipAccountDetails; + + ip2ipAccountDetails.insert(std::pair<std::string, std::string>(ACCOUNT_ID, + IP2IP_PROFILE)); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>( + SRTP_KEY_EXCHANGE, Manager::instance().getConfigString( + IP2IP_PROFILE, SRTP_KEY_EXCHANGE))); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>(SRTP_ENABLE, + Manager::instance().getConfigString(IP2IP_PROFILE, SRTP_ENABLE))); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>( + SRTP_RTP_FALLBACK, Manager::instance().getConfigString( + IP2IP_PROFILE, SRTP_RTP_FALLBACK))); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>( + ZRTP_DISPLAY_SAS, Manager::instance().getConfigString( + IP2IP_PROFILE, ZRTP_DISPLAY_SAS))); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>( + ZRTP_HELLO_HASH, Manager::instance().getConfigString(IP2IP_PROFILE, + ZRTP_HELLO_HASH))); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>( + ZRTP_NOT_SUPP_WARNING, Manager::instance().getConfigString( + IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING))); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>( + ZRTP_DISPLAY_SAS_ONCE, Manager::instance().getConfigString( + IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE))); + + ip2ipAccountDetails.insert(std::pair<std::string, std::string>( + LOCAL_INTERFACE, Manager::instance().getConfigString(IP2IP_PROFILE, + LOCAL_INTERFACE))); + ip2ipAccountDetails.insert(std::pair<std::string, std::string>(LOCAL_PORT, + Manager::instance().getConfigString(IP2IP_PROFILE, LOCAL_PORT))); + + std::map<std::string, std::string> tlsSettings; + tlsSettings = getTlsSettings(IP2IP_PROFILE); + std::copy(tlsSettings.begin(), tlsSettings.end(), std::inserter( + ip2ipAccountDetails, ip2ipAccountDetails.end())); + + return ip2ipAccountDetails; + +} + +void ConfigurationManager::setIp2IpDetails(const std::map<std::string, + std::string>& details) { + std::map<std::string, std::string> map_cpy = details; + std::map<std::string, std::string>::iterator it; + + it = map_cpy.find(LOCAL_INTERFACE); + + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, LOCAL_INTERFACE, + it->second); + } - it = map_cpy.find (ZRTP_DISPLAY_SAS); + it = map_cpy.find(LOCAL_PORT); - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, ZRTP_DISPLAY_SAS, it->second); - } + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, LOCAL_PORT, it->second); + } - it = map_cpy.find (ZRTP_NOT_SUPP_WARNING); + it = map_cpy.find(SRTP_ENABLE); - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING, it->second); - } + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, SRTP_ENABLE, it->second); + } - it = map_cpy.find (ZRTP_HELLO_HASH); + it = map_cpy.find(SRTP_RTP_FALLBACK); - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, ZRTP_HELLO_HASH, it->second); - } + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, SRTP_RTP_FALLBACK, + it->second); + } - it = map_cpy.find (ZRTP_DISPLAY_SAS_ONCE); + it = map_cpy.find(SRTP_KEY_EXCHANGE); - if (it != details.end()) { - Manager::instance().setConfig (IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE, it->second); - } + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, SRTP_KEY_EXCHANGE, + it->second); + } - setTlsSettings (IP2IP_PROFILE, details); + it = map_cpy.find(ZRTP_DISPLAY_SAS); - Manager::instance().saveConfig(); + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, ZRTP_DISPLAY_SAS, + it->second); + } - // Update account details to the client side - accountsChanged(); + it = map_cpy.find(ZRTP_NOT_SUPP_WARNING); - // Reload account settings from config - Manager::instance().getAccount(IP2IP_PROFILE)->loadConfig(); + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING, + it->second); + } -} + it = map_cpy.find(ZRTP_HELLO_HASH); -std::map< std::string, std::string > -ConfigurationManager::getTlsSettings (const std::string& section) -{ - std::map<std::string, std::string> tlsSettings; + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, ZRTP_HELLO_HASH, + it->second); + } - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_LISTENER_PORT, Manager::instance().getConfigString(section, TLS_LISTENER_PORT))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_ENABLE, Manager::instance().getConfigString (section, TLS_ENABLE))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_CA_LIST_FILE, Manager::instance().getConfigString (section, TLS_CA_LIST_FILE))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_CERTIFICATE_FILE, Manager::instance().getConfigString (section, TLS_CERTIFICATE_FILE))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_PRIVATE_KEY_FILE, Manager::instance().getConfigString (section, TLS_PRIVATE_KEY_FILE))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_PASSWORD, Manager::instance().getConfigString (section, TLS_PASSWORD))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_METHOD, Manager::instance().getConfigString (section, TLS_METHOD))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_CIPHERS, Manager::instance().getConfigString (section, TLS_CIPHERS))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_SERVER_NAME, Manager::instance().getConfigString (section, TLS_SERVER_NAME))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_VERIFY_SERVER, Manager::instance().getConfigString (section, TLS_VERIFY_SERVER))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_VERIFY_CLIENT, Manager::instance().getConfigString (section, TLS_VERIFY_CLIENT))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_REQUIRE_CLIENT_CERTIFICATE, Manager::instance().getConfigString (section, TLS_REQUIRE_CLIENT_CERTIFICATE))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_NEGOTIATION_TIMEOUT_SEC, Manager::instance().getConfigString (section, TLS_NEGOTIATION_TIMEOUT_SEC))); - tlsSettings.insert (std::pair<std::string, std::string> - (TLS_NEGOTIATION_TIMEOUT_MSEC, Manager::instance().getConfigString (section, TLS_NEGOTIATION_TIMEOUT_MSEC))); - return tlsSettings; -} + it = map_cpy.find(ZRTP_DISPLAY_SAS_ONCE); -void -ConfigurationManager::setTlsSettings (const std::string& section, const std::map< std::string, std::string >& details) -{ - std::map<std::string, std::string> map_cpy = details; - std::map<std::string, std::string>::iterator it; + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE, + it->second); + } - it = map_cpy.find(TLS_LISTENER_PORT); - if(it != details.end()) { - Manager::instance().setConfig(section, TLS_LISTENER_PORT, it->second); - } + setTlsSettings(IP2IP_PROFILE, details); + + Manager::instance().saveConfig(); + + // Update account details to the client side + accountsChanged(); + + // Reload account settings from config + Manager::instance().getAccount(IP2IP_PROFILE)->loadConfig(); + +} + +std::map<std::string, std::string> ConfigurationManager::getTlsSettings( + const std::string& section) { + std::map<std::string, std::string> tlsSettings; + + tlsSettings.insert(std::pair<std::string, std::string>(TLS_LISTENER_PORT, + Manager::instance().getConfigString(section, TLS_LISTENER_PORT))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_ENABLE, + Manager::instance().getConfigString(section, TLS_ENABLE))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_CA_LIST_FILE, + Manager::instance().getConfigString(section, TLS_CA_LIST_FILE))); + tlsSettings.insert(std::pair<std::string, std::string>( + TLS_CERTIFICATE_FILE, Manager::instance().getConfigString(section, + TLS_CERTIFICATE_FILE))); + tlsSettings.insert(std::pair<std::string, std::string>( + TLS_PRIVATE_KEY_FILE, Manager::instance().getConfigString(section, + TLS_PRIVATE_KEY_FILE))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_PASSWORD, + Manager::instance().getConfigString(section, TLS_PASSWORD))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_METHOD, + Manager::instance().getConfigString(section, TLS_METHOD))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_CIPHERS, + Manager::instance().getConfigString(section, TLS_CIPHERS))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_SERVER_NAME, + Manager::instance().getConfigString(section, TLS_SERVER_NAME))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_VERIFY_SERVER, + Manager::instance().getConfigString(section, TLS_VERIFY_SERVER))); + tlsSettings.insert(std::pair<std::string, std::string>(TLS_VERIFY_CLIENT, + Manager::instance().getConfigString(section, TLS_VERIFY_CLIENT))); + tlsSettings.insert(std::pair<std::string, std::string>( + TLS_REQUIRE_CLIENT_CERTIFICATE, + Manager::instance().getConfigString(section, + TLS_REQUIRE_CLIENT_CERTIFICATE))); + tlsSettings.insert(std::pair<std::string, std::string>( + TLS_NEGOTIATION_TIMEOUT_SEC, Manager::instance().getConfigString( + section, TLS_NEGOTIATION_TIMEOUT_SEC))); + tlsSettings.insert(std::pair<std::string, std::string>( + TLS_NEGOTIATION_TIMEOUT_MSEC, Manager::instance().getConfigString( + section, TLS_NEGOTIATION_TIMEOUT_MSEC))); + return tlsSettings; +} + +void ConfigurationManager::setTlsSettings(const std::string& section, + const std::map<std::string, std::string>& details) { + std::map<std::string, std::string> map_cpy = details; + std::map<std::string, std::string>::iterator it; + + it = map_cpy.find(TLS_LISTENER_PORT); + if (it != details.end()) { + Manager::instance().setConfig(section, TLS_LISTENER_PORT, it->second); + } - it = map_cpy.find (TLS_ENABLE); + it = map_cpy.find(TLS_ENABLE); - if (it != details.end()) { - Manager::instance().setConfig (section, TLS_ENABLE, it->second); - } + if (it != details.end()) { + Manager::instance().setConfig(section, TLS_ENABLE, it->second); + } - it = map_cpy.find (TLS_CA_LIST_FILE); + it = map_cpy.find(TLS_CA_LIST_FILE); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_CA_LIST_FILE, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_CA_LIST_FILE, it->second); + } - it = map_cpy.find (TLS_CERTIFICATE_FILE); + it = map_cpy.find(TLS_CERTIFICATE_FILE); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_CERTIFICATE_FILE, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_CERTIFICATE_FILE, it->second); + } - it = map_cpy.find (TLS_PRIVATE_KEY_FILE); + it = map_cpy.find(TLS_PRIVATE_KEY_FILE); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_PRIVATE_KEY_FILE, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_PRIVATE_KEY_FILE, it->second); + } - it = map_cpy.find (TLS_PASSWORD); + it = map_cpy.find(TLS_PASSWORD); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_PASSWORD, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_PASSWORD, it->second); + } - it = map_cpy.find (TLS_METHOD); + it = map_cpy.find(TLS_METHOD); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_METHOD, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_METHOD, it->second); + } - it = map_cpy.find (TLS_CIPHERS); + it = map_cpy.find(TLS_CIPHERS); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_CIPHERS, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_CIPHERS, it->second); + } - it = map_cpy.find (TLS_SERVER_NAME); + it = map_cpy.find(TLS_SERVER_NAME); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_SERVER_NAME, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_SERVER_NAME, it->second); + } - it = map_cpy.find (TLS_VERIFY_CLIENT); + it = map_cpy.find(TLS_VERIFY_CLIENT); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_VERIFY_CLIENT, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_VERIFY_CLIENT, it->second); + } - it = map_cpy.find (TLS_REQUIRE_CLIENT_CERTIFICATE); + it = map_cpy.find(TLS_REQUIRE_CLIENT_CERTIFICATE); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_REQUIRE_CLIENT_CERTIFICATE, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_REQUIRE_CLIENT_CERTIFICATE, + it->second); + } - it = map_cpy.find (TLS_NEGOTIATION_TIMEOUT_SEC); + it = map_cpy.find(TLS_NEGOTIATION_TIMEOUT_SEC); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_NEGOTIATION_TIMEOUT_SEC, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_NEGOTIATION_TIMEOUT_SEC, + it->second); + } - it = map_cpy.find (TLS_NEGOTIATION_TIMEOUT_MSEC); + it = map_cpy.find(TLS_NEGOTIATION_TIMEOUT_MSEC); - if (it != map_cpy.end()) { - Manager::instance().setConfig (section, TLS_NEGOTIATION_TIMEOUT_MSEC, it->second); - } + if (it != map_cpy.end()) { + Manager::instance().setConfig(section, TLS_NEGOTIATION_TIMEOUT_MSEC, + it->second); + } - Manager::instance().saveConfig(); + Manager::instance().saveConfig(); - // Update account details to the client side - accountsChanged(); + // Update account details to the client side + accountsChanged(); } -std::map< std::string, std::string > -ConfigurationManager::getCredential (const std::string& accountID, const int32_t& index) -{ +std::map<std::string, std::string> ConfigurationManager::getCredential( + const std::string& accountID, const int32_t& index) { - std::string credentialIndex; - std::stringstream streamOut; - streamOut << index; - credentialIndex = streamOut.str(); + std::string credentialIndex; + std::stringstream streamOut; + streamOut << index; + credentialIndex = streamOut.str(); - std::string section = std::string ("Credential") + std::string (":") + accountID + std::string (":") + credentialIndex; + std::string section = std::string("Credential") + std::string(":") + + accountID + std::string(":") + credentialIndex; - std::map<std::string, std::string> credentialInformation; - std::string username = Manager::instance().getConfigString (section, USERNAME); - std::string password = Manager::instance().getConfigString (section, PASSWORD); - std::string realm = Manager::instance().getConfigString (section, REALM); + std::map<std::string, std::string> credentialInformation; + std::string username = Manager::instance().getConfigString(section, + USERNAME); + std::string password = Manager::instance().getConfigString(section, + PASSWORD); + std::string realm = Manager::instance().getConfigString(section, REALM); - credentialInformation.insert (std::pair<std::string, std::string> (USERNAME, username)); - credentialInformation.insert (std::pair<std::string, std::string> (PASSWORD, password)); - credentialInformation.insert (std::pair<std::string, std::string> (REALM, realm)); + credentialInformation.insert(std::pair<std::string, std::string>(USERNAME, + username)); + credentialInformation.insert(std::pair<std::string, std::string>(PASSWORD, + password)); + credentialInformation.insert(std::pair<std::string, std::string>(REALM, + realm)); - return credentialInformation; + return credentialInformation; } -int32_t -ConfigurationManager::getNumberOfCredential (const std::string& accountID) -{ - return Manager::instance().getConfigInt (accountID, CONFIG_CREDENTIAL_NUMBER); +int32_t ConfigurationManager::getNumberOfCredential( + const std::string& accountID) { + return Manager::instance().getConfigInt(accountID, CONFIG_CREDENTIAL_NUMBER); } -void -ConfigurationManager::setNumberOfCredential (const std::string& accountID, const int32_t& number) -{ - if (accountID != AccountNULL || !accountID.empty()) { - Manager::instance().setConfig (accountID, CONFIG_CREDENTIAL_NUMBER, number); - } +void ConfigurationManager::setNumberOfCredential(const std::string& accountID, + const int32_t& number) { + if (accountID != AccountNULL || !accountID.empty()) { + Manager::instance().setConfig(accountID, CONFIG_CREDENTIAL_NUMBER, + number); + } } -void -ConfigurationManager::setCredential (const std::string& accountID, const int32_t& index, - const std::map< std::string, std::string >& details) -{ - Manager::instance().setCredential (accountID, index, details); +void ConfigurationManager::setCredential(const std::string& accountID, + const int32_t& index, const std::map<std::string, std::string>& details) { + Manager::instance().setCredential(accountID, index, details); } -void -ConfigurationManager::deleteAllCredential (const std::string& accountID) -{ - Manager::instance().deleteAllCredential (accountID); +void ConfigurationManager::deleteAllCredential(const std::string& accountID) { + Manager::instance().deleteAllCredential(accountID); } -void -ConfigurationManager::setAccountDetails (const std::string& accountID, - const std::map< std::string, std::string >& details) -{ - Manager::instance().setAccountDetails (accountID, details); +void ConfigurationManager::setAccountDetails(const std::string& accountID, + const std::map<std::string, std::string>& details) { + Manager::instance().setAccountDetails(accountID, details); } -void -ConfigurationManager::sendRegister (const std::string& accountID, const int32_t& expire) -{ - Manager::instance().sendRegister (accountID, expire); +void ConfigurationManager::sendRegister(const std::string& accountID, + const int32_t& expire) { + Manager::instance().sendRegister(accountID, expire); } -std::string -ConfigurationManager::addAccount (const std::map< std::string, std::string >& details) -{ - return Manager::instance().addAccount (details); +std::string ConfigurationManager::addAccount(const std::map<std::string, + std::string>& details) { + return Manager::instance().addAccount(details); } - -void -ConfigurationManager::removeAccount (const std::string& accoundID) -{ - return Manager::instance().removeAccount (accoundID); +void ConfigurationManager::removeAccount(const std::string& accoundID) { + return Manager::instance().removeAccount(accoundID); } -std::vector< std::string > -ConfigurationManager::getAccountList() -{ - return Manager::instance().getAccountList(); +std::vector<std::string> ConfigurationManager::getAccountList() { + return Manager::instance().getAccountList(); } //TODO -std::vector< std::string > -ConfigurationManager::getToneLocaleList() -{ - std::vector< std::string > ret; - return ret; +std::vector<std::string> ConfigurationManager::getToneLocaleList() { + std::vector<std::string> ret; + return ret; } //TODO -std::string -ConfigurationManager::getVersion() -{ - std::string ret (""); - return ret; +std::string ConfigurationManager::getVersion() { + std::string ret(""); + return ret; } //TODO -std::vector< std::string > -ConfigurationManager::getRingtoneList() -{ - std::vector< std::string > ret; - return ret; +std::vector<std::string> ConfigurationManager::getRingtoneList() { + std::vector<std::string> ret; + return ret; } - /** * Send the list of all codecs loaded to the client through DBus. * Can stay global, as only the active codecs will be set per accounts */ -std::vector<std::string> ConfigurationManager::getCodecList (void) { +std::vector<std::string> ConfigurationManager::getCodecList(void) { - std::vector<std::string> list; + std::vector<std::string> list; - CodecsMap codecs = Manager::instance ().getCodecDescriptorMap ().getCodecsMap(); - CodecsMap::iterator iter = codecs.begin(); + CodecsMap codecs = + Manager::instance().getCodecDescriptorMap().getCodecsMap(); + CodecsMap::iterator iter = codecs.begin(); - while (iter!=codecs.end()) { - std::stringstream ss; + while (iter != codecs.end()) { + std::stringstream ss; - if (iter->second != NULL) { - ss << iter->first; - list.push_back ( (ss.str()).data()); - } + if (iter->second != NULL) { + ss << iter->first; + list.push_back((ss.str()).data()); + } - iter++; - } + iter++; + } - return list; + return list; } -std::vector<std::string> -ConfigurationManager::getSupportedTlsMethod (void) -{ - std::vector<std::string> method; - method.push_back ("Default"); - method.push_back ("TLSv1"); - method.push_back ("SSLv2"); - method.push_back ("SSLv3"); - method.push_back ("SSLv23"); - return method; +std::vector<std::string> ConfigurationManager::getSupportedTlsMethod(void) { + std::vector<std::string> method; + method.push_back("Default"); + method.push_back("TLSv1"); + method.push_back("SSLv2"); + method.push_back("SSLv3"); + method.push_back("SSLv23"); + return method; } +std::vector<std::string> ConfigurationManager::getCodecDetails( + const int32_t& payload) { -std::vector<std::string> ConfigurationManager::getCodecDetails (const int32_t& payload) { - - return Manager::instance().getCodecDescriptorMap().getCodecSpecifications (payload); + return Manager::instance().getCodecDescriptorMap().getCodecSpecifications( + payload); } -std::vector<std::string> ConfigurationManager::getActiveCodecList (const std::string& accountID) { +std::vector<std::string> ConfigurationManager::getActiveCodecList( + const std::string& accountID) { - _debug("Send active codec list for account %s", accountID.c_str ()); + _debug("Send active codec list for account %s", accountID.c_str ()); - std::vector< std::string > v; + std::vector<std::string> v; Account *acc; CodecOrder active; - unsigned int i=0; + unsigned int i = 0; size_t size; - acc = Manager::instance ().getAccount (accountID); + acc = Manager::instance().getAccount(accountID); if (acc != NULL) { - active = acc->getActiveCodecs (); + active = acc->getActiveCodecs(); size = active.size(); - while (i<size) { + while (i < size) { std::stringstream ss; ss << active[i]; - v.push_back ( (ss.str()).data()); + v.push_back((ss.str()).data()); i++; } } - return v; + return v; } -void ConfigurationManager::setActiveCodecList (const std::vector< std::string >& list, const std::string& accountID) -{ +void ConfigurationManager::setActiveCodecList( + const std::vector<std::string>& list, const std::string& accountID) { - _debug ("ConfigurationManager::setActiveCodecList received"); + _debug ("ConfigurationManager::setActiveCodecList received"); Account *acc; // Save the codecs list per account - acc = Manager::instance ().getAccount (accountID); + acc = Manager::instance().getAccount(accountID); if (acc != NULL) { - acc->setActiveCodecs (list); + acc->setActiveCodecs(list); } } @@ -482,391 +507,334 @@ std::vector<std::string> ConfigurationManager::getInputAudioPluginList() { std::vector<std::string> v; - v.push_back ("default"); - v.push_back ("surround40"); - v.push_back ("plug:hw"); + v.push_back("default"); + v.push_back("surround40"); + v.push_back("plug:hw"); - return v; + return v; } std::vector<std::string> ConfigurationManager::getOutputAudioPluginList() { - std::vector<std::string> v; + std::vector<std::string> v; - v.push_back (PCM_DEFAULT); - v.push_back (PCM_DMIX); + v.push_back(PCM_DEFAULT); + v.push_back(PCM_DMIX); - return v; + return v; } -void -ConfigurationManager::setInputAudioPlugin (const std::string& audioPlugin) -{ - return Manager::instance().setInputAudioPlugin (audioPlugin); +void ConfigurationManager::setInputAudioPlugin(const std::string& audioPlugin) { + return Manager::instance().setInputAudioPlugin(audioPlugin); } -void -ConfigurationManager::setOutputAudioPlugin (const std::string& audioPlugin) -{ - return Manager::instance().setOutputAudioPlugin (audioPlugin); +void ConfigurationManager::setOutputAudioPlugin(const std::string& audioPlugin) { + return Manager::instance().setOutputAudioPlugin(audioPlugin); } -std::vector< std::string > -ConfigurationManager::getAudioOutputDeviceList() -{ - return Manager::instance().getAudioOutputDeviceList(); +std::vector<std::string> ConfigurationManager::getAudioOutputDeviceList() { + return Manager::instance().getAudioOutputDeviceList(); } -void -ConfigurationManager::setAudioOutputDevice (const int32_t& index) -{ - return Manager::instance().setAudioOutputDevice (index); +void ConfigurationManager::setAudioOutputDevice(const int32_t& index) { + return Manager::instance().setAudioOutputDevice(index); } -std::vector< std::string > -ConfigurationManager::getAudioInputDeviceList() -{ - return Manager::instance().getAudioInputDeviceList(); +std::vector<std::string> ConfigurationManager::getAudioInputDeviceList() { + return Manager::instance().getAudioInputDeviceList(); } -void -ConfigurationManager::setAudioInputDevice (const int32_t& index) -{ - return Manager::instance().setAudioInputDevice (index); +void ConfigurationManager::setAudioInputDevice(const int32_t& index) { + return Manager::instance().setAudioInputDevice(index); } -std::vector< std::string > -ConfigurationManager::getCurrentAudioDevicesIndex() -{ - return Manager::instance().getCurrentAudioDevicesIndex(); +std::vector<std::string> ConfigurationManager::getCurrentAudioDevicesIndex() { + return Manager::instance().getCurrentAudioDevicesIndex(); } -int32_t -ConfigurationManager::getAudioDeviceIndex (const std::string& name) -{ - return Manager::instance().getAudioDeviceIndex (name); +int32_t ConfigurationManager::getAudioDeviceIndex(const std::string& name) { + return Manager::instance().getAudioDeviceIndex(name); } -std::string -ConfigurationManager::getCurrentAudioOutputPlugin (void) -{ - return Manager::instance().getCurrentAudioOutputPlugin(); +std::string ConfigurationManager::getCurrentAudioOutputPlugin(void) { + return Manager::instance().getCurrentAudioOutputPlugin(); } - -std::vector< std::string > -ConfigurationManager::getPlaybackDeviceList() -{ - std::vector< std::string > ret; - return ret; +std::vector<std::string> ConfigurationManager::getPlaybackDeviceList() { + std::vector<std::string> ret; + return ret; } -std::vector< std::string > -ConfigurationManager::getRecordDeviceList() -{ - std::vector< std::string > ret; - return ret; +std::vector<std::string> ConfigurationManager::getRecordDeviceList() { + std::vector<std::string> ret; + return ret; } -bool -ConfigurationManager::isMd5CredentialHashing (void) -{ - bool isEnabled = Manager::instance().getConfigBool (PREFERENCES, CONFIG_MD5HASH); - return isEnabled; +bool ConfigurationManager::isMd5CredentialHashing(void) { + bool isEnabled = Manager::instance().getConfigBool(PREFERENCES, + CONFIG_MD5HASH); + return isEnabled; } -void -ConfigurationManager::setMd5CredentialHashing (const bool& enabled) -{ - if (enabled) { - Manager::instance().setConfig (PREFERENCES, CONFIG_MD5HASH, TRUE_STR); - } else { - Manager::instance().setConfig (PREFERENCES, CONFIG_MD5HASH, FALSE_STR); - } +void ConfigurationManager::setMd5CredentialHashing(const bool& enabled) { + if (enabled) { + Manager::instance().setConfig(PREFERENCES, CONFIG_MD5HASH, TRUE_STR); + } else { + Manager::instance().setConfig(PREFERENCES, CONFIG_MD5HASH, FALSE_STR); + } } -int32_t -ConfigurationManager::isIax2Enabled (void) -{ - return Manager::instance().isIax2Enabled(); +int32_t ConfigurationManager::isIax2Enabled(void) { + return Manager::instance().isIax2Enabled(); } -void -ConfigurationManager::ringtoneEnabled (void) -{ - Manager::instance().ringtoneEnabled(); +void ConfigurationManager::ringtoneEnabled(void) { + Manager::instance().ringtoneEnabled(); } -int32_t -ConfigurationManager::isRingtoneEnabled (void) -{ - return Manager::instance().isRingtoneEnabled(); +int32_t ConfigurationManager::isRingtoneEnabled(void) { + return Manager::instance().isRingtoneEnabled(); } -std::string -ConfigurationManager::getRingtoneChoice (void) -{ - return Manager::instance().getRingtoneChoice(); +std::string ConfigurationManager::getRingtoneChoice(void) { + return Manager::instance().getRingtoneChoice(); } -void -ConfigurationManager::setRingtoneChoice (const std::string& tone) -{ - Manager::instance().setRingtoneChoice (tone); +void ConfigurationManager::setRingtoneChoice(const std::string& tone) { + Manager::instance().setRingtoneChoice(tone); } -std::string -ConfigurationManager::getRecordPath (void) -{ - return Manager::instance().getRecordPath(); +std::string ConfigurationManager::getRecordPath(void) { + return Manager::instance().getRecordPath(); } -void -ConfigurationManager::setRecordPath (const std::string& recPath) -{ - Manager::instance().setRecordPath (recPath); +void ConfigurationManager::setRecordPath(const std::string& recPath) { + Manager::instance().setRecordPath(recPath); } -int32_t -ConfigurationManager::getDialpad (void) -{ - return Manager::instance().getDialpad(); +int32_t ConfigurationManager::getDialpad(void) { + return Manager::instance().getDialpad(); } -void -ConfigurationManager::setDialpad (const bool& display) -{ - Manager::instance().setDialpad (display); +void ConfigurationManager::setDialpad(const bool& display) { + Manager::instance().setDialpad(display); } -int32_t -ConfigurationManager::getSearchbar (void) -{ - return Manager::instance().getSearchbar(); +int32_t ConfigurationManager::getSearchbar(void) { + return Manager::instance().getSearchbar(); } -void -ConfigurationManager::setSearchbar (void) -{ - Manager::instance().setSearchbar(); +void ConfigurationManager::setSearchbar(void) { + Manager::instance().setSearchbar(); } -int32_t -ConfigurationManager::getVolumeControls (void) -{ - return Manager::instance().getVolumeControls(); +int32_t ConfigurationManager::getVolumeControls(void) { + return Manager::instance().getVolumeControls(); } -void -ConfigurationManager::setVolumeControls (const bool& display) -{ - Manager::instance().setVolumeControls (display); +void ConfigurationManager::setVolumeControls(const bool& display) { + Manager::instance().setVolumeControls(display); } -int32_t -ConfigurationManager::getHistoryLimit (void) -{ - return Manager::instance().getHistoryLimit(); +int32_t ConfigurationManager::getHistoryLimit(void) { + return Manager::instance().getHistoryLimit(); } -void -ConfigurationManager::setHistoryLimit (const int32_t& days) -{ - Manager::instance().setHistoryLimit (days); +void ConfigurationManager::setHistoryLimit(const int32_t& days) { + Manager::instance().setHistoryLimit(days); } - -void ConfigurationManager::setHistoryEnabled (void) -{ - Manager::instance ().setHistoryEnabled (); +void ConfigurationManager::setHistoryEnabled(void) { + Manager::instance().setHistoryEnabled(); } -std::string ConfigurationManager::getHistoryEnabled (void) -{ - return Manager::instance ().getHistoryEnabled (); +std::string ConfigurationManager::getHistoryEnabled(void) { + return Manager::instance().getHistoryEnabled(); } -void -ConfigurationManager::startHidden (void) -{ - Manager::instance().startHidden(); +void ConfigurationManager::startHidden(void) { + Manager::instance().startHidden(); } -int32_t -ConfigurationManager::isStartHidden (void) -{ - return Manager::instance().isStartHidden(); +int32_t ConfigurationManager::isStartHidden(void) { + return Manager::instance().isStartHidden(); } -void -ConfigurationManager::switchPopupMode (void) -{ - Manager::instance().switchPopupMode(); +void ConfigurationManager::switchPopupMode(void) { + Manager::instance().switchPopupMode(); } -int32_t -ConfigurationManager::popupMode (void) -{ - return Manager::instance().popupMode(); +int32_t ConfigurationManager::popupMode(void) { + return Manager::instance().popupMode(); } -void -ConfigurationManager::setNotify (void) -{ - Manager::instance().setNotify(); +void ConfigurationManager::setNotify(void) { + Manager::instance().setNotify(); } -int32_t -ConfigurationManager::getNotify (void) -{ - return Manager::instance().getNotify(); +int32_t ConfigurationManager::getNotify(void) { + return Manager::instance().getNotify(); } -void -ConfigurationManager::setAudioManager (const int32_t& api) -{ - Manager::instance().setAudioManager (api); +void ConfigurationManager::setAudioManager(const int32_t& api) { + Manager::instance().setAudioManager(api); } -int32_t -ConfigurationManager::getAudioManager (void) -{ - return Manager::instance().getAudioManager(); +int32_t ConfigurationManager::getAudioManager(void) { + return Manager::instance().getAudioManager(); } -void -ConfigurationManager::setMailNotify (void) -{ - Manager::instance().setMailNotify(); +void ConfigurationManager::setMailNotify(void) { + Manager::instance().setMailNotify(); } -int32_t -ConfigurationManager::getMailNotify (void) -{ - return Manager::instance().getMailNotify(); +int32_t ConfigurationManager::getMailNotify(void) { + return Manager::instance().getMailNotify(); } - -std::map<std::string, int32_t> ConfigurationManager::getAddressbookSettings (void) -{ - return Manager::instance().getAddressbookSettings (); +std::map<std::string, int32_t> ConfigurationManager::getAddressbookSettings( + void) { + return Manager::instance().getAddressbookSettings(); } -void ConfigurationManager::setAddressbookSettings (const std::map<std::string, int32_t>& settings) -{ - Manager::instance().setAddressbookSettings (settings); +void ConfigurationManager::setAddressbookSettings(const std::map<std::string, + int32_t>& settings) { + Manager::instance().setAddressbookSettings(settings); } -std::vector< std::string > ConfigurationManager::getAddressbookList (void) -{ - return Manager::instance().getAddressbookList(); +std::vector<std::string> ConfigurationManager::getAddressbookList(void) { + return Manager::instance().getAddressbookList(); } -void ConfigurationManager::setAddressbookList (const std::vector< std::string >& list) -{ - Manager::instance().setAddressbookList (list); +void ConfigurationManager::setAddressbookList( + const std::vector<std::string>& list) { + Manager::instance().setAddressbookList(list); } -std::map<std::string,std::string> ConfigurationManager::getHookSettings (void) -{ - return Manager::instance().getHookSettings (); +std::map<std::string, std::string> ConfigurationManager::getHookSettings(void) { + return Manager::instance().getHookSettings(); } -void ConfigurationManager::setHookSettings (const std::map<std::string, std::string>& settings) -{ - Manager::instance().setHookSettings (settings); +void ConfigurationManager::setHookSettings(const std::map<std::string, + std::string>& settings) { + Manager::instance().setHookSettings(settings); } -void ConfigurationManager::setAccountsOrder (const std::string& order) -{ - Manager::instance().setAccountsOrder (order); +void ConfigurationManager::setAccountsOrder(const std::string& order) { + Manager::instance().setAccountsOrder(order); } -std::map <std::string, std::string> ConfigurationManager::getHistory (void) -{ - return Manager::instance().send_history_to_client (); +std::map<std::string, std::string> ConfigurationManager::getHistory(void) { + return Manager::instance().send_history_to_client(); } -void ConfigurationManager::setHistory (const std::map <std::string, std::string>& entries) -{ - Manager::instance().receive_history_from_client (entries); +void ConfigurationManager::setHistory( + const std::map<std::string, std::string>& entries) { + Manager::instance().receive_history_from_client(entries); } -std::string -ConfigurationManager::getAddrFromInterfaceName(const std::string& interface) -{ +std::string ConfigurationManager::getAddrFromInterfaceName( + const std::string& interface) { - std::string address = SIPVoIPLink::instance("")->getInterfaceAddrFromName(interface); + std::string address = SIPVoIPLink::instance("")->getInterfaceAddrFromName( + interface); - return address; + return address; } -std::vector<std::string> ConfigurationManager::getAllIpInterface (void) -{ +std::vector<std::string> ConfigurationManager::getAllIpInterface(void) { - std::vector<std::string> vector; - SIPVoIPLink * sipLink = NULL; - sipLink = SIPVoIPLink::instance (""); + std::vector<std::string> vector; + SIPVoIPLink * sipLink = NULL; + sipLink = SIPVoIPLink::instance(""); - if (sipLink != NULL) { - vector = sipLink->getAllIpInterface(); - } + if (sipLink != NULL) { + vector = sipLink->getAllIpInterface(); + } - return vector; + return vector; } -std::vector<std::string> ConfigurationManager::getAllIpInterfaceByName(void) -{ - std::vector<std::string> vector; - SIPVoIPLink * sipLink = NULL; - sipLink = SIPVoIPLink::instance (""); +std::vector<std::string> ConfigurationManager::getAllIpInterfaceByName(void) { + std::vector<std::string> vector; + SIPVoIPLink * sipLink = NULL; + sipLink = SIPVoIPLink::instance(""); - if (sipLink != NULL) { - vector = sipLink->getAllIpInterfaceByName(); - } + if (sipLink != NULL) { + vector = sipLink->getAllIpInterfaceByName(); + } - return vector; + return vector; } -int32_t ConfigurationManager::getWindowWidth (void) { +int32_t ConfigurationManager::getWindowWidth(void) { - return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_WIDTH); + return Manager::instance().getConfigInt(PREFERENCES, WINDOW_WIDTH); } -int32_t ConfigurationManager::getWindowHeight (void) { +int32_t ConfigurationManager::getWindowHeight(void) { - return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_HEIGHT); + return Manager::instance().getConfigInt(PREFERENCES, WINDOW_HEIGHT); } - -void ConfigurationManager::setWindowWidth (const int32_t& width) { - Manager::instance ().setConfig (PREFERENCES, WINDOW_WIDTH, width); +void ConfigurationManager::setWindowWidth(const int32_t& width) { + + Manager::instance().setConfig(PREFERENCES, WINDOW_WIDTH, width); +} + +void ConfigurationManager::setWindowHeight(const int32_t& height) { + + Manager::instance().setConfig(PREFERENCES, WINDOW_HEIGHT, height); } - -void ConfigurationManager::setWindowHeight (const int32_t& height){ - Manager::instance ().setConfig (PREFERENCES, WINDOW_HEIGHT, height); +int32_t ConfigurationManager::getWindowPositionX(void) { + + return Manager::instance().getConfigInt(PREFERENCES, WINDOW_POSITION_X); } - -int32_t ConfigurationManager::getWindowPositionX (void) { - return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_POSITION_X); +int32_t ConfigurationManager::getWindowPositionY(void) { + + return Manager::instance().getConfigInt(PREFERENCES, WINDOW_POSITION_Y); } -int32_t ConfigurationManager::getWindowPositionY (void) { +void ConfigurationManager::setWindowPositionX(const int32_t& posX) { - return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_POSITION_Y); + Manager::instance().setConfig(PREFERENCES, WINDOW_POSITION_X, posX); } -void ConfigurationManager::setWindowPositionX (const int32_t& posX) { +void ConfigurationManager::setWindowPositionY(const int32_t& posY) { - Manager::instance ().setConfig (PREFERENCES, WINDOW_POSITION_X, posX); + Manager::instance().setConfig(PREFERENCES, WINDOW_POSITION_Y, posY); } -void ConfigurationManager::setWindowPositionY (const int32_t& posY) { +std::map<std::string, int32_t> ConfigurationManager::getShortcuts() { + + std::map<std::string, int> shortcutsMap; + int shortcut; + + for (int i = 0; i < shortcutsKeys.size(); i++) { + std::string key = shortcutsKeys.at(i); + shortcut = Manager::instance().getConfigInt("Shortcuts", key); + shortcutsMap.insert(std::pair<std::string, int>(key, shortcut)); + } - Manager::instance ().setConfig (PREFERENCES, WINDOW_POSITION_Y, posY); + return shortcutsMap; } +void ConfigurationManager::setShortcuts( + const std::map<std::string, int32_t>& shortcutsMap) { + std::map<std::string, int> map_cpy = shortcutsMap; + std::map<std::string, int>::iterator it; + + for (int i = 0; i < shortcutsKeys.size(); i++) { + std::string key = shortcutsKeys.at(i); + it = map_cpy.find(key); + if (it != shortcutsMap.end()) { + Manager::instance().setConfig("Shortcuts", key, it->second); + } + } + + Manager::instance().saveConfig(); +} diff --git a/sflphone-common/src/dbus/configurationmanager.h b/sflphone-common/src/dbus/configurationmanager.h index 7749fd233a..4c18267c35 100644 --- a/sflphone-common/src/dbus/configurationmanager.h +++ b/sflphone-common/src/dbus/configurationmanager.h @@ -37,6 +37,9 @@ public: ConfigurationManager(DBus::Connection& connection); static const char* SERVER_PATH; +private: + std::vector<std::string> shortcutsKeys; + public: std::map< std::string, std::string > getAccountDetails( const std::string& accountID ); @@ -143,6 +146,9 @@ public: std::vector<std::string> getAllIpInterface(void); std::vector<std::string> getAllIpInterfaceByName(void); + + std::map< std::string, int32_t > getShortcuts (); + void setShortcuts (const std::map< std::string, int32_t >& shortcutsMap); }; -- GitLab