/soc/2013/ankitkv/gobjectification: c1981c52befb: Do nothing if ...
Ankit Vani
a at nevitus.org
Sun Dec 1 12:49:05 EST 2013
Changeset: c1981c52befb0819868abac7b2e0ff3756c45b7e
Author: Ankit Vani <a at nevitus.org>
Date: 2013-12-01 23:05 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/c1981c52befb
Description:
Do nothing if serv_got_chat_in, serv_got_chat_left are called with non-existant chat ID
diffstat:
libpurple/server.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diffs (43 lines):
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -842,11 +842,15 @@ void serv_got_chat_left(PurpleConnection
PurpleChatConversation *chat = NULL;
for (bcs = purple_connection_get_active_chats(g); bcs != NULL; bcs = bcs->next) {
- chat = PURPLE_CHAT_CONVERSATION(bcs->data);
+ if (purple_chat_conversation_get_id(
+ PURPLE_CHAT_CONVERSATION(bcs->data)) == id) {
+ chat = (PurpleChatConversation *)bcs->data;
+ break;
+ }
+ }
- if (purple_chat_conversation_get_id(chat) == id)
- break;
- }
+ if (!chat)
+ return;
purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n",
purple_conversation_get_name(PURPLE_CONVERSATION(chat)));
@@ -876,11 +880,15 @@ void serv_got_chat_in(PurpleConnection *
g_return_if_fail(message != NULL);
for (bcs = purple_connection_get_active_chats(g); bcs != NULL; bcs = bcs->next) {
- chat = PURPLE_CHAT_CONVERSATION(bcs->data);
+ if (purple_chat_conversation_get_id(
+ PURPLE_CHAT_CONVERSATION(bcs->data)) == id) {
+ chat = (PurpleChatConversation *)bcs->data;
+ break;
+ }
+ }
- if (purple_chat_conversation_get_id(chat) == id)
- break;
- }
+ if (!chat)
+ return;
/* Did I send the message? */
if (purple_strequal(purple_chat_conversation_get_nick(chat),
More information about the Commits
mailing list