Mercurial > pidgin.yaz
diff pidgin/gtkconv.c @ 28781:71dc3b5edbe7
Rejoin an opened chat after an account reconnects.
Previously, we used to rejoin an open chat only if the account was
disconnected due to an error. But now, the chat rooms will be rejoined
even if we disconnected manually.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 21 Oct 2009 23:26:41 +0000 |
parents | 20b7a51166c3 |
children | e7bb163434c7 |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Tue Oct 20 21:20:22 2009 +0000 +++ b/pidgin/gtkconv.c Wed Oct 21 23:26:41 2009 +0000 @@ -4277,7 +4277,7 @@ /* Users */ for (; l != NULL; l = l->next) { tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, - &matches, TRUE, ((PurpleConvChatBuddy *)l->data)->name); + &matches, FALSE, ((PurpleConvChatBuddy *)l->data)->name); } @@ -7601,6 +7601,26 @@ } } +static void +account_signing_off(PurpleConnection *gc) +{ + GList *list = purple_get_chats(); + + /* We are about to sign off. See which chats we are currently in, and mark + * them for rejoin on reconnect. */ + while (list) { + PurpleConversation *conv = list->data; + if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { + purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE)); + purple_conversation_write(conv, NULL, _("The account has disconnected and you are no " + "longer in this chat. You will be automatically rejoined in the chat when " + "the account reconnects."), + PURPLE_MESSAGE_SYSTEM, time(NULL)); + } + list = list->next; + } +} + static gboolean update_buddy_status_timeout(PurpleBuddy *buddy) { @@ -8095,6 +8115,8 @@ purple_signal_connect(purple_connections_get_handle(), "signed-off", handle, G_CALLBACK(account_signed_off_cb), GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE)); + purple_signal_connect(purple_connections_get_handle(), "signing-off", handle, + G_CALLBACK(account_signing_off), NULL); purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", handle, G_CALLBACK(received_im_msg_cb), NULL);