Commit 7d9f1e41 authored by Alexandre Savard's avatar Alexandre Savard

Merge branch 'master' into manu/sipp

parents 81185b52 2932c9b4
......@@ -16,6 +16,7 @@ pushd libs/pjproject
make && make dep
popd
./configure --prefix=/usr
make clean
make
make doc
popd
......@@ -31,6 +32,7 @@ popd
pushd sflphone-client-gnome
./autogen.sh
./configure --prefix=/usr
make clean
make
popd
......
......@@ -51,7 +51,8 @@
#include <sys/ioctl.h>
#include <linux/if.h>
#include <widget/imwidget.h>
#include <imwindow.h>
GHashTable * ip2ip_profile=NULL;
......@@ -199,8 +200,11 @@ sflphone_hung_up (callable_obj_t * c)
call_remove_all_errors (c);
update_actions();
/* Update the IM interface */
im_widget_update_state (c->_im_widget, FALSE);
// test wether the widget contain text, if not remove it
if ( (im_window_get_nb_tabs() > 1) && c->_im_widget && ! (IM_WIDGET (c->_im_widget)->containText))
im_window_remove_tab (c->_im_widget);
else
im_widget_update_state (IM_WIDGET (c->_im_widget), FALSE);
#if GTK_CHECK_VERSION(2,10,0)
status_tray_icon_blink (FALSE);
......@@ -380,7 +384,13 @@ sflphone_hang_up()
call_remove_all_errors (selectedCall);
selectedCall->_state = CALL_STATE_DIALING;
set_timestamp (&selectedCall->_time_stop);
im_widget_update_state (selectedCall->_im_widget, FALSE);
//if ( (im_window_get_nb_tabs() > 1) && selectedCall->_im_widget &&
// ! (IM_WIDGET (selectedCall->_im_widget)->containText))
// im_window_remove_tab (selectedCall->_im_widget);
//else
im_widget_update_state (IM_WIDGET (selectedCall->_im_widget), FALSE);
break;
case CALL_STATE_FAILURE:
dbus_hang_up (selectedCall);
......@@ -404,6 +414,7 @@ sflphone_hang_up()
break;
}
} else if (selectedConf) {
im_widget_update_state (IM_WIDGET (selectedConf->_im_widget), FALSE);
dbus_hang_up_conference (selectedConf);
}
......@@ -436,10 +447,20 @@ sflphone_pick_up()
switch (selectedCall->_state) {
case CALL_STATE_DIALING:
sflphone_place_call (selectedCall);
// if instant messaging window is visible, create new tab (deleted automatically if not used)
if (im_window_is_visible())
im_widget_display ( (IMWidget **) (&selectedCall->_im_widget), NULL, selectedCall->_callID, NULL);
break;
case CALL_STATE_INCOMING:
selectedCall->_history_state = INCOMING;
calltree_update_call (history, selectedCall, NULL);
// if instant messaging window is visible, create new tab (deleted automatically if not used)
if (im_window_is_visible())
im_widget_display ( (IMWidget **) (&selectedCall->_im_widget), NULL, selectedCall->_callID, NULL);
dbus_accept (selectedCall);
DEBUG ("from sflphone_pick_up : ");
stop_notification();
......@@ -972,6 +993,10 @@ sflphone_detach_participant (const gchar* callID)
selectedCall->_confID = NULL;
}
// Instant messaging widget should have been deactivated during the conference
if (selectedCall->_im_widget)
im_widget_update_state (IM_WIDGET (selectedCall->_im_widget), TRUE);
calltree_remove_call (current_calls, selectedCall, NULL);
calltree_add_call (current_calls, selectedCall, NULL);
dbus_detach_participant (selectedCall->_callID);
......@@ -984,6 +1009,10 @@ sflphone_detach_participant (const gchar* callID)
selectedCall->_confID = NULL;
}
// Instant messagin widget should have been deactivated during the conference
if (selectedCall->_im_widget)
im_widget_update_state (IM_WIDGET (selectedCall->_im_widget), TRUE);
calltree_remove_call (current_calls, selectedCall, NULL);
calltree_add_call (current_calls, selectedCall, NULL);
dbus_detach_participant (callID);
......
......@@ -537,8 +537,6 @@ gchar*
get_peer_information (callable_obj_t *c)
{
gchar *res;
if (g_strcasecmp (c->_peer_name,"") == 0)
return g_strdup (c->_peer_number);
else
......
......@@ -105,7 +105,6 @@ void codec_capabilities_load (void)
void account_create_codec_list (account_t **acc)
{
gchar **order = NULL;
GQueue *_codecs;
_codecs = (*acc)->codecs;
......
......@@ -56,10 +56,11 @@ typedef enum {
typedef struct {
conference_state_t _state; // The state of the call
gchar* _confID; // The call ID
gchar *_confID; // The call ID
gboolean _conference_secured; // the security state of the conference
gboolean _conf_srtp_enabled; // security required for this conference
GSList* participant_list; // participant list for this
GSList *participant_list; // participant list for this
GtkWidget *_im_widget; // associated instant messaging widget
} conference_obj_t;
......
......@@ -31,6 +31,8 @@
* as that of the covered work.
*/
#include <actions.h>
#include <mainwindow.h>
#include <accountlist.h>
......@@ -74,7 +76,7 @@ GtkWidget * entryMailbox;
GtkWidget * entryUseragent;
GtkWidget * entryResolveNameOnlyOnce;
GtkWidget * expireSpinBox;
GtkListStore * credentialStore;
GtkListStore * credentialStore = NULL;
GtkWidget * deleteCredButton;
GtkWidget * treeViewCredential;
// GtkWidget * scrolledWindowCredential;
......@@ -259,10 +261,15 @@ static GPtrArray* getNewCredential (GHashTable * properties)
static void update_credential_cb (GtkWidget *widget, gpointer data UNUSED)
{
GtkTreeIter iter;
gtk_tree_model_get_iter_from_string ( (GtkTreeModel *) credentialStore, &iter, "0");
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "column"));
// g_print ("set password to %s\n", (gchar *) gtk_entry_get_text(GTK_ENTRY(widget)));
gtk_list_store_set (GTK_LIST_STORE (credentialStore), &iter, column, (gchar *) gtk_entry_get_text (GTK_ENTRY (widget)), -1);
if (credentialStore) {
if (gtk_tree_model_get_iter_from_string ( (GtkTreeModel *) credentialStore, &iter, "0")) {
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "column"));
// g_print ("set password to %s\n", (gchar *) gtk_entry_get_text(GTK_ENTRY(widget)));
gtk_list_store_set (GTK_LIST_STORE (credentialStore), &iter, column, (gchar *) gtk_entry_get_text (GTK_ENTRY (widget)), -1);
}
}
}
static GtkWidget* create_basic_tab (account_t **a)
......@@ -1474,8 +1481,10 @@ void show_account_window (account_t * a)
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (overrtp))) {
DEBUG ("Config: Set dtmf over rtp");
g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_DTMF_TYPE), g_strdup (OVERRTP));
} else {
DEBUG ("Config: Set dtmf over sip");
g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_DTMF_TYPE), g_strdup (SIPINFO));
}
......
......@@ -28,6 +28,7 @@
* as that of the covered work.
*/
#include <audioconf.h>
#include <utils.h>
#include <string.h>
......@@ -752,28 +753,6 @@ select_audio_manager (void)
}
void
active_echo_cancel (void)
{
gchar* state;
gchar* newstate;
DEBUG ("Audio: Active echo cancel clicked");
state = dbus_get_echo_cancel_state();
DEBUG ("Audio: Get echo cancel state %s", state);
if (strcmp (state, "enabled") == 0)
newstate = "disabled";
else
newstate = "enabled";
dbus_set_echo_cancel_state (newstate);
}
void
active_noise_suppress (void)
{
......@@ -781,10 +760,10 @@ active_noise_suppress (void)
gchar *state;
gchar *newstate;
DEBUG ("Audio: Active noise suppress clicked");
DEBUG ("Audio: Active noise suppression clicked");
state = dbus_get_noise_suppress_state();
DEBUG ("Audio: Get echo cancel state %s", state);
DEBUG ("Audio: Get noise suppression cancel state %s", state);
if (strcmp (state, "enabled") == 0)
newstate = "disabled";
......@@ -919,9 +898,8 @@ GtkWidget* create_audio_configuration()
GtkWidget *ret;
// Sub boxes
GtkWidget *frame;
GtkWidget *enableEchoCancel;
GtkWidget *enableNoiseReduction;
gboolean echocancelActive, noisesuppressActive;
gboolean noisesuppressActive;
gchar *state;
ret = gtk_vbox_new (FALSE, 10);
......@@ -988,19 +966,6 @@ GtkWidget* create_audio_configuration()
gnome_main_section_new_with_table (_ ("Voice enhancement settings"), &frame, &table, 2, 1);
gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0);
enableEchoCancel = gtk_check_button_new_with_mnemonic (_ ("_Echo Suppression"));
state = dbus_get_echo_cancel_state();
echocancelActive = FALSE;
if (strcmp (state, "enabled") == 0)
echocancelActive = TRUE;
else
echocancelActive = FALSE;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enableEchoCancel), echocancelActive);
g_signal_connect (G_OBJECT (enableEchoCancel), "clicked", active_echo_cancel, NULL);
gtk_table_attach (GTK_TABLE (table), enableEchoCancel, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
enableNoiseReduction = gtk_check_button_new_with_mnemonic (_ ("_Noise Reduction"));
state = dbus_get_noise_suppress_state();
noisesuppressActive = FALSE;
......
......@@ -80,10 +80,13 @@ typedef struct {
gint page_number;
} browser_t;
// history preference parameters
static int history_limit;
static gboolean history_enabled = TRUE;
// instant messaging preference parameters
static gboolean instant_messaging_enabled = TRUE;
static void
start_hidden (void)
{
......@@ -124,6 +127,14 @@ history_enabled_cb (GtkWidget *widget)
eel_gconf_set_integer (HISTORY_ENABLED, !eel_gconf_get_integer (HISTORY_ENABLED));
}
static void
instant_messaging_enabled_cb (GtkWidget *widget)
{
instant_messaging_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
eel_gconf_set_integer (INSTANT_MESSAGING_ENABLED, !eel_gconf_get_integer (INSTANT_MESSAGING_ENABLED));
}
void
clean_history (void)
{
......@@ -160,6 +171,9 @@ create_general_settings ()
// Load history configuration
history_load_configuration ();
// Load instant messaging configuration
instant_messaging_load_configuration();
// Main widget
ret = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (ret), 10);
......@@ -248,6 +262,18 @@ create_general_settings ()
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL, 0, 5);
// INSTANT MESSAGING CONFIGURATION
gnome_main_section_new_with_table (_ ("Instant Messaging"), &frame, &table, 1, 1);
gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0);
checkBoxWidget = gtk_check_button_new_with_mnemonic (
_ ("Enable instant messaging"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkBoxWidget),
instant_messaging_enabled);
g_signal_connect (G_OBJECT (checkBoxWidget) , "clicked" , G_CALLBACK (instant_messaging_enabled_cb) , NULL);
gtk_table_attach (GTK_TABLE (table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND
| GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
gtk_widget_show_all (ret);
return ret;
......@@ -273,6 +299,14 @@ history_load_configuration ()
{
history_limit = dbus_get_history_limit ();
history_enabled = eel_gconf_get_integer (HISTORY_ENABLED);
}
void
instant_messaging_load_configuration ()
{
instant_messaging_enabled = eel_gconf_get_integer (INSTANT_MESSAGING_ENABLED);
}
......@@ -402,7 +436,7 @@ GtkTreeModel* createModel()
{
browser_t browser_entries[5] = {
{_ ("General"), "start-here", 0},
{_ ("General"), "preferences-system", 0},
{_ ("Audio"), "multimedia-volume-control", 1},
{_ ("Address Book"), "address-book-new", 2},
{_ ("Hooks"), "gnome-globe", 3},
......
......@@ -121,6 +121,8 @@ void save_configuration_parameters (void);
void history_load_configuration (void);
void instant_messaging_load_configuration (void);
GtkTreeModel* createModel();
#endif
......@@ -548,7 +548,8 @@ fill_books_data ()
book_data->name = g_strdup (e_source_peek_name (source));
book_data->uid = g_strdup (e_source_peek_uid (source));
gchar *prop = e_source_get_property (source, "default");
const gchar *property_name = "default";
const gchar *prop = e_source_get_property (source, property_name);
if (prop)
if (strcmp (prop, "true") == 0)
......
......@@ -40,6 +40,7 @@
#include <history.h>
#include "uimanager.h"
#include "actions.h"
#include "../imwindow.h"
GtkWidget *sw;
GtkCellRenderer *rend;
......@@ -130,6 +131,10 @@ call_selected_cb (GtkTreeSelection *sel, void* data UNUSED)
selected_path = string_path;
selected_call = NULL;
if (selected_conf->_im_widget) {
// show the coresponding widget
im_window_show_tab (selected_conf->_im_widget);
}
}
DEBUG ("CallTree: selected_path %s, selected_call_id %s, selected_path_depth %d",
......@@ -152,6 +157,11 @@ call_selected_cb (GtkTreeSelection *sel, void* data UNUSED)
selected_call_id = selected_call->_callID;
selected_path = string_path;
selected_conf = NULL;
if (selected_call->_im_widget) {
// show the coresponding widget
im_window_show_tab (selected_call->_im_widget);
}
}
DEBUG ("CallTree: selected_path %s, selected_call_id %s, selected_path_depth %d",
......
......@@ -39,7 +39,7 @@ GtkWidget * searchbox;
GtkWidget * addressbookentry;
GtkWidget * cbox;
GtkListStore * liststore;
GtkListStore * liststore = NULL;
gint cboxSignalId;
......@@ -109,7 +109,7 @@ void update_searchbar_addressbook_list()
= book_list_iterator->next) {
book_data = (book_data_t *) book_list_iterator->data;
if (book_data->active) {
if (book_data && book_data->active && activeText) {
gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, 0, book_data->name, -1);
......
......@@ -545,22 +545,6 @@
</arg>
</method>
<method name="getEchoCancelState" tp:name-for-bindings="getEchoCancelState">
<tp:docstring>
</tp:docstring>
<arg type="s" name="state" direction="out">
<tp:docstring>
</tp:docstring>
</arg>
</method>
<method name="setEchoCancelState" tp:name-for-bindings="setEchoCancelState">
<tp:docstring>
</tp:docstring>
<arg type="s" name="state" direction="in">
</arg>
</method>
<method name="getNoiseSuppressState" tp:name-for-bindings="getNoiseSuppressState">
<tp:docstring>
</tp:docstring>
......
......@@ -49,6 +49,8 @@
#include <widget/imwidget.h>
#include <eel-gconf-extensions.h>
#define DEFAULT_DBUS_TIMEOUT 30000
DBusGConnection * connection;
......@@ -122,19 +124,38 @@ voice_mail_cb (DBusGProxy *proxy UNUSED, const gchar* accountID, const guint nb,
static void
incoming_message_cb (DBusGProxy *proxy UNUSED, const gchar* callID UNUSED, const gchar *from, const gchar* msg, void * foo UNUSED)
{
DEBUG ("Message %s!",msg);
DEBUG ("Message \"%s\" from %s!", msg, from);
// Get the call information. Does this call exist?
callable_obj_t * c = calllist_get (current_calls, callID);
callable_obj_t *call = NULL;
conference_obj_t *conf = NULL;
// do not display message if instant messaging is disabled
gboolean instant_messaging_enabled = TRUE;
if (eel_gconf_key_exists (INSTANT_MESSAGING_ENABLED))
instant_messaging_enabled = eel_gconf_get_integer (INSTANT_MESSAGING_ENABLED);
if (!instant_messaging_enabled)
return;
// Get the call information. (if this call exist)
call = calllist_get (current_calls, callID);
// Get the conference information (if this conference exist)
conf = conferencelist_get (callID);
/* First check if the call is valid */
if (c) {
if (call) {
/* Make the instant messaging main window pops, add messages only if the main window exist.
Elsewhere the message is displayed asynchronously*/
if (im_widget_display (&c, msg))
im_widget_add_message (c->_im_widget, get_peer_information (c), msg, 0);
Elsewhere the message is displayed asynchronously*/
if (im_widget_display ( (IMWidget **) (&call->_im_widget), msg, call->_callID, from))
im_widget_add_message (IM_WIDGET (call->_im_widget), from, msg, 0);
} else if (conf) {
/* Make the instant messaging main window pops, add messages only if the main window exist.
Elsewhere the message is displayed asynchronously*/
if (im_widget_display ( (IMWidget **) (&conf->_im_widget), msg, conf->_confID, from))
im_widget_add_message (IM_WIDGET (conf->_im_widget), from, msg, 0);
} else {
ERROR ("Message received, but no recipient found");
}
......@@ -218,9 +239,13 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
const gchar* state, void * foo UNUSED)
{
gchar** part;
callable_obj_t *call;
gchar* call_id;
// sflphone_display_transfer_status("Transfer successfull");
conference_obj_t* changed_conf = conferencelist_get (confID);
gchar** participants;
gchar** old_participants, new_participants;
DEBUG ("conference new state %s\n", state);
......@@ -239,10 +264,32 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
DEBUG ("Error: conference state not recognized");
}
participants = (gchar**) dbus_get_participant_list (changed_conf->_confID);
// reactivate instant messaging window for these calls
old_participants = (gchar**) changed_conf->participant_list;
for (part = old_participants; *part; part++) {
call_id = (gchar*) (*part);
call = calllist_get (current_calls, call_id);
if (call && call->_im_widget)
im_widget_update_state (IM_WIDGET (call->_im_widget), TRUE);
}
new_participants = (gchar **) dbus_get_participant_list (changed_conf->_confID);
// update conferece participants
conference_participant_list_update (participants, changed_conf);
conference_participant_list_update (new_participants, changed_conf);
// deactivate instant messaging window for new participants
new_participants = (gchar**) changed_conf->participant_list;
for (part = new_participants; *part; part++) {
call_id = (gchar*) (*part);
call = calllist_get (current_calls, call_id);
if (call && call->_im_widget)
im_widget_update_state (IM_WIDGET (call->_im_widget), FALSE);
}
// add new conference to calltree
calltree_add_conference (current_calls, changed_conf);
......@@ -271,6 +318,11 @@ conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
for (part = participants; *part; part++) {
call_id = (gchar*) (*part);
call = calllist_get (current_calls, call_id);
// if a text widget is already created, disable it, use conference widget instead
if (call->_im_widget)
im_widget_update_state (IM_WIDGET (call->_im_widget), FALSE);
call->_confID = g_strdup (confID);
}
......@@ -289,6 +341,11 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
GSList *participant = c->participant_list;
callable_obj_t *call;
// deactivate instant messaging window for this conference
if (c->_im_widget)
im_widget_update_state (IM_WIDGET (c->_im_widget), FALSE);
// remove all participant for this conference
while (participant) {
call = calllist_get (current_calls, (const gchar *) (participant->data));
......@@ -300,6 +357,10 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
g_free (call->_confID);
call->_confID = NULL;
}
// if an instant messaging was previously disabled, enabled it
if (call->_im_widget)
im_widget_update_state (IM_WIDGET (call->_im_widget), TRUE);
}
participant = conference_next_participant (participant);
......@@ -1404,40 +1465,6 @@ dbus_get_current_audio_output_plugin()
return plugin;
}
/**
* Get echo canceller state
*/
gchar*
dbus_get_echo_cancel_state()
{
gchar* state = "";