Commit c3e31789 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Fix bug 0002636: Don't know who sent a chat message from a notification.

parent 93972b58
......@@ -620,7 +620,7 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room,
#else
if ( !gtk_window_is_active ( GTK_WINDOW ( main_window ) ) ) {
if ( !GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( w ),"is_notified" ) ) ) {
linphone_gtk_notify ( NULL,linphone_chat_message_get_text ( msg ) );
linphone_gtk_notify ( NULL, msg, NULL );
g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( TRUE ) );
} else {
g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( FALSE ) );
......
......@@ -146,7 +146,7 @@ LINPHONE_PUBLIC void linphone_gtk_terminate_call(GtkWidget *button);
LINPHONE_PUBLIC void linphone_gtk_call_update_tab_header(LinphoneCall *call, gboolean pause);
LINPHONE_PUBLIC void linphone_gtk_show_directory_search(void);
LINPHONE_PUBLIC void linphone_gtk_status_icon_set_blinking(gboolean val);
LINPHONE_PUBLIC void linphone_gtk_notify(LinphoneCall *call, const char *msg);
LINPHONE_PUBLIC void linphone_gtk_notify(LinphoneCall *call, LinphoneChatMessage *chat_message, const char *msg);
LINPHONE_PUBLIC void linphone_gtk_load_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *uri, GtkWidget *chat_view);
LINPHONE_PUBLIC void linphone_gtk_send_text();
......
......@@ -1220,21 +1220,26 @@ static void make_notification(const char *title, const char *body){
#endif
void linphone_gtk_notify(LinphoneCall *call, const char *msg){
void linphone_gtk_notify(LinphoneCall *call, LinphoneChatMessage *chat_message, const char *msg){
#ifdef HAVE_NOTIFY
if (!notify_is_initted())
if (!notify_init ("Linphone")) ms_error("Libnotify failed to init.");
#endif
if (!call) {
if (chat_message) {
const LinphoneAddress *address = linphone_chat_message_get_peer_address(chat_message);
char *remote = linphone_address_as_string(address);
make_notification(remote, linphone_chat_message_get_text(chat_message));
} else {
#ifdef HAVE_NOTIFY
if (!notify_notification_show(notify_notification_new("Linphone",msg,NULL
if (!notify_notification_show(notify_notification_new("Linphone",msg,NULL
#ifdef HAVE_NOTIFY1
,NULL
,NULL
#endif
),NULL))
),NULL)) {
ms_error("Failed to send notification.");
}
}
#else
linphone_gtk_show_main_window();
#endif
......@@ -1389,7 +1394,7 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
default:
break;
}
linphone_gtk_notify(call, msg);
linphone_gtk_notify(call, NULL, msg);
linphone_gtk_update_call_buttons (call);
}
......@@ -1952,7 +1957,7 @@ void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to){
GtkEntry * uri_bar =GTK_ENTRY(linphone_gtk_get_widget(
linphone_gtk_get_main_window(), "uribar"));
char *text;
linphone_gtk_notify(NULL,(text=ms_strdup_printf(_("We are transferred to %s"),refer_to)));
linphone_gtk_notify(NULL,NULL,(text=ms_strdup_printf(_("We are transferred to %s"),refer_to)));
g_free(text);
gtk_entry_set_text(uri_bar, refer_to);
linphone_gtk_start_call(linphone_gtk_get_main_window());
......
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