Mercurial > pidgin.yaz
changeset 32400:4ba344c46349
merge of '08d226d73f31ff54304b484070031adbae481095'
and '6a3d408df0ce6d4a341eaf1bc512dcc35660ed0c'
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 24 Aug 2011 03:16:23 +0000 |
parents | f83dc631c73b (current diff) 307e851bc3a1 (diff) |
children | 56ef2369f330 |
files | |
diffstat | 17 files changed, 314 insertions(+), 162 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Wed Aug 24 03:09:22 2011 +0000 +++ b/ChangeLog.API Wed Aug 24 03:16:23 2011 +0000 @@ -8,6 +8,13 @@ * purple_notify_user_info_prepend_pair_plaintext * purple_request_field_set_tooltip * purple_request_field_get_tooltip + * purple_roomlist_get_account + * purple_roomlist_get_proto_data + * purple_roomlist_get_ui_data + * purple_roomlist_room_get_expanded_once + * purple_roomlist_room_set_expanded_once + * purple_roomlist_set_proto_data + * purple_roomlist_set_ui_data Changed: * purple_connection_error now takes a PurpleConnectionError @@ -65,6 +72,9 @@ * PurpleConnectionUiOps.report_disconnect_reason * struct _GtkIMHtmlFontDetail * struct _PurpleRequestField + * struct _PurpleRoomlist + * struct _PurpleRoomlistField + * struct _PurpleRoomlistRoom version 2.10.0: libpurple:
--- a/finch/gntroomlist.c Wed Aug 24 03:09:22 2011 +0000 +++ b/finch/gntroomlist.c Wed Aug 24 03:16:23 2011 +0000 @@ -41,6 +41,12 @@ #define PREF_ROOT "/finch/roomlist" +#undef FINCH_GET_DATA +#undef FINCH_SET_DATA +#define FINCH_GET_DATA(obj) purple_roomlist_get_ui_data(obj) +#define FINCH_SET_DATA(obj, data) purple_roomlist_set_ui_data(obj, data) + + /* Yes, just one roomlist at a time. Let's not get greedy. Aight? */ struct _FinchRoomlist { @@ -146,9 +152,9 @@ purple_roomlist_room_join(froomlist.roomlist, room); break; case PURPLE_ROOMLIST_ROOMTYPE_CATEGORY: - if (!room->expanded_once) { + if (!purple_roomlist_room_get_expanded_once(room)) { purple_roomlist_expand_category(froomlist.roomlist, room); - room->expanded_once = TRUE; + purple_roomlist_room_set_expanded_once(room, TRUE); } break; }
--- a/libpurple/protocols/irc/irc.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/irc/irc.c Wed Aug 24 03:16:23 2011 +0000 @@ -890,7 +890,8 @@ static void irc_roomlist_cancel(PurpleRoomlist *list) { - PurpleConnection *gc = purple_account_get_connection(list->account); + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *gc = purple_account_get_connection(account); struct irc_conn *irc; if (gc == NULL)
--- a/libpurple/protocols/jabber/chat.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/jabber/chat.c Wed Aug 24 03:16:23 2011 +0000 @@ -887,8 +887,8 @@ char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room) { - - return g_strdup_printf("%s@%s", (char*)room->fields->data, (char*)room->fields->next->data); + GList *fields = purple_roomlist_room_get_fields(room); + return g_strdup_printf("%s@%s", (char*)fields->data, (char*)fields->next->data); } PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) @@ -928,10 +928,12 @@ void jabber_roomlist_cancel(PurpleRoomlist *list) { + PurpleAccount *account; PurpleConnection *gc; JabberStream *js; - gc = purple_account_get_connection(list->account); + account = purple_roomlist_get_account(list); + gc = purple_account_get_connection(account); js = gc->proto_data; purple_roomlist_set_in_progress(list, FALSE);
--- a/libpurple/protocols/mxit/actions.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/actions.c Wed Aug 24 03:16:23 2011 +0000 @@ -43,7 +43,7 @@ */ static void mxit_profile_cb( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ) ; PurpleRequestField* field = NULL; const char* name = NULL; const char* bday = NULL; @@ -200,7 +200,7 @@ static void mxit_profile_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct MXitProfile* profile = session->profile; PurpleRequestFields* fields = NULL; @@ -297,7 +297,7 @@ */ static void mxit_change_pin_cb( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* pin = NULL; const char* pin2 = NULL; const char* err = NULL; @@ -359,7 +359,7 @@ static void mxit_change_pin_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleRequestFields* fields = NULL; PurpleRequestFieldGroup* group = NULL; @@ -395,7 +395,7 @@ static void mxit_splash_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); if ( splash_current( session ) != NULL ) splash_display( session ); @@ -432,7 +432,7 @@ static void mxit_suggested_friends_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, @@ -449,7 +449,7 @@ */ static void mxit_user_search_cb( PurpleConnection *gc, const char *input ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR,
--- a/libpurple/protocols/mxit/filexfer.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/filexfer.c Wed Aug 24 03:16:23 2011 +0000 @@ -126,7 +126,7 @@ if ( purple_xfer_get_size( xfer ) > CP_MAX_FILESIZE ) { /* the file is too big */ - purple_xfer_error( xfer->type, xfer->account, xfer->who, _( "The file you are trying to send is too large!" ) ); + purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "The file you are trying to send is too large!" ) ); purple_xfer_cancel_local( xfer ); return; } @@ -151,6 +151,7 @@ */ static void mxit_xfer_start( PurpleXfer* xfer ) { + size_t filesize; unsigned char* buffer; int size; int wrote; @@ -163,10 +164,12 @@ * a buffer and copy the file data into memory and then we can send it to * the contact. we will send the whole file with one go. */ - buffer = g_malloc( xfer->bytes_remaining ); - size = fread( buffer, xfer->bytes_remaining, 1, xfer->dest_fp ); + filesize = purple_xfer_get_bytes_remaining( xfer ); + buffer = g_malloc( filesize ); + size = fread( buffer, filesize, 1, xfer->dest_fp ); + // TODO: If (size != 1) -> file read error - wrote = purple_xfer_write( xfer, buffer, xfer->bytes_remaining ); + wrote = purple_xfer_write( xfer, buffer, filesize ); if ( wrote > 0 ) purple_xfer_set_bytes_sent( xfer, wrote ); @@ -295,7 +298,7 @@ */ PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleXfer* xfer = NULL; struct mxitxfer* mx = NULL; @@ -395,7 +398,7 @@ while ( item ) { xfer = item->data; - if ( xfer->account == session->acc ) { + if ( purple_xfer_get_account( xfer ) == session->acc ) { /* transfer is associated with this MXit account */ struct mxitxfer* mx = xfer->data; @@ -437,6 +440,7 @@ purple_xfer_ref( xfer ); purple_xfer_start( xfer, -1, NULL, 0 ); fwrite( data, datalen, 1, xfer->dest_fp ); + // TODO: Handle error from fwrite() purple_xfer_unref( xfer ); purple_xfer_set_completed( xfer, TRUE ); purple_xfer_end( xfer );
--- a/libpurple/protocols/mxit/login.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/login.c Wed Aug 24 03:16:23 2011 +0000 @@ -49,8 +49,8 @@ */ static struct MXitSession* mxit_create_object( PurpleAccount* account ) { + PurpleConnection* con = purple_account_get_connection( account ); struct MXitSession* session = NULL; - PurpleConnection* con = NULL; /* currently the wapsite does not handle a '+' in front of the username (mxitid) so we just strip it */ if ( account->username[0] == '+' ) { @@ -63,15 +63,12 @@ } session = g_new0( struct MXitSession, 1 ); + session->con = con; + session->acc = account; /* configure the connection (reference: "libpurple/connection.h") */ - con = purple_account_get_connection( account ); - con->proto_data = session; + purple_connection_set_protocol_data( con, session ); con->flags |= PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_SUPPORT_MOODS; - session->con = con; - - /* add account */ - session->acc = account; /* configure the session (reference: "libpurple/account.h") */ g_strlcpy( session->server, purple_account_get_string( account, MXIT_CONFIG_SERVER_ADDR, DEFAULT_SERVER ), sizeof( session->server ) ); @@ -221,7 +218,7 @@ */ static void mxit_cb_register_ok( PurpleConnection *gc, PurpleRequestFields *fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct MXitProfile* profile = session->profile; const char* str; const char* pin; @@ -303,7 +300,7 @@ purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_register_cancel\n" ); /* disconnect */ - purple_account_disconnect( gc->account ); + purple_account_disconnect( purple_connection_get_account( gc ) ); } @@ -507,7 +504,7 @@ */ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleUtilFetchUrlData* url_data; PurpleRequestField* field; const char* captcha_resp; @@ -571,7 +568,7 @@ */ static void mxit_cb_captcha_cancel( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* free up the login resources */ free_logindata( session->logindata );
--- a/libpurple/protocols/mxit/multimx.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/multimx.c Wed Aug 24 03:16:23 2011 +0000 @@ -458,7 +458,7 @@ */ void mxit_chat_join(PurpleConnection *gc, GHashTable *components) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* roomname = NULL; struct multimx* multimx = NULL; @@ -500,7 +500,7 @@ */ void mxit_chat_reject(PurpleConnection *gc, GHashTable* components) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* roomname = NULL; struct multimx* multimx = NULL; @@ -543,7 +543,7 @@ */ void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *username) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; PurpleBuddy* buddy; PurpleConversation *convo; @@ -589,7 +589,7 @@ */ void mxit_chat_leave(PurpleConnection *gc, int id) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i leave\n", id); @@ -620,7 +620,7 @@ */ int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; const char* nickname;
--- a/libpurple/protocols/mxit/mxit.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/mxit.c Wed Aug 24 03:16:23 2011 +0000 @@ -58,7 +58,7 @@ static void* mxit_link_click( const char* link64 ) { PurpleAccount* account; - PurpleConnection* con; + PurpleConnection* gc; gchar** parts = NULL; gchar* link = NULL; gsize len; @@ -91,15 +91,15 @@ account = purple_accounts_find( parts[1], parts[2] ); if ( !account ) goto skip; - con = purple_account_get_connection( account ); - if ( !con ) + gc = purple_account_get_connection( account ); + if ( !gc ) goto skip; /* determine if it's a command-response to send */ is_command = ( atoi( parts[4] ) == 1 ); /* send click message back to MXit */ - mxit_send_message( con->proto_data, parts[3], parts[5], FALSE, is_command ); + mxit_send_message( purple_connection_get_protocol_data( gc ), parts[3], parts[5], FALSE, is_command ); g_free( link ); link = NULL; @@ -370,7 +370,7 @@ */ static void mxit_close( PurpleConnection* gc ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* disable signals */ mxit_disable_signals( session ); @@ -406,7 +406,7 @@ { purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who ); - mxit_send_message( gc->proto_data, who, message, TRUE, FALSE ); + mxit_send_message( purple_connection_get_protocol_data( gc ), who, message, TRUE, FALSE ); return 1; /* echo to conversation window */ } @@ -420,7 +420,7 @@ */ static void mxit_set_status( PurpleAccount* account, PurpleStatus* status ) { - struct MXitSession* session = purple_account_get_connection( account )->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( purple_account_get_connection( account ) ); const char* statusid; int presence; char* statusmsg1; @@ -513,7 +513,7 @@ */ static void mxit_keepalive( PurpleConnection *gc ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* if not logged in, there is nothing to do */ if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) @@ -541,7 +541,7 @@ */ static void mxit_set_buddy_icon( PurpleConnection *gc, PurpleStoredImage *img ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); if ( img == NULL ) mxit_set_avatar( session, NULL, 0 ); @@ -560,7 +560,7 @@ { PurpleBuddy* buddy; struct contact* contact; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_LASTSEEN, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME }; @@ -611,13 +611,10 @@ static void mxit_reinvite( PurpleBlistNode *node, gpointer ignored ) { PurpleBuddy* buddy = (PurpleBuddy *) node; - PurpleConnection* gc; - struct MXitSession* session; + PurpleConnection* gc = purple_account_get_connection( purple_buddy_get_account( buddy ) ); + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct contact* contact; - gc = purple_account_get_connection( purple_buddy_get_account( buddy ) ); - session = gc->proto_data; - contact = purple_buddy_get_protocol_data( (PurpleBuddy*) node ); if ( !contact ) return;
--- a/libpurple/protocols/mxit/roster.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/roster.c Wed Aug 24 03:16:23 2011 +0000 @@ -293,14 +293,15 @@ */ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, PurpleBuddy* buddy, PurpleGroup* group ) { - struct contact* contact = NULL; PurpleGroup* current_group = purple_buddy_get_group( buddy ); - PurpleBuddy* newbuddy = NULL; /* make sure the groups actually differs */ if ( strcmp( current_group->name, group->name ) != 0 ) { /* groupnames does not match, so we need to make the update */ + struct contact* contact = purple_buddy_get_protocol_data( buddy ); + PurpleBuddy* newbuddy = NULL; + purple_debug_info( MXIT_PLUGIN_ID, "Moving '%s' from group '%s' to '%s'\n", buddy->alias, current_group->name, group->name ); /* @@ -310,10 +311,10 @@ * again. This is really not ideal and very irritating, but how else then? */ - /* create new buddy */ + /* create new buddy, and transfer 'contact' data */ newbuddy = purple_buddy_new( session->acc, buddy->name, buddy->alias ); - newbuddy->proto_data = buddy->proto_data; - buddy->proto_data = NULL; + purple_buddy_set_protocol_data( newbuddy, contact ); + purple_buddy_set_protocol_data( buddy, NULL ); /* remove the buddy */ purple_blist_remove_buddy( buddy ); @@ -322,7 +323,6 @@ purple_blist_add_buddy( newbuddy, NULL, group, NULL ); /* now re-instate his presence again */ - contact = newbuddy->proto_data; if ( contact ) { /* update the buddy's status (reference: "libpurple/prpl.h") */ @@ -396,7 +396,7 @@ /* create new buddy */ buddy = purple_buddy_new( session->acc, contact->username, contact->alias ); - purple_buddy_set_protocol_data(buddy, contact); + purple_buddy_set_protocol_data( buddy, contact ); /* add new buddy to list */ purple_blist_add_buddy( buddy, NULL, group, NULL ); @@ -728,7 +728,7 @@ */ void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group, const char* message ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); GSList* list = NULL; PurpleBuddy* mxbuddy = NULL; unsigned int i; @@ -804,7 +804,7 @@ */ void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const gchar * buddy_name = purple_buddy_get_name( buddy ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_remove_buddy '%s'\n", buddy_name ); @@ -822,7 +822,7 @@ */ void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; PurpleGroup* group = NULL; @@ -856,7 +856,7 @@ */ void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; purple_debug_info( MXIT_PLUGIN_ID, "mxit_buddy_group from '%s' to '%s'\n", old_group, new_group ); @@ -883,7 +883,7 @@ */ void mxit_rename_group( PurpleConnection* gc, const char* old_name, PurpleGroup* group, GList* moved_buddies ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; GList* item = NULL;
--- a/libpurple/protocols/mxit/splashscreen.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/splashscreen.c Wed Aug 24 03:16:23 2011 +0000 @@ -144,7 +144,7 @@ */ static void splash_click_ok(PurpleConnection* gc, PurpleRequestFields* fields) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* splashId; /* Get current splash ID */
--- a/libpurple/protocols/mxit/voicevideo.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/mxit/voicevideo.c Wed Aug 24 03:16:23 2011 +0000 @@ -63,7 +63,7 @@ */ PurpleMediaCaps mxit_media_caps(PurpleAccount *account, const char *who) { - struct MXitSession* session = purple_account_get_connection(account)->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(purple_account_get_connection(account)); PurpleBuddy* buddy; struct contact* contact; PurpleMediaCaps capa = PURPLE_MEDIA_CAPS_NONE;
--- a/libpurple/protocols/silc/chat.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/silc/chat.c Wed Aug 24 03:16:23 2011 +0000 @@ -1419,7 +1419,8 @@ void silcpurple_roomlist_cancel(PurpleRoomlist *list) { - PurpleConnection *gc = purple_account_get_connection(list->account); + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *gc = purple_account_get_connection(account); SilcPurple sg; if (!gc)
--- a/libpurple/protocols/yahoo/yahoochat.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/protocols/yahoo/yahoochat.c Wed Aug 24 03:16:23 2011 +0000 @@ -1375,7 +1375,9 @@ purple_roomlist_set_in_progress(list, FALSE); if (yrl) { - list->proto_data = g_list_remove(list->proto_data, yrl); + GList *proto_data = purple_roomlist_get_proto_data(list); + proto_data = g_list_remove(proto_data, yrl); + purple_roomlist_set_proto_data(list, proto_data); yahoo_roomlist_destroy(yrl); } @@ -1451,7 +1453,7 @@ yrl->inpa = 0; g_free(yrl->txbuf); yrl->txbuf = NULL; - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); + purple_notify_error(purple_account_get_connection(purple_roomlist_get_account(list)), NULL, _("Unable to connect"), _("Fetching the room list failed.")); yahoo_roomlist_cleanup(list, yrl); return; } @@ -1474,10 +1476,12 @@ { struct yahoo_roomlist *yrl = data; PurpleRoomlist *list = yrl->list; - YahooData *yd = purple_account_get_connection(list->account)->proto_data; + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *pc = purple_account_get_connection(account); + YahooData *yd = pc->proto_data; if (source < 0) { - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); + purple_notify_error(pc, NULL, _("Unable to connect"), _("Fetching the room list failed.")); yahoo_roomlist_cleanup(list, yrl); return; } @@ -1506,6 +1510,7 @@ struct yahoo_roomlist *yrl; const char *rll, *rlurl; char *url; + GList *proto_data; account = purple_connection_get_account(gc); @@ -1556,7 +1561,9 @@ return NULL; } - rl->proto_data = g_list_append(rl->proto_data, yrl); + proto_data = purple_roomlist_get_proto_data(rl); + proto_data = g_list_append(proto_data, yrl); + purple_roomlist_set_proto_data(rl, proto_data); purple_roomlist_set_in_progress(rl, TRUE); return rl; @@ -1566,8 +1573,8 @@ { GList *l, *k; - k = l = list->proto_data; - list->proto_data = NULL; + k = l = purple_roomlist_get_proto_data(list); + purple_roomlist_set_proto_data(list, NULL); purple_roomlist_set_in_progress(list, FALSE); @@ -1580,36 +1587,42 @@ void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) { + PurpleAccount *account; struct yahoo_roomlist *yrl; char *url; char *id; const char *rll; + GList *proto_data; - if (category->type != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) + if (purple_roomlist_room_get_type(category) != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) return; - if (!(id = g_list_nth_data(category->fields, 1))) { + if (!(id = g_list_nth_data(purple_roomlist_room_get_fields(category), 1))) { purple_roomlist_set_in_progress(list, FALSE); return; } - rll = purple_account_get_string(list->account, "room_list_locale", + account = purple_roomlist_get_account(list); + rll = purple_account_get_string(account, "room_list_locale", YAHOO_ROOMLIST_LOCALE); if (rll != NULL && *rll != '\0') { url = g_strdup_printf("%s?chatroom_%s=0&intl=%s", - purple_account_get_string(list->account,"room_list", + purple_account_get_string(account,"room_list", YAHOO_ROOMLIST_URL), id, rll); } else { url = g_strdup_printf("%s?chatroom_%s=0", - purple_account_get_string(list->account,"room_list", + purple_account_get_string(account,"room_list", YAHOO_ROOMLIST_URL), id); } yrl = g_new0(struct yahoo_roomlist, 1); yrl->list = list; yrl->cat = category; - list->proto_data = g_list_append(list->proto_data, yrl); + + proto_data = purple_roomlist_get_proto_data(list); + proto_data = g_list_append(proto_data, yrl); + purple_roomlist_set_proto_data(list, proto_data); purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); g_free(url); @@ -1617,11 +1630,11 @@ yrl->ucat = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat); purple_roomlist_room_add(list, yrl->ucat); - if (purple_proxy_connect(purple_account_get_connection(list->account), - list->account, yrl->host, 80, + if (purple_proxy_connect(purple_account_get_connection(account), + account, yrl->host, 80, yahoo_roomlist_got_connected, yrl) == NULL) { - purple_notify_error(purple_account_get_connection(list->account), + purple_notify_error(purple_account_get_connection(account), NULL, _("Connection problem"), _("Unable to fetch room list.")); purple_roomlist_ref(list); yahoo_roomlist_cleanup(list, yrl);
--- a/libpurple/roomlist.c Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/roomlist.c Wed Aug 24 03:16:23 2011 +0000 @@ -32,6 +32,39 @@ #include "roomlist.h" #include "server.h" +/** + * Represents a list of rooms for a given connection on a given protocol. + */ +struct _PurpleRoomlist { + PurpleAccount *account; /**< The account this list belongs to. */ + GList *fields; /**< The fields. */ + GList *rooms; /**< The list of rooms. */ + gboolean in_progress; /**< The listing is in progress. */ + gpointer ui_data; /**< UI private data. */ + gpointer proto_data; /** Prpl private data. */ + guint ref; /**< The reference count. */ +}; + +/** + * Represents a room. + */ +struct _PurpleRoomlistRoom { + PurpleRoomlistRoomType type; /**< The type of room. */ + gchar *name; /**< The name of the room. */ + GList *fields; /**< Other fields. */ + PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ + gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ +}; + +/** + * A field a room might have. + */ +struct _PurpleRoomlistField { + PurpleRoomlistFieldType type; /**< The type of field. */ + gchar *label; /**< The i18n user displayed name of the field. */ + gchar *name; /**< The internal name of the field. */ + gboolean hidden; /**< Hidden? */ +}; static PurpleRoomlistUiOps *ops = NULL; @@ -127,6 +160,13 @@ purple_roomlist_destroy(list); } +PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->account; +} + void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) { g_return_if_fail(list != NULL); @@ -234,6 +274,34 @@ return list->fields; } +gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->proto_data; +} + +void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data) +{ + g_return_if_fail(list != NULL); + + list->proto_data = proto_data; +} + +gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->ui_data; +} + +void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data) +{ + g_return_if_fail(list != NULL); + + list->ui_data = ui_data; +} + /*@}*/ /**************************************************************************/ @@ -329,7 +397,21 @@ return room->parent; } -GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) +gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room) +{ + g_return_val_if_fail(room != NULL, NULL); + + return room->expanded_once; +} + +void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once) +{ + g_return_val_if_fail(room != NULL, NULL); + + room->expanded_once = expanded_once; +} + +GList *purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) { return room->fields; }
--- a/libpurple/roomlist.h Wed Aug 24 03:09:22 2011 +0000 +++ b/libpurple/roomlist.h Wed Aug 24 03:16:23 2011 +0000 @@ -64,40 +64,6 @@ /**************************************************************************/ /** - * Represents a list of rooms for a given connection on a given protocol. - */ -struct _PurpleRoomlist { - PurpleAccount *account; /**< The account this list belongs to. */ - GList *fields; /**< The fields. */ - GList *rooms; /**< The list of rooms. */ - gboolean in_progress; /**< The listing is in progress. */ - gpointer ui_data; /**< UI private data. */ - gpointer proto_data; /** Prpl private data. */ - guint ref; /**< The reference count. */ -}; - -/** - * Represents a room. - */ -struct _PurpleRoomlistRoom { - PurpleRoomlistRoomType type; /**< The type of room. */ - gchar *name; /**< The name of the room. */ - GList *fields; /**< Other fields. */ - PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ - gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ -}; - -/** - * A field a room might have. - */ -struct _PurpleRoomlistField { - PurpleRoomlistFieldType type; /**< The type of field. */ - gchar *label; /**< The i18n user displayed name of the field. */ - gchar *name; /**< The internal name of the field. */ - gboolean hidden; /**< Hidden? */ -}; - -/** * The room list ops to be filled out by the UI. */ struct _PurpleRoomlistUiOps { @@ -163,6 +129,14 @@ void purple_roomlist_unref(PurpleRoomlist *list); /** + * Retrieve the PurpleAccount that was given when the room list was + * created. + * + * @return The PurpleAccount tied to this room list. + */ +PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list); + +/** * Set the different field types and their names for this protocol. * * This must be called before purple_roomlist_room_add(). @@ -241,11 +215,49 @@ /** * Get the list of fields for a roomlist. * - * @param roomlist The roomlist, which must not be @c NULL. + * @param roomlist The roomlist, which must not be @c NULL. * @constreturn A list of fields * @since 2.4.0 */ -GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist); +GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist); + +/** + * Get the protocol data associated with this room list. + * + * @param roomlist The roomlist, which must not be @c NULL. + * + * @return The protocol data associated with this room list. This is a + * convenience field provided to the protocol plugin--it is not + * used the libuprple core. + */ +gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list); + +/** + * Set the protocol data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * @param proto_data A pointer to associate with this room list. + */ +void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data); + +/** + * Get the UI data associated with this room list. + * + * @param roomlist The roomlist, which must not be @c NULL. + * + * @return The UI data associated with this room list. This is a + * convenience field provided to the UIs--it is not + * used by the libuprple core. + */ +gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list); + +/** + * Set the UI data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * @param UI_data A pointer to associate with this room list. + */ +void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data); /*@}*/ @@ -308,6 +320,23 @@ PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); /** + * Get the value of the expanded_once flag. + * + * @param room The room, which must not be @c NULL. + * + * @return The value of the expanded_once flag. + */ +gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room); + +/** + * Set the expanded_once flag. + * + * @param room The room, which must not be @c NULL. + * @param expanded_once The new value of the expanded_once flag. + */ +void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once); + +/** * Get the list of fields for a room. * * @param room The room, which must not be @c NULL.
--- a/pidgin/gtkroomlist.c Wed Aug 24 03:09:22 2011 +0000 +++ b/pidgin/gtkroomlist.c Wed Aug 24 03:16:23 2011 +0000 @@ -91,7 +91,7 @@ purple_timeout_remove(dialog->pg_update_to); if (dialog->roomlist) { - PidginRoomlist *rl = dialog->roomlist->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); if (dialog->pg_update_to > 0) /* yes, that's right, unref it twice. */ @@ -115,7 +115,7 @@ dialog->account = account; if (change && dialog->roomlist) { - PidginRoomlist *rl = dialog->roomlist->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); if (rl->tree) { gtk_widget_destroy(rl->tree); rl->tree = NULL; @@ -135,7 +135,7 @@ return; if (dialog->roomlist != NULL) { - rl = dialog->roomlist->ui_data; + rl = purple_roomlist_get_ui_data(dialog->roomlist); gtk_widget_destroy(rl->tree); purple_roomlist_unref(dialog->roomlist); } @@ -144,7 +144,7 @@ if (!dialog->roomlist) return; purple_roomlist_ref(dialog->roomlist); - rl = dialog->roomlist->ui_data; + rl = purple_roomlist_get_ui_data(dialog->roomlist); rl->dialog = dialog; if (dialog->account_widget) @@ -203,7 +203,7 @@ val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { gtk_widget_set_sensitive(dialog->join_button, FALSE); gtk_widget_set_sensitive(dialog->add_button, FALSE); return; @@ -228,7 +228,8 @@ static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) { char *name; - PurpleConnection *gc = purple_account_get_connection(info->list->account); + PurpleAccount *account = purple_roomlist_get_account(info->list); + PurpleConnection *gc = purple_account_get_connection(account); PurplePluginProtocolInfo *prpl_info = NULL; if(gc != NULL) @@ -237,9 +238,9 @@ if(prpl_info != NULL && prpl_info->roomlist_room_serialize) name = prpl_info->roomlist_room_serialize(info->room); else - name = g_strdup(info->room->name); + name = g_strdup(purple_roomlist_room_get_name(info->room)); - purple_blist_request_add_chat(info->list->account, NULL, NULL, name); + purple_blist_request_add_chat(account, NULL, NULL, name); g_free(name); } @@ -247,7 +248,7 @@ static void add_room_to_blist_cb(GtkButton *button, PidginRoomlistDialog *dialog) { PurpleRoomlist *rl = dialog->roomlist; - PidginRoomlist *grl = rl->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); if(info != NULL) @@ -262,7 +263,7 @@ static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) { PurpleRoomlist *rl = dialog->roomlist; - PidginRoomlist *grl = rl->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); if(info != NULL) @@ -272,7 +273,7 @@ static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2, PurpleRoomlist *list) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GtkTreeIter iter; PurpleRoomlistRoom *room; GValue val; @@ -282,7 +283,7 @@ val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return; info.list = list; @@ -294,7 +295,7 @@ static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomlist *list) { GtkTreePath *path; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GValue val; PurpleRoomlistRoom *room; GtkTreeIter iter; @@ -313,7 +314,7 @@ gtk_tree_model_get_value (GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return FALSE; info.list = list; @@ -341,9 +342,9 @@ gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val); category = g_value_get_pointer(&val); - if (!category->expanded_once) { + if (!purple_roomlist_room_get_expanded_once(category)) { purple_roomlist_expand_category(list, category); - category->expanded_once = TRUE; + purple_roomlist_room_set_expanded_once(category, TRUE); } } @@ -354,7 +355,7 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) { PurpleRoomlist *list = user_data; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GtkStyle *style; int current_height, max_width; int max_text_width; @@ -393,7 +394,7 @@ static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *path) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); PurpleRoomlistRoom *room; GtkTreeIter iter; GValue val; @@ -414,19 +415,23 @@ gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return FALSE; tooltip_text = g_string_new(""); gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, NAME_COLUMN, &name, -1); - for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { + for (j = NUM_OF_COLUMNS, + l = purple_roomlist_room_get_fields(room), + k = purple_roomlist_get_fields(list); + l && k; j++, l = l->next, k = k->next) + { PurpleRoomlistField *f = k->data; gchar *label; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; - label = g_markup_escape_text(f->label, -1); - switch (f->type) { + label = g_markup_escape_text(purple_roomlist_field_get_label(f), -1); + switch (purple_roomlist_field_get_type(f)) { case PURPLE_ROOMLIST_FIELD_BOOL: g_string_append_printf(tooltip_text, "%s<b>%s:</b> %s", first ? "" : "\n", label, l->data ? "True" : "False"); break; @@ -478,7 +483,7 @@ gpointer data, int *w, int *h) { PurpleRoomlist *list = data; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); grl->tipwindow = widget; if (!pidgin_roomlist_create_tip(data, path)) return FALSE; @@ -622,7 +627,7 @@ { PidginRoomlist *rl = g_new0(PidginRoomlist, 1); - list->ui_data = rl; + purple_roomlist_set_ui_data(list, rl); rl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free); @@ -685,7 +690,7 @@ static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); gint columns = NUM_OF_COLUMNS; int j; GtkTreeStore *model; @@ -707,7 +712,7 @@ for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { PurpleRoomlistField *f = l->data; - switch (f->type) { + switch (purple_roomlist_field_get_type(f)) { case PURPLE_ROOMLIST_FIELD_BOOL: types[j] = G_TYPE_BOOLEAN; break; @@ -749,18 +754,19 @@ for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { PurpleRoomlistField *f = l->data; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(f->label, renderer, - "text", j, NULL); + column = gtk_tree_view_column_new_with_attributes( + purple_roomlist_field_get_label(f), renderer, + "text", j, NULL); gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), j); gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); - if (f->type == PURPLE_ROOMLIST_FIELD_INT) { + if (purple_roomlist_field_get_type(f) == PURPLE_ROOMLIST_FIELD_INT) { gtk_tree_view_column_set_cell_data_func(column, renderer, int_cell_data_func, GINT_TO_POINTER(j), NULL); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), j, int_sort_func, @@ -789,7 +795,7 @@ static gboolean pidgin_progress_bar_pulse(gpointer data) { PurpleRoomlist *list = data; - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) { if (rl && rl->dialog) @@ -805,7 +811,7 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); GtkTreeRowReference *rr, *parentrr = NULL; GtkTreePath *path; GtkTreeIter iter, parent, child; @@ -814,7 +820,7 @@ gboolean append = TRUE; rl->total_rooms++; - if (room->type == PURPLE_ROOMLIST_ROOMTYPE_ROOM) + if (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_ROOM) rl->num_rooms++; if (rl->dialog) { @@ -826,8 +832,8 @@ rl->dialog->pg_needs_pulse = TRUE; } - if (room->parent) { - parentrr = g_hash_table_lookup(rl->cats, room->parent); + if (purple_roomlist_room_get_parent(room)) { + parentrr = g_hash_table_lookup(rl->cats, purple_roomlist_room_get_parent(room)); path = gtk_tree_row_reference_get_path(parentrr); if (path) { PurpleRoomlistRoom *tmproom = NULL; @@ -848,24 +854,28 @@ else iter = child; - if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) + if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) gtk_tree_store_append(rl->model, &child, &iter); path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter); - if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { + if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path); g_hash_table_insert(rl->cats, room, rr); } gtk_tree_path_free(path); - gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1); + gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, purple_roomlist_room_get_name(room), -1); gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1); - for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { + for (j = NUM_OF_COLUMNS, + l = purple_roomlist_room_get_fields(room), + k = purple_roomlist_get_fields(list); + l && k; j++, l = l->next, k = k->next) + { PurpleRoomlistField *f = k->data; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; gtk_tree_store_set(rl->model, &iter, j, l->data, -1); } @@ -873,7 +883,7 @@ static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progress) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); if (!rl || !rl->dialog) return; @@ -895,7 +905,7 @@ static void pidgin_roomlist_destroy(PurpleRoomlist *list) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); roomlists = g_list_remove(roomlists, list); @@ -903,7 +913,7 @@ g_hash_table_destroy(rl->cats); g_free(rl); - list->ui_data = NULL; + purple_roomlist_set_ui_data(list, NULL); } static PurpleRoomlistUiOps ops = {