aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-07-14 03:05:13 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-07-14 03:05:13 +0800
commit910d62fbaf0883abb0a4cd6e891729e6f02a230f (patch)
tree98be2e25cfcd10602de89b37cb537c305d37f85b
parent62c4900346fd2e5466ae71779401dc18a90b7b46 (diff)
downloadgsoc2013-empathy-910d62fbaf0883abb0a4cd6e891729e6f02a230f.tar
gsoc2013-empathy-910d62fbaf0883abb0a4cd6e891729e6f02a230f.tar.gz
gsoc2013-empathy-910d62fbaf0883abb0a4cd6e891729e6f02a230f.tar.bz2
gsoc2013-empathy-910d62fbaf0883abb0a4cd6e891729e6f02a230f.tar.lz
gsoc2013-empathy-910d62fbaf0883abb0a4cd6e891729e6f02a230f.tar.xz
gsoc2013-empathy-910d62fbaf0883abb0a4cd6e891729e6f02a230f.tar.zst
gsoc2013-empathy-910d62fbaf0883abb0a4cd6e891729e6f02a230f.zip
If there is no pending msg when a text channel should be filtered wait for
2007-07-13 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-status-icon.c: If there is no pending msg when a text channel should be filtered wait for the first message instead of not dispatching the channel which may cause messages to be lost. svn path=/trunk/; revision=187
-rw-r--r--ChangeLog7
-rw-r--r--libempathy-gtk/empathy-status-icon.c44
2 files changed, 38 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 8489c4f7a..bae7c3908 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2007-07-13 Xavier Claessens <xclaesse@gmail.com>
+ * libempathy-gtk/empathy-status-icon.c: If there is no pending msg
+ when a text channel should be filtered wait for the first message
+ instead of not dispatching the channel which may cause messages to be
+ lost.
+
+2007-07-13 Xavier Claessens <xclaesse@gmail.com>
+
* libempathy/empathy-tp-contact-list.c: Fix avatar request queue.
2007-07-13 Xavier Claessens <xclaesse@gmail.com>
diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c
index 6ec17ecc0..3e56f09ef 100644
--- a/libempathy-gtk/empathy-status-icon.c
+++ b/libempathy-gtk/empathy-status-icon.c
@@ -94,6 +94,9 @@ static void status_icon_filter_new_channel (EmpathyFilter *filte
TpConn *tp_conn,
TpChan *tp_chan,
EmpathyStatusIcon *icon);
+static void status_icon_message_received_cb (EmpathyTpChat *tp_chat,
+ EmpathyMessage *message,
+ EmpathyStatusIcon *icon);
static void status_icon_idle_notify_cb (EmpathyStatusIcon *icon);
static void status_icon_update_tooltip (EmpathyStatusIcon *icon);
static void status_icon_set_from_state (EmpathyStatusIcon *icon);
@@ -252,10 +255,7 @@ status_icon_filter_new_channel (EmpathyFilter *filter,
EmpathyStatusIconPriv *priv;
McAccount *account;
EmpathyTpChat *tp_chat;
- EmpathyContact *sender;
GList *messages;
- gchar *msg;
- StatusIconEvent *event;
priv = GET_PRIV (icon);
@@ -263,29 +263,47 @@ status_icon_filter_new_channel (EmpathyFilter *filter,
account = mission_control_get_account_for_connection (priv->mc, tp_conn, NULL);
tp_chat = empathy_tp_chat_new (account, tp_chan);
+ g_object_set_data (G_OBJECT (tp_chat), "filter", filter);
g_object_unref (account);
messages = empathy_tp_chat_get_pendings (tp_chat);
if (!messages) {
- empathy_debug (DEBUG_DOMAIN, "There is no message pending, "
- "don't dispatch the channel");
- empathy_filter_process (filter, tp_chan, FALSE);
- g_object_unref (tp_chat);
+ empathy_debug (DEBUG_DOMAIN, "No pending msg, waiting...");
+ g_signal_connect (tp_chat, "message-received",
+ G_CALLBACK (status_icon_message_received_cb),
+ icon);
return;
}
- sender = empathy_message_get_sender (messages->data);
+ status_icon_message_received_cb (tp_chat, messages->data, icon);
+
+ g_list_foreach (messages, (GFunc) g_object_unref, NULL);
+ g_list_free (messages);
+}
+
+static void
+status_icon_message_received_cb (EmpathyTpChat *tp_chat,
+ EmpathyMessage *message,
+ EmpathyStatusIcon *icon)
+{
+ EmpathyContact *sender;
+ gchar *msg;
+ StatusIconEvent *event;
+
+ empathy_debug (DEBUG_DOMAIN, "Message received, add event");
+
+ g_signal_handlers_disconnect_by_func (tp_chat,
+ status_icon_message_received_cb,
+ icon);
+
+ sender = empathy_message_get_sender (message);
msg = g_strdup_printf (_("New message from %s:\n%s"),
empathy_contact_get_name (sender),
- empathy_message_get_body (messages->data));
+ empathy_message_get_body (message));
- g_object_set_data (G_OBJECT (tp_chat), "filter", filter);
event = status_icon_event_new (icon, EMPATHY_IMAGE_NEW_MESSAGE, msg);
event->func = status_icon_event_msg_cb;
event->user_data = tp_chat;
-
- g_list_foreach (messages, (GFunc) g_object_unref, NULL);
- g_list_free (messages);
}
static void