diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-06-18 04:10:08 +0800 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2009-06-18 18:14:24 +0800 |
commit | 17fb8fcf2f5cb1b535815dcabdc790b04969e6d5 (patch) | |
tree | fa523a20af8401434c93ab333f5abf62f24f33c6 /libempathy-gtk | |
parent | bc08d45ad3b44b7ba7b5b0044f538338d2a6553e (diff) | |
download | gsoc2013-empathy-17fb8fcf2f5cb1b535815dcabdc790b04969e6d5.tar gsoc2013-empathy-17fb8fcf2f5cb1b535815dcabdc790b04969e6d5.tar.gz gsoc2013-empathy-17fb8fcf2f5cb1b535815dcabdc790b04969e6d5.tar.bz2 gsoc2013-empathy-17fb8fcf2f5cb1b535815dcabdc790b04969e6d5.tar.lz gsoc2013-empathy-17fb8fcf2f5cb1b535815dcabdc790b04969e6d5.tar.xz gsoc2013-empathy-17fb8fcf2f5cb1b535815dcabdc790b04969e6d5.tar.zst gsoc2013-empathy-17fb8fcf2f5cb1b535815dcabdc790b04969e6d5.zip |
Return early from chat_members_changed_cb
This avoids the function marching to the right quite so much.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 85 |
1 files changed, 43 insertions, 42 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index e327b27d7..44f37a868 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1163,54 +1163,55 @@ chat_members_changed_cb (EmpathyTpChat *tp_chat, EmpathyChat *chat) { EmpathyChatPriv *priv = GET_PRIV (chat); + const gchar *name = empathy_contact_get_name (contact); + gchar *str; - if (priv->block_events_timeout_id == 0) { - const gchar *name = empathy_contact_get_name (contact); - gchar *str; + if (priv->block_events_timeout_id != 0) + return; + + if (is_member) { + str = g_strdup_printf (_("%s has joined the room"), + name); + } else { + const gchar *action; + + if (EMP_STR_EMPTY (message)) { + switch (reason) { + case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE: + action = _("%s has disconnected"); + break; + case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED: + action = _("%s was kicked"); + break; + case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED: + action = _("%s was banned"); + break; + default: + action = _("%s has left the room"); + } - if (is_member) { - str = g_strdup_printf (_("%s has joined the room"), - name); + str = g_strdup_printf (action, name); } else { - const gchar *action; - - if (EMP_STR_EMPTY (message)) { - switch (reason) { - case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE: - action = _("%s has disconnected"); - break; - case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED: - action = _("%s was kicked"); - break; - case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED: - action = _("%s was banned"); - break; - default: - action = _("%s has left the room"); - } - - str = g_strdup_printf (action, name); - } else { - switch (reason) { - case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE: - action = _("%s has disconnected (%s)"); - break; - case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED: - action = _("%s was kicked (%s)"); - break; - case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED: - action = _("%s was banned (%s)"); - break; - default: - action = _("%s has left the room (%s)"); - } - - str = g_strdup_printf (action, name, message); + switch (reason) { + case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE: + action = _("%s has disconnected (%s)"); + break; + case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED: + action = _("%s was kicked (%s)"); + break; + case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED: + action = _("%s was banned (%s)"); + break; + default: + action = _("%s has left the room (%s)"); } + + str = g_strdup_printf (action, name, message); } - empathy_chat_view_append_event (chat->view, str); - g_free (str); } + + empathy_chat_view_append_event (chat->view, str); + g_free (str); } static gboolean |