Commit 001f6117 authored by Alexandre Savard's avatar Alexandre Savard

[#2274] Complete display name parsing and displaying

parent f8fd1cf9
......@@ -51,20 +51,33 @@ gchar* call_get_peer_name (const gchar *format)
{
gchar *end, *name;
end = g_strrstr (format, "\"");
DEBUG(" callable_obj: %s", format);
end = g_strrstr (format, "<");
if (!end) {
return g_strndup (format, 0);
} else {
name = format +1;
name = format;
return g_strndup(name, end - name);
}
}
gchar* call_get_peer_number (const gchar *format)
{
DEBUG(" callable_obj: %s", format);
gchar * number = g_strrstr(format, "<") + 1;
gchar * end = g_strrstr(format, ">");
number = g_strndup(number, end - number );
if(end && number)
number = g_strndup(number, end - number );
else
number = g_strdup(format);
return number;
}
......
......@@ -576,7 +576,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
if(c->_state == CALL_STATE_TRANSFERT)
{
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:%s</i> ",
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:%s</i> ",
c->_peer_number,
c->_peer_name,
c->_trsft_to);
......@@ -585,20 +585,20 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
{
// c->_zrtp_confirmed == FALSE : Hack explained in callable_obj.h
if((c->_sas != NULL) && (display_sas == TRUE) && (c->_srtp_state == SRTP_STATE_SAS_UNCONFIRMED) && (c->_zrtp_confirmed == FALSE)) {
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Confirm SAS <b>%s</b> ?</i> ",
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Confirm SAS <b>%s</b> ?</i> ",
c->_peer_number,
c->_peer_name,
c->_sas);
} else {
DEBUG("Updating state code %d %s", c->_state_code, c->_state_code_description);
if (c->_state_code) {
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>",
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>",
c->_peer_number,
c->_peer_name,
c->_state_code_description,
c->_state_code);
} else {
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
c->_peer_number,
c->_peer_name );
}
......@@ -712,14 +712,14 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
if(c->_state_code == 0) {
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
c->_peer_number,
c->_peer_name);
}
else {
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>",
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>",
c->_peer_number,
c->_peer_name,
c->_state_code_description,
......@@ -830,7 +830,7 @@ void calltree_add_history_entry (callable_obj_t * c)
// New call in the list
gchar * description, *date="", *duration="";
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
c->_peer_number,
c->_peer_name);
......@@ -968,10 +968,13 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
// Every participant to a conference must be secured, the conference is not secured elsewhere
conf->_conference_secured = TRUE;
DEBUG("Determine if conference is secured");
participant = conf->participant;
if(participant)
{
DEBUG(" determine if at least one participant uses srtp");
participant = conf->participant;
for (pl = participant; *participant; participant++)
{
......@@ -986,15 +989,19 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
}
if(g_strcasecmp(srtp_enabled,"true") == 0) {
DEBUG(" srtp enabled for participant %s\n", participant);
conf->_conf_srtp_enabled = TRUE;
break;
} else {
DEBUG(" srtp is not enabled for participant %s\n", participant);
}
}
}
DEBUG(" determine if all conference participant are secured");
if(conf->_conf_srtp_enabled)
{
participant = conf->participant;
......@@ -1007,8 +1014,11 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
if(call->_srtp_state == 0)
{
DEBUG(" participant %s is not secured", participant);
conf->_conference_secured = FALSE;
break;
} else {
DEBUG(" participant %s is secured", participant);
}
}
}
......@@ -1019,10 +1029,12 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
{
if(conf->_conference_secured)
{
DEBUG("Conference is secured");
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL);
}
else
{
DEBUG("Conference is not secured");
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL);
}
}
......
......@@ -50,7 +50,8 @@ incoming_call_cb (DBusGProxy *proxy UNUSED,
const gchar* from,
void * foo UNUSED )
{
DEBUG ("Incoming call! %s",callID);
DEBUG("Incoming call! %s", callID);
DEBUG(" from: %s", from);
callable_obj_t * c;
gchar *peer_name, *peer_number;
......@@ -58,6 +59,9 @@ incoming_call_cb (DBusGProxy *proxy UNUSED,
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);
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 );
......
......@@ -1745,7 +1745,7 @@ bool
ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
{
PulseLayer *pulselayer;
std::string from, number, display_name;
std::string from, number, display_name, display;
stopTone (true);
......@@ -1775,11 +1775,11 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
from = call->getPeerName();
display_name = call->getDisplayName();
number = call->getPeerNumber();
_debug( "incomingCall display_name from: %s, number: %s\n");
display_name = call->getDisplayName();
// _debug( "incomingCall from: %s, number: %s, display_name: %s\n", from.c_str(), number.c_str(), display_name.c_str());
if (from != "" && number != "") {
from.append (" <");
......@@ -1801,8 +1801,16 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
*/
/* Broadcast a signal over DBus */
_debug(" From: %s, Number: %s\n", from.c_str(), number.c_str());
if (_dbus) _dbus->getCallManager()->incomingCall (accountId, call->getCallId(), from.c_str());
_debug(" From: %s, Number: %s, DisplayName: %s\n", from.c_str(), number.c_str(), display_name.c_str());
display = display_name;
display.append(" ");
display.append(from);
_debug(" To be displayed: %s\n", display.c_str());
if (_dbus) _dbus->getCallManager()->incomingCall (accountId, call->getCallId(), display.c_str());
//if (_dbus) _dbus->getCallManager()->callStateChanged(call->getCallId(), "INCOMING");
......@@ -2511,7 +2519,9 @@ ManagerImpl::getCurrentCodecName (const CallID& id)
VoIPLink* link = getAccountLink (accountid);
Call* call = link->getCall(id);
if(!call)
return "";
if(call->getState() != Call::Active)
return "";
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment