Mercurial > pidgin
changeset 31487:cfb5364a0381
The MultMX server now always sends "You have been kicked." when you are
kicked from a room. Therefore comparing the nickname being kicked with our
original nickname is no longer necessary.
author | andrew.victor@mxit.com |
---|---|
date | Mon, 21 Mar 2011 20:52:40 +0000 |
parents | 249ffc44061e |
children | df716c39f698 |
files | libpurple/protocols/mxit/multimx.c |
diffstat | 1 files changed, 29 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/mxit/multimx.c Mon Mar 21 19:40:36 2011 +0000 +++ b/libpurple/protocols/mxit/multimx.c Mon Mar 21 20:52:40 2011 +0000 @@ -239,16 +239,31 @@ return; } - /* who was kicked? - compare to our original nickname */ - if (purple_utf8_strcasecmp(nickname, multimx->nickname) == 0) - { - /* you were kicked */ - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "MXit", _("You have been kicked from this MultiMX."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_clear_users(PURPLE_CONV_CHAT(convo)); - serv_got_chat_left(session->con, multimx->chatid); + purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nickname, _("was kicked")); +} + + +/*------------------------------------------------------------------------ + * You were kicked from the GroupChat. + * + * @param session The MXit session object + * @param multimx The MultiMX room object + */ +static void you_kicked(struct MXitSession* session, struct multimx* multimx) +{ + PurpleConversation *convo; + + purple_debug_info(MXIT_PLUGIN_ID, "you_kicked\n"); + + convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc); + if (convo == NULL) { + purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname); + return; } - else - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nickname, _("was kicked")); + + purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "MXit", _("You have been kicked from this MultiMX."), PURPLE_MESSAGE_SYSTEM, time(NULL)); + purple_conv_chat_clear_users(PURPLE_CONV_CHAT(convo)); + serv_got_chat_left(session->con, multimx->chatid); } @@ -421,6 +436,11 @@ member_kicked(mx->session, multimx, msg); mx->processed = TRUE; } + else if (strcmp(msg, "You have been kicked.") == 0) { + /* You have been kicked */ + you_kicked(mx->session, multimx); + mx->processed = TRUE; + } else if (g_str_has_prefix(msg, "The following users are in this MultiMx:") == TRUE) { member_update(mx->session, multimx, msg + strlen("The following users are in this MultiMx:") + 1); mx->processed = TRUE;