* #7264: gnome: don't display <sip: or <sips: prefix in history

This commit is contained in:
Tristan Matthews
2012-01-09 16:57:12 -05:00
parent 1814a4620d
commit 51e26495c8
4 changed files with 24 additions and 6 deletions

View File

@ -97,7 +97,7 @@ sflphone_notify_voice_mail(const gchar* accountID , guint count)
* Else, check if it an IP call. if not, popup an error message
*/
static gboolean _is_direct_call(callable_obj_t * c)
static gboolean is_direct_call(callable_obj_t * c)
{
if (g_strcasecmp(c->_accountID, "empty") == 0) {
if (!g_str_has_prefix(c->_peer_number, "sip:")) {
@ -555,7 +555,7 @@ sflphone_incoming_call(callable_obj_t * c)
calltree_display(current_calls_tab);
// Change the status bar if we are dealing with a direct SIP call
if (_is_direct_call(c)) {
if (is_direct_call(c)) {
gchar *msg = g_markup_printf_escaped(_("Direct SIP call"));
statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);
statusbar_push_message(msg , NULL, __MSG_ACCOUNT_DEFAULT);
@ -827,7 +827,7 @@ sflphone_place_call(callable_obj_t * c)
{
DEBUG("Actions: Placing call with %s @ %s and accountid %s", c->_display_name, c->_peer_number, c->_accountID);
if (_is_direct_call(c)) {
if (is_direct_call(c)) {
gchar *msg = g_markup_printf_escaped(_("Direct SIP call"));
statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);
statusbar_push_message(msg , NULL, __MSG_ACCOUNT_DEFAULT);

View File

@ -300,3 +300,8 @@ gchar *get_formatted_start_timestamp(time_t start)
strftime(str, sizeof str, fmt, &start_tm);
return g_markup_printf_escaped("%s\n", str);
}
gboolean call_was_outgoing(callable_obj_t * obj)
{
return g_strcmp0(obj->_history_state, OUTGOING_STRING) == 0;
}

View File

@ -202,4 +202,6 @@ gchar* get_formatted_start_timestamp(time_t);
gchar* call_get_audio_codec(callable_obj_t *obj);
gboolean call_was_outgoing(callable_obj_t * obj);
#endif

View File

@ -332,6 +332,16 @@ button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data UNUS
return TRUE;
}
static gchar *clean_display_number(gchar *name)
{
const gchar SIP_PREFIX[] = "<sip:";
const gchar SIPS_PREFIX[] = "<sips:";
if (g_str_has_prefix(name, SIP_PREFIX))
name += (sizeof(SIP_PREFIX) - 1);
else if (g_str_has_prefix(name, SIPS_PREFIX))
name += (sizeof(SIPS_PREFIX) - 1);
return name;
}
static gchar *
calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, const gchar *const audio_codec)
@ -339,7 +349,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, con
gchar display_number[strlen(c->_peer_number) + 1];
strcpy(display_number, c->_peer_number);
if (c->_type != CALL || g_strcmp0(c->_history_state, OUTGOING_STRING)) {
if (c->_type != CALL || !call_was_outgoing(c)) {
// Get the hostname for this call (NULL if not existent)
gchar * hostname = g_strrstr(c->_peer_number, "@");
@ -349,13 +359,14 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, con
}
// Different display depending on type
const gchar *name, *details = NULL;
gchar *name, *details = NULL;
if (*c->_display_name) {
name = c->_display_name;
details = display_number;
} else {
name = display_number;
name = clean_display_number(name);
details = "";
}
@ -712,7 +723,7 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter *
g_free(duration);
gchar *old_description = description;
description = g_strconcat(old_description , full_duration, NULL);
description = g_strconcat(old_description, full_duration, NULL);
g_free(full_duration);
g_free(old_description);
}