Thu, 11 Jul 2013 21:59:34 +0530
Refactored protocols to use the initial GObject connection API.
* Renamed PurpleConnection's private member buddy_chats to active_chats
* Added purple_connection_get_active_chats()
* Disabled bits of jabber protocol that use members of connection in a way it shouldn't
I will have to revisit these to find proper alternatives.
--- a/libpurple/connection.c Thu Jul 11 04:16:01 2013 +0530 +++ b/libpurple/connection.c Thu Jul 11 21:59:34 2013 +0530 @@ -60,7 +60,7 @@ PurpleAccount *account; /**< The account being connected to. */ char *password; /**< The password used. */ - GSList *buddy_chats; /**< A list of active chats + GSList *active_chats; /**< A list of active chats (#PurpleChatConversation structs). */ void *proto_data; /**< Protocol-specific data. TODO Remove this, and use
--- a/libpurple/connection.h Thu Jul 11 04:16:01 2013 +0530 +++ b/libpurple/connection.h Thu Jul 11 21:59:34 2013 +0530 @@ -362,6 +362,15 @@ const char *purple_connection_get_password(const PurpleConnection *gc); /** + * Returns a list of active chat conversations on a connection. + * + * @param gc The connection. + * + * @return The active chats on the connection. + */ +GSList *purple_connection_get_active_chats(const PurpleConnection *gc); + +/** * Returns the connection's displayed name. * * @param gc The connection.
--- a/libpurple/plugins/perl/common/Connection.xs Thu Jul 11 04:16:01 2013 +0530 +++ b/libpurple/plugins/perl/common/Connection.xs Thu Jul 11 21:59:34 2013 +0530 @@ -26,6 +26,16 @@ purple_connection_get_password(gc) Purple::Connection gc +void +purple_connection_get_active_chats(gc) + Purple::Connection gc +PREINIT: + GSList *l; +PPCODE: + for (l = purple_connection_get_active_chats(gc); l != NULL; l = l->next) { + XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ChatConversation"))); + } + const char * purple_connection_get_display_name(gc) Purple::Connection gc
--- a/libpurple/protocols/irc/msgs.c Thu Jul 11 04:16:01 2013 +0530 +++ b/libpurple/protocols/irc/msgs.c Thu Jul 11 21:59:34 2013 +0530 @@ -1130,7 +1130,7 @@ g_free(nick); return; } - chats = gc->buddy_chats; + chats = purple_connection_get_active_chats(gc); if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) { purple_connection_set_display_name(gc, args[0]); @@ -1400,7 +1400,8 @@ data[0] = irc_mask_nick(from); data[1] = args[0]; /* XXX this should have an API, I shouldn't grab this directly */ - g_slist_foreach(gc->buddy_chats, (GFunc)irc_chat_remove_buddy, data); + g_slist_foreach(purple_connection_get_active_chats(gc), + (GFunc)irc_chat_remove_buddy, data); if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) { ib->new_online_status = FALSE;
--- a/libpurple/protocols/jabber/jabber.c Thu Jul 11 04:16:01 2013 +0530 +++ b/libpurple/protocols/jabber/jabber.c Thu Jul 11 21:59:34 2013 +0530 @@ -1377,7 +1377,10 @@ g_free(href); if(js->registration) { +#warning Is this (gc->wants_to_die) required here? If so, an alternative needed. +#if 0 js->gc->wants_to_die = TRUE; +#endif /* succeeded, but we have no login info */ purple_account_register_completed(account, TRUE); jabber_connection_schedule_close(js);
--- a/libpurple/protocols/jabber/parser.c Thu Jul 11 04:16:01 2013 +0530 +++ b/libpurple/protocols/jabber/parser.c Thu Jul 11 21:59:34 2013 +0530 @@ -308,7 +308,10 @@ } if (js->protocol_version.major == 0 && js->protocol_version.minor == 9 && +#warning Is this (gc->disconnect_timeout) required here? If so, an alternative is needed. +#if 0 !js->gc->disconnect_timeout && +#endif (js->state == JABBER_STREAM_INITIALIZING || js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION)) { /*