aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-02-16 17:22:52 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-02-16 17:22:52 +0800
commit04462d2c6fbcbde891ec2a0d10cec540110517c7 (patch)
tree495581b0245cc1b454937326f63d277db56050d1 /libempathy-gtk/empathy-chat.c
parent542c9b73402e30b9d07ae19055babf0eb767366b (diff)
downloadgsoc2013-empathy-04462d2c6fbcbde891ec2a0d10cec540110517c7.tar
gsoc2013-empathy-04462d2c6fbcbde891ec2a0d10cec540110517c7.tar.gz
gsoc2013-empathy-04462d2c6fbcbde891ec2a0d10cec540110517c7.tar.bz2
gsoc2013-empathy-04462d2c6fbcbde891ec2a0d10cec540110517c7.tar.lz
gsoc2013-empathy-04462d2c6fbcbde891ec2a0d10cec540110517c7.tar.xz
gsoc2013-empathy-04462d2c6fbcbde891ec2a0d10cec540110517c7.tar.zst
gsoc2013-empathy-04462d2c6fbcbde891ec2a0d10cec540110517c7.zip
Block events messages when the chat is connecting to a new Text channel. Fixes bug #507515 and #516198.
svn path=/trunk/; revision=641
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index f7c013820..a568db03b 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -80,6 +80,7 @@ struct _EmpathyChatPriv {
gboolean first_tp_chat;
time_t last_log_timestamp;
gboolean is_first_char;
+ guint block_events_timeout_id;
/* Used to automatically shrink a window that has temporarily
* grown due to long input.
*/
@@ -414,6 +415,10 @@ chat_finalize (GObject *object)
g_source_remove (priv->scroll_idle_id);
}
+ if (priv->block_events_timeout_id) {
+ g_source_remove (priv->block_events_timeout_id);
+ }
+
g_free (priv->id);
G_OBJECT_CLASS (empathy_chat_parent_class)->finalize (object);
@@ -1439,6 +1444,18 @@ empathy_chat_load_geometry (EmpathyChat *chat,
empathy_geometry_load (empathy_chat_get_id (chat), x, y, w, h);
}
+static gboolean
+chat_block_events_timeout_cb (gpointer data)
+{
+ EmpathyChat *chat = EMPATHY_CHAT (data);
+ EmpathyChatPriv *priv = GET_PRIV (chat);
+
+ chat->block_events = FALSE;
+ priv->block_events_timeout_id = 0;
+
+ return FALSE;
+}
+
void
empathy_chat_set_tp_chat (EmpathyChat *chat,
EmpathyTpChat *tp_chat)
@@ -1455,6 +1472,15 @@ empathy_chat_set_tp_chat (EmpathyChat *chat,
return;
}
+ /* Block events for some time to avoid having "has come online" or
+ * "joined" messages. */
+ chat->block_events = TRUE;
+ if (priv->block_events_timeout_id != 0) {
+ g_source_remove (priv->block_events_timeout_id);
+ }
+ priv->block_events_timeout_id =
+ g_timeout_add_seconds (1, chat_block_events_timeout_cb, chat);
+
if (priv->tp_chat) {
g_signal_handlers_disconnect_by_func (priv->tp_chat,
chat_message_received_cb,