# HG changeset patch # User Sadrul Habib Chowdhury # Date 1225441305 0 # Node ID da46097b472260a0a7033b5b838c61183bc65a41 # Parent de22f550bae24c693b599daa4a6926f84c3128a7# Parent 5ace6c0242302c09a1d67a8b9b67b4445497a28c propagate from branch 'local.struct.hiding' (head da9fb6ccb9b3d723d8abdfaae8859bae223cf225) to branch 'local.next.minor' (head bd7ae6d940b09aa836bd22be2c6c5b22bfbf4312) diff -r de22f550bae2 -r da46097b4722 configure.ac --- a/configure.ac Fri Oct 31 08:09:31 2008 +0000 +++ b/configure.ac Fri Oct 31 08:21:45 2008 +0000 @@ -1143,6 +1143,7 @@ AC_ARG_ENABLE(fortify, [AC_HELP_STRING([--disable-fortify], [compile without FORTIFY_SOURCE support])], , enable_fortify=yes) +DEBUG_CFLAGS="$DEBUG_CFLAGS -DPURPLE_DISABLE_DEPRECATED -DPIDGIN_DISABLE_DEPRECATED -DFINCH_DISABLE_DEPRECATED -DGNT_DISABLE_DEPRECATED" if test "x$GCC" = "xyes"; then dnl We enable -Wall later. dnl If it's set after the warning CFLAGS in the compiler invocation, it counteracts the -Wno... flags. diff -r de22f550bae2 -r da46097b4722 libpurple/account.c --- a/libpurple/account.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/account.c Fri Oct 31 08:21:45 2008 +0000 @@ -1035,7 +1035,7 @@ purple_debug_info("account", "Registering account %s\n", purple_account_get_username(account)); - purple_connection_new(account, TRUE, purple_account_get_password(account)); + _purple_connection_new(account, TRUE, purple_account_get_password(account)); } void @@ -1046,7 +1046,7 @@ purple_debug_info("account", "Unregistering account %s\n", purple_account_get_username(account)); - purple_connection_new_unregister(account, purple_account_get_password(account), cb, user_data); + _purple_connection_new_unregister(account, purple_account_get_password(account), cb, user_data); } static void @@ -1069,7 +1069,7 @@ purple_account_set_password(account, entry); - purple_connection_new(account, FALSE, entry); + _purple_connection_new(account, FALSE, entry); } static void @@ -1155,7 +1155,7 @@ !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) purple_account_request_password(account, G_CALLBACK(request_password_ok_cb), G_CALLBACK(request_password_cancel_cb), account); else - purple_connection_new(account, FALSE, password); + _purple_connection_new(account, FALSE, password); } void @@ -1171,7 +1171,7 @@ account->disconnecting = TRUE; gc = purple_account_get_connection(account); - purple_connection_destroy(gc); + _purple_connection_destroy(gc); if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); purple_account_set_connection(account, NULL); diff -r de22f550bae2 -r da46097b4722 libpurple/blist.c --- a/libpurple/blist.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/blist.c Fri Oct 31 08:21:45 2008 +0000 @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ -#define PURPLE_BLIST_STRUCTS +#define _PURPLE_BLIST_C_ #include "internal.h" #include "blist.h" @@ -447,7 +447,7 @@ purple_blist_get_last_child((PurpleBlistNode*)group)); if ((alias = xmlnode_get_attrib(cnode, "alias"))) { - purple_contact_set_alias(contact, alias); + purple_blist_alias_contact(contact, alias); } for (x = cnode->child; x; x = x->next) { @@ -836,13 +836,11 @@ ops->update(purplebuddylist, node); } -#ifndef PURPLE_DISABLE_DEPRECATED void purple_blist_update_buddy_icon(PurpleBuddy *buddy) { purple_blist_update_node_icon((PurpleBlistNode *)buddy); } -#endif /* * TODO: Maybe remove the call to this from server.c and call it diff -r de22f550bae2 -r da46097b4722 libpurple/blist.h --- a/libpurple/blist.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/blist.h Fri Oct 31 08:21:45 2008 +0000 @@ -89,7 +89,7 @@ /* Data Structures */ /**************************************************************************/ -#if !(defined PURPLE_HIDE_STRUCTS) || (defined PURPLE_BLIST_STRUCTS) +#if !(defined PURPLE_HIDE_STRUCTS) || (defined _PURPLE_BLIST_C_) /** * A Buddy list node. This can represent a group, a buddy, or anything else. @@ -335,7 +335,7 @@ */ void purple_blist_update_node_icon(PurpleBlistNode *node); -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) /** * Updates a buddy's icon. * @@ -587,7 +587,7 @@ */ PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact); -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) /** * Sets the alias for a contact. * diff -r de22f550bae2 -r da46097b4722 libpurple/buddyicon.c --- a/libpurple/buddyicon.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/buddyicon.c Fri Oct 31 08:21:45 2008 +0000 @@ -23,6 +23,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#define _PURPLE_BUDDYICON_C_ + #include "internal.h" #include "buddyicon.h" #include "conversation.h" @@ -954,7 +956,6 @@ return purple_buddy_icons_node_set_custom_icon(node, data, len); } -#ifndef PURPLE_DISABLE_DEPRECATED gboolean purple_buddy_icons_has_custom_icon(PurpleContact *contact) { @@ -973,7 +974,6 @@ { return purple_buddy_icons_node_set_custom_icon((PurpleBlistNode*)contact, icon_data, icon_len); } -#endif void _purple_buddy_icon_set_old_icons_dir(const char *dirname) diff -r de22f550bae2 -r da46097b4722 libpurple/buddyicon.h --- a/libpurple/buddyicon.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/buddyicon.h Fri Oct 31 08:21:45 2008 +0000 @@ -337,7 +337,7 @@ purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, const gchar *filename); -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BUDDYICON_C_) /** * PurpleContact version of purple_buddy_icons_node_has_custom_icon. * diff -r de22f550bae2 -r da46097b4722 libpurple/connection.c --- a/libpurple/connection.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/connection.c Fri Oct 31 08:21:45 2008 +0000 @@ -23,6 +23,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#define _PURPLE_CONNECTION_C_ + #include "internal.h" #include "account.h" #include "blist.h" @@ -99,6 +101,12 @@ void purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) { + _purple_connection_new(account, regist, password); +} + +void +_purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) +{ PurpleConnection *gc; PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info; @@ -170,9 +178,14 @@ prpl_info->login(account); } } +void +purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) +{ + _purple_connection_new_unregister(account, password, cb, user_data); +} void -purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) +_purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) { /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when posssible. */ PurpleConnection *gc; @@ -230,6 +243,12 @@ void purple_connection_destroy(PurpleConnection *gc) { + _purple_connection_destroy(gc); +} + +void +_purple_connection_destroy(PurpleConnection *gc) +{ PurpleAccount *account; GSList *buddies; PurplePluginProtocolInfo *prpl_info = NULL; diff -r de22f550bae2 -r da46097b4722 libpurple/connection.h --- a/libpurple/connection.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/connection.h Fri Oct 31 08:21:45 2008 +0000 @@ -268,7 +268,7 @@ /**************************************************************************/ /*@{*/ -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) /** * This function should only be called by purple_account_connect() * in account.c. If you're trying to sign on an account, use that @@ -292,7 +292,7 @@ const char *password); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) /** * This function should only be called by purple_account_unregister() * in account.c. @@ -310,7 +310,7 @@ void purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) /** * Disconnects and destroys a PurpleConnection. * diff -r de22f550bae2 -r da46097b4722 libpurple/dbus-server.c --- a/libpurple/dbus-server.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/dbus-server.c Fri Oct 31 08:21:45 2008 +0000 @@ -29,6 +29,10 @@ #include #include +/* Allow the code below to see deprecated functions, so we can continue to + * export them via DBus. */ +#undef PURPLE_DISABLE_DEPRECATED + #include "account.h" #include "blist.h" #include "conversation.h" diff -r de22f550bae2 -r da46097b4722 libpurple/internal.h --- a/libpurple/internal.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/internal.h Fri Oct 31 08:21:45 2008 +0000 @@ -231,6 +231,12 @@ #define PURPLE_WEBSITE "http://pidgin.im/" #define PURPLE_DEVEL_WEBSITE "http://developer.pidgin.im/" + +/* INTERNAL FUNCTIONS */ + +#include "account.h" +#include "connection.h" + /* This is for the accounts code to notify the buddy icon code that * it's done loading. We may want to replace this with a signal. */ void @@ -247,4 +253,48 @@ void _purple_buddy_icon_set_old_icons_dir(const char *dirname); +/** + * Creates a connection to the specified account and either connects + * or attempts to register a new account. If you are logging in, + * the connection uses the current active status for this account. + * So if you want to sign on as "away," for example, you need to + * have called purple_account_set_status(account, "away"). + * (And this will call purple_account_connect() automatically). + * + * @note This function should only be called by purple_account_connect() + * in account.c. If you're trying to sign on an account, use that + * function instead. + * + * @param account The account the connection should be connecting to. + * @param regist Whether we are registering a new account or just + * trying to do a normal signon. + * @param password The password to use. + */ +void _purple_connection_new(PurpleAccount *account, gboolean regist, + const char *password); +/** + * Tries to unregister the account on the server. If the account is not + * connected, also creates a new connection. + * + * @note This function should only be called by purple_account_unregister() + * in account.c. + * + * @param account The account to unregister + * @param password The password to use. + * @param cb Optional callback to be called when unregistration is complete + * @param user_data user data to pass to the callback + */ +void _purple_connection_new_unregister(PurpleAccount *account, const char *password, + PurpleAccountUnregistrationCb cb, void *user_data); +/** + * Disconnects and destroys a PurpleConnection. + * + * @note This function should only be called by purple_account_disconnect() + * in account.c. If you're trying to sign off an account, use that + * function instead. + * + * @param gc The purple connection to destroy. + */ +void _purple_connection_destroy(PurpleConnection *gc); + #endif /* _PURPLE_INTERNAL_H_ */ diff -r de22f550bae2 -r da46097b4722 libpurple/network.h --- a/libpurple/network.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/network.h Fri Oct 31 08:21:45 2008 +0000 @@ -106,7 +106,6 @@ */ const char *purple_network_get_my_ip(int fd); -#ifndef PURPLE_DISABLE_DEPRECATED /** * Should calls to purple_network_listen() and purple_network_listen_range() * map the port externally using NAT-PMP or UPnP? @@ -118,7 +117,6 @@ * @since 2.3.0 */ void purple_network_listen_map_external(gboolean map_external); -#endif /** * Attempts to open a listening port ONLY on the specified port number. @@ -203,11 +201,9 @@ unsigned short purple_network_get_port_from_fd(int fd); /** - * Detects if there is an available Internet connection. Note that this call - * could block for the amount of time specified in inet_detect_timeout, so - * using it in a UI thread may cause uncomfortableness + * Detects if there is an available network connection. * - * @return TRUE if the Internet is available + * @return TRUE if the network is available */ gboolean purple_network_is_available(void); diff -r de22f550bae2 -r da46097b4722 libpurple/notify.c --- a/libpurple/notify.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/notify.c Fri Oct 31 08:21:45 2008 +0000 @@ -23,6 +23,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#define _PURPLE_NOTIFY_C_ + #include "internal.h" #include "dbus-maybe.h" #include "notify.h" diff -r de22f550bae2 -r da46097b4722 libpurple/notify.h --- a/libpurple/notify.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/notify.h Fri Oct 31 08:21:45 2008 +0000 @@ -289,7 +289,7 @@ */ void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, GList *row); -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) /** * Returns a number of the rows in the search results object. * @@ -310,7 +310,7 @@ guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) /** * Returns a number of the columns in the search results object. * @@ -331,7 +331,7 @@ guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) /** * Returns a row of the results from the search results object. * @@ -354,7 +354,7 @@ unsigned int row_id); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) /** * Returns a title of the search results object's column. * diff -r de22f550bae2 -r da46097b4722 libpurple/plugin.c --- a/libpurple/plugin.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/plugin.c Fri Oct 31 08:21:45 2008 +0000 @@ -19,6 +19,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#define _PURPLE_PLUGIN_C_ + #include "internal.h" #include "accountopt.h" diff -r de22f550bae2 -r da46097b4722 libpurple/plugin.h --- a/libpurple/plugin.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/plugin.h Fri Oct 31 08:21:45 2008 +0000 @@ -533,7 +533,7 @@ */ gboolean purple_plugins_enabled(void); -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) /** * Registers a function that will be called when probing is finished. * @@ -544,7 +544,7 @@ void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) /** * Unregisters a function that would be called when probing is finished. * @@ -554,7 +554,7 @@ void purple_plugins_unregister_probe_notify_cb(void (*func)(void *)); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) /** * Registers a function that will be called when a plugin is loaded. * @@ -566,7 +566,7 @@ void *data); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) /** * Unregisters a function that would be called when a plugin is loaded. * @@ -576,7 +576,7 @@ void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) /** * Registers a function that will be called when a plugin is unloaded. * @@ -588,7 +588,7 @@ void *data); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) /** * Unregisters a function that would be called when a plugin is unloaded. * diff -r de22f550bae2 -r da46097b4722 libpurple/plugins/perl/common/BuddyList.xs --- a/libpurple/plugins/perl/common/BuddyList.xs Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/plugins/perl/common/BuddyList.xs Fri Oct 31 08:21:45 2008 +0000 @@ -1,3 +1,4 @@ +#undef PURPLE_DISABLE_DEPRECATED #include "module.h" #include "../perl-handlers.h" diff -r de22f550bae2 -r da46097b4722 libpurple/plugins/perl/common/module.h --- a/libpurple/plugins/perl/common/module.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/plugins/perl/common/module.h Fri Oct 31 08:21:45 2008 +0000 @@ -1,4 +1,6 @@ - +/* Allow the Perl code to see deprecated functions, so we can continue to + * export them to Perl plugins. */ +#undef PURPLE_DISABLE_DEPRECATED typedef struct group *Purple__Group; diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/bonjour/bonjour.c diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/bonjour/bonjour_ft.c diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/bonjour/buddy.c --- a/libpurple/protocols/bonjour/buddy.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/bonjour/buddy.c Fri Oct 31 08:21:45 2008 +0000 @@ -157,8 +157,8 @@ purple_blist_add_buddy(buddy, NULL, group, NULL); } + name = purple_buddy_get_name(buddy); purple_buddy_set_protocol_data(buddy, bonjour_buddy); - name = purple_buddy_get_name(buddy); /* Create the alias for the buddy using the first and the last name */ if (bonjour_buddy->nick) diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/bonjour/jabber.c diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/gg/buddylist.c --- a/libpurple/protocols/gg/buddylist.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/gg/buddylist.c Fri Oct 31 08:21:45 2008 +0000 @@ -65,7 +65,6 @@ bnode != NULL; bnode = purple_blist_node_get_sibling_next(bnode)) { - PurpleAccount *ba = NULL; const gchar *name = NULL; if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) @@ -73,7 +72,7 @@ buddy = (PurpleBuddy *)bnode; - if ((ba = purple_buddy_get_account(buddy)) != account) + if (purple_buddy_get_account(buddy) != account) continue; name = purple_buddy_get_name(buddy); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/gg/gg.c --- a/libpurple/protocols/gg/gg.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/gg/gg.c Fri Oct 31 08:21:45 2008 +0000 @@ -421,7 +421,7 @@ */ /* Need to disconnect or actually log in. For now, we disconnect. */ - purple_connection_destroy(gc); + purple_account_disconnect(account); exit_err: if(account->registration_cb) @@ -446,7 +446,7 @@ GGPInfo *info = gc->proto_data; GGPToken *token = info->token; - purple_connection_destroy(gc); + purple_account_disconnect(gc->account); g_free(token->id); g_free(token->data); @@ -1907,7 +1907,7 @@ { PurpleAccount *account; GGPInfo *info = gc->proto_data; - const gchar *name = purple_buddy_get_name(buddy); + const char *name = purple_buddy_get_name(buddy); gg_add_notify(info->session, ggp_str_to_uin(name)); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/irc/msgs.c --- a/libpurple/protocols/irc/msgs.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/irc/msgs.c Fri Oct 31 08:21:45 2008 +0000 @@ -79,6 +79,7 @@ PurpleConnection *gc; PurpleStatus *status; PurpleBlistNode *gnode, *cnode, *bnode; + PurpleAccount *account; if ((gc = purple_account_get_connection(irc->account)) == NULL || PURPLE_CONNECTION_IS_CONNECTED(gc)) @@ -86,6 +87,7 @@ purple_connection_set_display_name(gc, nick); purple_connection_set_state(gc, PURPLE_CONNECTED); + account = purple_connection_get_account(gc); /* If we're away then set our away message */ status = purple_account_get_active_status(irc->account); @@ -115,7 +117,7 @@ if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if(purple_buddy_get_account(b) == gc->account) { + if(purple_buddy_get_account(b) == account) { struct irc_buddy *ib = g_new0(struct irc_buddy, 1); ib->name = g_strdup(purple_buddy_get_name(b)); g_hash_table_insert(irc->buddies, ib->name, ib); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/jabber/adhoccommands.c --- a/libpurple/protocols/jabber/adhoccommands.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/jabber/adhoccommands.c Fri Oct 31 08:21:45 2008 +0000 @@ -211,8 +211,9 @@ if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { JabberAdHocCommands *cmd = data; PurpleBuddy *buddy = (PurpleBuddy *) node; - JabberStream *js = purple_account_get_connection(buddy->account)->proto_data; - + PurpleAccount *account = purple_buddy_get_account(buddy); + JabberStream *js = purple_account_get_connection(account)->proto_data; + jabber_adhoc_execute(js, cmd); } } diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/jabber/buddy.c diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/jabber/google.c diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Oct 31 08:21:45 2008 +0000 @@ -1479,13 +1479,14 @@ { JabberStream *js; JabberBuddy *jb = NULL; + PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); - if(!b->account->gc) + if(!gc) return NULL; - js = b->account->gc->proto_data; + js = gc->proto_data; if(js) - jb = jabber_buddy_find(js, b->name, FALSE); + jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); if(!PURPLE_BUDDY_IS_ONLINE(b)) { if(jb && (jb->subscription & JABBER_SUB_PENDING || @@ -1499,9 +1500,11 @@ { char *ret = NULL; JabberBuddy *jb = NULL; - - if (b->account->gc && b->account->gc->proto_data) - jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE); + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + + if (gc && gc->proto_data) + jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { ret = g_strdup(_("Not Authorized")); @@ -1530,14 +1533,19 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { JabberBuddy *jb; + PurpleAccount *account; + PurpleConnection *gc; g_return_if_fail(b != NULL); - g_return_if_fail(b->account != NULL); - g_return_if_fail(b->account->gc != NULL); - g_return_if_fail(b->account->gc->proto_data != NULL); + + account = purple_buddy_get_account(b); + g_return_if_fail(account != NULL); - jb = jabber_buddy_find(b->account->gc->proto_data, b->name, - FALSE); + gc = purple_account_get_connection(account); + g_return_if_fail(gc != NULL); + g_return_if_fail(gc->proto_data != NULL); + + jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); if(jb) { JabberBuddyResource *jbr = NULL; @@ -1873,19 +1881,21 @@ if(!(jid = jabber_id_new(name))) return NULL; - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { for(cnode = gnode->child; cnode; cnode = cnode->next) { PurpleChat *chat = (PurpleChat*)cnode; const char *room, *server; + GHashTable *components; if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) continue; - if(chat->account != account) + if (purple_chat_get_account(chat) != account) continue; - if(!(room = g_hash_table_lookup(chat->components, "room"))) + components = purple_chat_get_components(chat); + if(!(room = g_hash_table_lookup(components, "room"))) continue; - if(!(server = g_hash_table_lookup(chat->components, "server"))) + if(!(server = g_hash_table_lookup(components, "server"))) continue; if(jid->node && jid->domain && diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/jabber/roster.c --- a/libpurple/protocols/jabber/roster.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/jabber/roster.c Fri Oct 31 08:21:45 2008 +0000 @@ -80,7 +80,7 @@ buddies = g_slist_remove(buddies, b); - if((l = g_slist_find_custom(g2, g->name, (GCompareFunc)strcmp))) { + if((l = g_slist_find_custom(g2, purple_group_get_name(g), (GCompareFunc)strcmp))) { const char *servernick; /* Previously stored serverside / buddy-supplied alias */ @@ -119,11 +119,13 @@ /* If we just learned about ourself, then fake our status, * because we won't be receiving a normal presence message * about ourself. */ - if(!strcmp(b->name, my_bare_jid)) { + if(!strcmp(purple_buddy_get_name(b), my_bare_jid)) { PurplePresence *gpresence; PurpleStatus *status; + PurpleAccount *account; - gpresence = purple_account_get_presence(js->gc->account); + account = purple_connection_get_account(js->gc); + gpresence = purple_account_get_presence(account); status = purple_presence_get_active_status(gpresence); jabber_presence_fake_to_self(js, status); } @@ -289,7 +291,7 @@ while(buddies) { b = buddies->data; g = purple_buddy_get_group(b); - groups = g_slist_append(groups, g->name); + groups = g_slist_append(groups, (char *)purple_group_get_name(g)); buddies = g_slist_remove(buddies, b); } } @@ -327,14 +329,16 @@ JabberBuddy *jb; JabberBuddyResource *jbr; char *my_bare_jid; + const char *name; if(!js->roster_parsed) return; - if(!(who = jabber_get_bare_jid(buddy->name))) + name = purple_buddy_get_name(buddy); + if(!(who = jabber_get_bare_jid(name))) return; - jb = jabber_buddy_find(js, buddy->name, FALSE); + jb = jabber_buddy_find(js, name, FALSE); jabber_roster_update(js, who, NULL); @@ -375,6 +379,7 @@ GSList *buddies, *groups = NULL; PurpleBuddy *b; PurpleGroup *g; + const char *gname; if(!old_group || !new_group || !strcmp(old_group, new_group)) return; @@ -383,10 +388,11 @@ while(buddies) { b = buddies->data; g = purple_buddy_get_group(b); - if(!strcmp(g->name, old_group)) + gname = purple_group_get_name(g); + if(!strcmp(gname, old_group)) groups = g_slist_append(groups, (char*)new_group); /* ick */ else - groups = g_slist_append(groups, g->name); + groups = g_slist_append(groups, (char*)gname); buddies = g_slist_remove(buddies, b); } jabber_roster_update(gc->proto_data, name, groups); @@ -397,15 +403,17 @@ PurpleGroup *group, GList *moved_buddies) { GList *l; + const char *gname = purple_group_get_name(group); for(l = moved_buddies; l; l = l->next) { PurpleBuddy *buddy = l->data; - jabber_roster_group_change(gc, buddy->name, old_name, group->name); + jabber_roster_group_change(gc, purple_buddy_get_name(buddy), old_name, gname); } } void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - GSList *buddies = purple_find_buddies(gc->account, buddy->name); + const char *name = purple_buddy_get_name(buddy); + GSList *buddies = purple_find_buddies(purple_connection_get_account(gc), name); buddies = g_slist_remove(buddies, buddy); if(buddies != NULL) { @@ -416,11 +424,11 @@ while(buddies) { tmpbuddy = buddies->data; tmpgroup = purple_buddy_get_group(tmpbuddy); - groups = g_slist_append(groups, tmpgroup->name); + groups = g_slist_append(groups, (char *)purple_group_get_name(tmpgroup)); buddies = g_slist_remove(buddies, tmpbuddy); } - jabber_roster_update(gc->proto_data, buddy->name, groups); + jabber_roster_update(gc->proto_data, name, groups); g_slist_free(groups); } else { JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET, @@ -428,7 +436,7 @@ xmlnode *query = xmlnode_get_child(iq->node, "query"); xmlnode *item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", buddy->name); + xmlnode_set_attrib(item, "jid", name); xmlnode_set_attrib(item, "subscription", "remove"); jabber_iq_send(iq); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Fri Oct 31 08:21:45 2008 +0000 @@ -460,23 +460,27 @@ PurpleConnection *gc; MsnSession *session; MsnMobileData *data; + PurpleAccount *account; + const char *name; g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); + name = purple_buddy_get_name(buddy); session = gc->proto_data; data = g_new0(MsnMobileData, 1); data->gc = gc; - data->passport = buddy->name; + data->passport = name; purple_request_input(gc, NULL, _("Send a mobile message."), NULL, NULL, TRUE, FALSE, NULL, _("Page"), G_CALLBACK(send_to_mobile_cb), _("Close"), G_CALLBACK(close_mobile_page_cb), - purple_connection_get_account(gc), purple_buddy_get_name(buddy), NULL, + account, name, NULL, data); } @@ -508,6 +512,7 @@ { PurpleBuddy *buddy; PurpleConnection *gc; + PurpleAccount *account; MsnSession *session; MsnSwitchBoard *swboard; @@ -517,13 +522,14 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); session = gc->proto_data; swboard = msn_switchboard_new(session); msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, buddy->name); + msn_switchboard_request_add_user(swboard, purple_buddy_get_name(buddy)); /* TODO: This might move somewhere else, after USR might be */ swboard->chat_id = msn_switchboard_get_chat_id(); @@ -531,9 +537,9 @@ swboard->flag = MSN_SB_FLAG_IM; /* Local alias > Display name > Username */ - if ((alias = purple_account_get_alias(buddy->account)) == NULL) + if ((alias = purple_account_get_alias(account)) == NULL) if ((alias = purple_connection_get_display_name(gc)) == NULL) - alias = purple_account_get_username(buddy->account); + alias = purple_account_get_username(account); purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), alias, NULL, PURPLE_CBFLAGS_NONE, TRUE); @@ -926,8 +932,8 @@ } } - if (g_ascii_strcasecmp(buddy->name, - purple_account_get_username(buddy->account))) + if (g_ascii_strcasecmp(purple_buddy_get_name(buddy), + purple_account_get_username(purple_buddy_get_account(buddy)))) { act = purple_menu_action_new(_("Initiate _Chat"), PURPLE_CALLBACK(initiate_chat_cb), @@ -1392,13 +1398,14 @@ { MsnSession *session; MsnUserList *userlist; - const char *who; + const char *who, *gname; session = gc->proto_data; userlist = session->userlist; - who = msn_normalize(gc->account, buddy->name); - - purple_debug_info("msn", "Add user:%s to group:%s\n", who, (group && group->name) ? group->name : "(null)"); + who = msn_normalize(purple_connection_get_account(gc), purple_buddy_get_name(buddy)); + + gname = group ? purple_group_get_name(group) : NULL; + purple_debug_info("msn", "Add user:%s to group:%s\n", who, gname ? gname : "(null)"); if (!session->logged_in) { #if 0 @@ -1432,7 +1439,7 @@ /* XXX - Would group ever be NULL here? I don't think so... * shx: Yes it should; MSN handles non-grouped buddies, and this is only * internal. */ - msn_userlist_add_buddy(userlist, who, group ? group->name : NULL); + msn_userlist_add_buddy(userlist, who, gname); } static void @@ -1448,7 +1455,7 @@ return; /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ - msn_userlist_rem_buddy(userlist, buddy->name); + msn_userlist_rem_buddy(userlist, purple_buddy_get_name(buddy)); } static void @@ -1701,20 +1708,22 @@ PurpleGroup *group, GList *moved_buddies) { MsnSession *session; + const char *gname; session = gc->proto_data; g_return_if_fail(session != NULL); g_return_if_fail(session->userlist != NULL); + gname = purple_group_get_name(group); if (msn_userlist_find_group_with_name(session->userlist, old_name) != NULL) { - msn_contact_rename_group(session, old_name, group->name); + msn_contact_rename_group(session, old_name, gname); } else { /* not found */ - msn_add_group(session, NULL, group->name); + msn_add_group(session, NULL, gname); } } @@ -1774,20 +1783,22 @@ { MsnSession *session; MsnCmdProc *cmdproc; + const char *gname; session = gc->proto_data; cmdproc = session->notification->cmdproc; - - purple_debug_info("msn", "Remove group %s\n", group->name); + gname = purple_group_get_name(group); + + purple_debug_info("msn", "Remove group %s\n", gname); /*we can't delete the default group*/ - if(!strcmp(group->name, MSN_INDIVIDUALS_GROUP_NAME)|| - !strcmp(group->name, MSN_NON_IM_GROUP_NAME)) + if(!strcmp(gname, MSN_INDIVIDUALS_GROUP_NAME)|| + !strcmp(gname, MSN_NON_IM_GROUP_NAME)) { purple_debug_info("msn", "This group can't be removed, returning.\n"); return ; } - msn_del_group(session, group->name); + msn_del_group(session, gname); } /** @@ -1804,6 +1815,7 @@ if (b) { char *tmp; + const char *alias; if (b->alias && b->alias[0]) { @@ -1812,9 +1824,9 @@ g_free(aliastext); } - if (b->server_alias) + if ((alias = purple_buddy_get_server_alias(b)) != NULL) { - char *nicktext = g_markup_escape_text(b->server_alias, -1); + char *nicktext = g_markup_escape_text(alias, -1); tmp = g_strdup_printf("%s
", nicktext); purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); g_free(tmp); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/msn/notification.c Fri Oct 31 08:21:45 2008 +0000 @@ -578,7 +578,7 @@ g_snprintf(fmt_str, sizeof(fmt_str), "%d", MSN_NETWORK_PASSPORT); /*mobile*/ - //type_str = g_strdup_printf("4"); + /*type_str = g_strdup_printf("4");*/ xmlnode_set_attrib(c_node, "t", fmt_str); xmlnode_insert_child(d_node, c_node); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/msn/session.c --- a/libpurple/protocols/msn/session.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/msn/session.c Fri Oct 31 08:21:45 2008 +0000 @@ -274,12 +274,12 @@ * being logged in. This no longer happens, so we manually iterate * over the whole buddy list to identify sync issues. */ - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { PurpleGroup *group = (PurpleGroup *)gnode; const char *group_name; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; - group_name = group->name; + group_name = purple_group_get_name(group); for(cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/msn/userlist.c --- a/libpurple/protocols/msn/userlist.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/msn/userlist.c Fri Oct 31 08:21:45 2008 +0000 @@ -876,13 +876,14 @@ msn_userlist_load(MsnSession *session) { PurpleBlistNode *gnode, *cnode, *bnode; - PurpleConnection *gc = purple_account_get_connection(session->account); + PurpleAccount *account = session->account; + PurpleConnection *gc = purple_account_get_connection(account); GSList *l; MsnUser * user; g_return_if_fail(gc != NULL); - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -896,10 +897,10 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if (b->account == gc->account) + if (purple_buddy_get_account(b) == account) { user = msn_userlist_find_add_user(session->userlist, - b->name,NULL); + purple_buddy_get_name(b), NULL); b->proto_data = user; msn_user_set_op(user, MSN_LIST_FL_OP); } diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.c Fri Oct 31 08:21:45 2008 +0000 @@ -1026,7 +1026,7 @@ user = msim_find_user(session, username); /* If is on buddy list, lookup by uid since it is faster. */ - if (user && (uid = purple_blist_node_get_int(&user->buddy->node, "UserID"))) { + if (user && (uid = purple_blist_node_get_int((PurpleBlistNode *)user->buddy, "UserID"))) { user_to_lookup = g_strdup_printf("%d", uid); } else { /* Looking up buddy not on blist. Lookup by whatever user entered. */ @@ -1252,7 +1252,7 @@ /* See finch/gnthistory.c */ buddy = cur->data; - uid = purple_blist_node_get_int(&buddy->node, "UserID"); + uid = purple_blist_node_get_int((PurpleBlistNode *)buddy, "UserID"); name = purple_buddy_get_name(buddy); if (uid == wanted_uid) @@ -1972,7 +1972,7 @@ user = msim_get_user_from_buddy(buddy); /* All buddies on list should have a UserID integer associated with them. */ - purple_blist_node_set_int(&buddy->node, "UserID", msim_msg_get_integer(msg, "f")); + purple_blist_node_set_int((PurpleBlistNode *)buddy, "UserID", msim_msg_get_integer(msg, "f")); msim_store_user_info(session, msg, NULL); } else { @@ -2065,10 +2065,14 @@ MsimMessage *msg; MsimMessage *msg_persist; MsimMessage *body; + const char *name, *gname; session = (MsimSession *)gc->proto_data; + name = purple_buddy_get_name(buddy); + gname = group ? purple_group_get_name(group) : NULL; + purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", - buddy->name, (group && group->name) ? group->name : "(no group)"); + name, gname ? gname : "(no group)"); msg = msim_msg_new( "addbuddy", MSIM_TYPE_BOOLEAN, TRUE, @@ -2077,7 +2081,7 @@ "reason", MSIM_TYPE_STRING, g_strdup(""), NULL); - if (!msim_postprocess_outgoing(session, msg, buddy->name, "newprofileid", "reason")) { + if (!msim_postprocess_outgoing(session, msg, name, "newprofileid", "reason")) { purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed.")); msim_msg_free(msg); return; @@ -2089,7 +2093,7 @@ body = msim_msg_new( "ContactID", MSIM_TYPE_STRING, g_strdup(""), - "GroupName", MSIM_TYPE_STRING, g_strdup(group->name), + "GroupName", MSIM_TYPE_STRING, g_strdup(gname), "Position", MSIM_TYPE_INTEGER, 1000, "Visibility", MSIM_TYPE_INTEGER, 1, "NickName", MSIM_TYPE_STRING, g_strdup(""), @@ -2110,7 +2114,7 @@ "body", MSIM_TYPE_DICTIONARY, body, NULL); - if (!msim_postprocess_outgoing(session, msg_persist, buddy->name, "body", NULL)) + if (!msim_postprocess_outgoing(session, msg_persist, name, "body", NULL)) { purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); msim_msg_free(msg_persist); @@ -2286,7 +2290,7 @@ /* Next, see if on buddy list and know uid. */ buddy = purple_find_buddy(session->account, username); if (buddy) { - uid = purple_blist_node_get_int(&buddy->node, "UserID"); + uid = purple_blist_node_get_int((PurpleBlistNode *)buddy, "UserID"); } else { uid = 0; } @@ -2328,8 +2332,10 @@ MsimMessage *persist_msg; MsimMessage *blocklist_msg; GList *blocklist_updates; + const char *name; session = (MsimSession *)gc->proto_data; + name = purple_buddy_get_name(buddy); delbuddy_msg = msim_msg_new( "delbuddy", MSIM_TYPE_BOOLEAN, TRUE, @@ -2337,7 +2343,7 @@ /* 'delprofileid' with uid will be inserted here. */ NULL); - if (!msim_postprocess_outgoing(session, delbuddy_msg, buddy->name, "delprofileid", NULL)) { + if (!msim_postprocess_outgoing(session, delbuddy_msg, name, "delprofileid", NULL)) { purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("'delbuddy' command failed")); msim_msg_free(delbuddy_msg); return; @@ -2356,7 +2362,7 @@ "body", MSIM_TYPE_STRING, g_strdup("ContactID="), NULL); - if (!msim_postprocess_outgoing(session, persist_msg, buddy->name, "body", NULL)) { + if (!msim_postprocess_outgoing(session, persist_msg, name, "body", NULL)) { purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("persist command failed")); msim_msg_free(persist_msg); return; @@ -2378,7 +2384,7 @@ "idlist", MSIM_TYPE_LIST, blocklist_updates, NULL); - if (!msim_postprocess_outgoing(session, blocklist_msg, buddy->name, "idlist", NULL)) { + if (!msim_postprocess_outgoing(session, blocklist_msg, name, "idlist", NULL)) { purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("blocklist command failed")); msim_msg_free(blocklist_msg); return; @@ -2732,12 +2738,16 @@ MsimSession *session; MsimUser *user; const gchar *display_name, *headline; + PurpleAccount *account; + PurpleConnection *gc; g_return_val_if_fail(buddy != NULL, NULL); user = msim_get_user_from_buddy(buddy); - session = (MsimSession *)buddy->account->gc->proto_data; + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); + session = (MsimSession *)gc->proto_data; g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL); display_name = headline = NULL; @@ -2785,8 +2795,10 @@ if (PURPLE_BUDDY_IS_ONLINE(buddy)) { MsimSession *session; - - session = (MsimSession *)buddy->account->gc->proto_data; + PurpleAccount *account = purple_buddy_get_account(buddy); + PurpleConnection *gc = purple_account_get_connection(account); + + session = (MsimSession *)gc->proto_data; g_return_if_fail(MSIM_SESSION_VALID(session)); @@ -2867,7 +2879,7 @@ user = msim_get_user_from_buddy(buddy); /* All buddies on list should have 'uid' integer associated with them. */ - purple_blist_node_set_int(&buddy->node, "UserID", uid); + purple_blist_node_set_int((PurpleBlistNode *)buddy, "UserID", uid); /* Stores a few fields in the MsimUser, relevant to the buddy itself. * AvatarURL, Headline, ContactID. */ diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/myspace/user.c --- a/libpurple/protocols/myspace/user.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/myspace/user.c Fri Oct 31 08:21:45 2008 +0000 @@ -105,7 +105,7 @@ purple_notify_user_info_add_pair(user_info, _("User"), user->username); } - uid = purple_blist_node_get_int(&user->buddy->node, "UserID"); + uid = purple_blist_node_get_int((PurpleBlistNode *)user->buddy, "UserID"); if (full) { /* TODO: link to username, if available */ @@ -198,7 +198,9 @@ static void msim_set_artist_or_title(MsimUser *user, const char *new_artist, const char *new_title) { PurplePresence *presence; + PurpleAccount *account; const char *prev_artist, *prev_title; + const char *name; prev_artist = NULL; prev_title = NULL; @@ -208,8 +210,11 @@ if (new_title && !strlen(new_title)) new_title = NULL; + account = purple_buddy_get_account(user->buddy); + name = purple_buddy_get_name(user->buddy); + if (!new_artist && !new_title) { - purple_prpl_got_user_status_deactive(user->buddy->account, user->buddy->name, "tune"); + purple_prpl_got_user_status_deactive(account, name, "tune"); return; } @@ -229,7 +234,7 @@ if (!new_title) new_title = prev_title; - purple_prpl_got_user_status(user->buddy->account, user->buddy->name, "tune", + purple_prpl_got_user_status(account, name, "tune", PURPLE_TUNE_TITLE, new_title, PURPLE_TUNE_ARTIST, new_artist, NULL); @@ -245,12 +250,13 @@ void msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user) { + const char *name = user->buddy ? purple_buddy_get_name(user->buddy) : NULL; if (g_str_equal(key_str, "UserID") || g_str_equal(key_str, "ContactID")) { /* Save to buddy list, if it exists, for quick cached uid lookup with msim_uid2username_from_blist(). */ if (user->buddy) { - purple_debug_info("msim", "associating uid %s with username %s\n", key_str, user->buddy->name); - purple_blist_node_set_int(&user->buddy->node, "UserID", atol(value_str)); + purple_debug_info("msim", "associating uid %s with username %s\n", key_str, name); + purple_blist_node_set_int((PurpleBlistNode *)user->buddy, "UserID", atol(value_str)); } /* Need to store in MsimUser, too? What if not on blist? */ } else if (g_str_equal(key_str, "Age")) { @@ -300,9 +306,8 @@ /* Instead of showing 'no photo' picture, show nothing. */ if (g_str_equal(user->image_url, "http://x.myspace.com/images/no_pic.gif")) { - purple_buddy_icons_set_for_user(user->buddy->account, - user->buddy->name, - NULL, 0, NULL); + purple_buddy_icons_set_for_user(purple_buddy_get_account(user->buddy), + name, NULL, 0, NULL); return; } @@ -539,8 +544,10 @@ const gchar *error_message) { MsimUser *user; + const char *name; user = (MsimUser *)user_data; + name = purple_buddy_get_name(user->buddy); purple_debug_info("msim_downloaded_buddy_icon", "Downloaded %" G_GSIZE_FORMAT " bytes\n", len); @@ -548,13 +555,12 @@ if (!url_text) { purple_debug_info("msim_downloaded_buddy_icon", "failed to download icon for %s", - user->buddy->name); + name); return; } - purple_buddy_icons_set_for_user(user->buddy->account, - user->buddy->name, - g_memdup((gchar *)url_text, len), len, + purple_buddy_icons_set_for_user(purple_buddy_get_account(user->buddy), + name, g_memdup((gchar *)url_text, len), len, /* Use URL itself as buddy icon "checksum" (TODO: ETag) */ user->image_url); /* checksum */ } diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/myspace/zap.c --- a/libpurple/protocols/myspace/zap.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/myspace/zap.c Fri Oct 31 08:21:45 2008 +0000 @@ -177,13 +177,13 @@ buddy = (PurpleBuddy *)node; /* Find the session */ - account = buddy->account; + account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); session = (MsimSession *)gc->proto_data; zap = GPOINTER_TO_INT(zap_num_ptr); - purple_prpl_send_attention(session->gc, buddy->name, zap); + purple_prpl_send_attention(session->gc, purple_buddy_get_name(buddy), zap); } /** Return menu, if any, for a buddy list node. */ diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/novell/novell.c --- a/libpurple/protocols/novell/novell.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/novell/novell.c Fri Oct 31 08:21:45 2008 +0000 @@ -293,7 +293,7 @@ nm_user_record_get_display_id(user_record)); alias = purple_buddy_get_alias(buddy); - if (alias == NULL || *alias == '\0' || (strcmp(alias, buddy->name) == 0)) { + if (alias == NULL || *alias == '\0' || (strcmp(alias, purple_buddy_get_name(buddy)) == 0)) { purple_blist_alias_buddy(buddy, nm_user_record_get_full_name(user_record)); @@ -1175,10 +1175,12 @@ const char *status_id; const char *text = NULL; const char *dn; + const char *name; int idle = 0; gboolean loggedin = TRUE; - account = buddy->account; + account = purple_buddy_get_account(buddy); + name = purple_buddy_get_name(buddy); switch (novellstatus) { case NM_STATUS_AVAILABLE: @@ -1205,7 +1207,7 @@ } /* Get status text for the user */ - dn = nm_lookup_dn(user, buddy->name); + dn = nm_lookup_dn(user, name); if (dn) { NMUserRecord *user_record = nm_find_user_record(user, dn); if (user_record) { @@ -1213,9 +1215,9 @@ } } - purple_prpl_got_user_status(account, buddy->name, status_id, + purple_prpl_got_user_status(account, name, status_id, "message", text, NULL); - purple_prpl_got_user_idle(account, buddy->name, + purple_prpl_got_user_idle(account, name, (novellstatus == NM_STATUS_AWAY_IDLE), idle); } @@ -1230,44 +1232,41 @@ PurpleBlistNode *bnode; PurpleGroup *group; PurpleBuddy *buddy; - PurpleBuddyList *blist; GSList *rem_list = NULL; GSList *l; NMFolder *folder = NULL; const char *gname = NULL; - if ((blist = purple_get_blist())) { - for (gnode = blist->root; gnode; gnode = gnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { + if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + continue; + group = (PurpleGroup *) gnode; + gname = purple_group_get_name(group); + for (cnode = gnode->child; cnode; cnode = cnode->next) { + if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; - group = (PurpleGroup *) gnode; - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) + for (bnode = cnode->child; bnode; bnode = bnode->next) { + if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - for (bnode = cnode->child; bnode; bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *) bnode; - if (buddy->account == user->client_data) { - gname = group->name; - if (strcmp(group->name, NM_ROOT_FOLDER_NAME) == 0) - gname = ""; - folder = nm_find_folder(user, gname); - if (folder == NULL || - !nm_folder_find_contact_by_display_id(folder, buddy->name)) { - rem_list = g_slist_append(rem_list, buddy); - } + buddy = (PurpleBuddy *) bnode; + if (purple_buddy_get_account(buddy) == user->client_data) { + if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) + gname = ""; + folder = nm_find_folder(user, gname); + if (folder == NULL || + !nm_folder_find_contact_by_display_id(folder, purple_buddy_get_name(buddy))) { + rem_list = g_slist_append(rem_list, buddy); } } } } - - if (rem_list) { - for (l = rem_list; l; l = l->next) { - purple_blist_remove_buddy(l->data); - } - g_slist_free(rem_list); + } + + if (rem_list) { + for (l = rem_list; l; l = l->next) { + purple_blist_remove_buddy(l->data); } + g_slist_free(rem_list); } } @@ -1613,14 +1612,14 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); user = gc->proto_data; if (user == NULL) return; /* We should already have a userrecord for the buddy */ - user_record = nm_find_user_record(user, buddy->name); + user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); if (user_record == NULL) return; @@ -2538,7 +2537,7 @@ NMContact *contact; NMUser *user; NMERR_T rc = NM_OK; - const char *alias, *gname; + const char *alias, *gname, *bname; if (gc == NULL || buddy == NULL || group == NULL) return; @@ -2554,22 +2553,22 @@ return; contact = nm_create_contact(); - nm_contact_set_dn(contact, buddy->name); + nm_contact_set_dn(contact, purple_buddy_get_name(buddy)); /* Remove the PurpleBuddy (we will add it back after adding it * to the server side list). Save the alias if there is one. */ alias = purple_buddy_get_alias(buddy); - if (alias && strcmp(alias, buddy->name)) + bname = purple_buddy_get_name(buddy); + if (alias && strcmp(alias, bname)) nm_contact_set_display_name(contact, alias); purple_blist_remove_buddy(buddy); buddy = NULL; - if (strcmp(group->name, NM_ROOT_FOLDER_NAME) == 0) { + gname = purple_group_get_name(group); + if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { gname = ""; - } else { - gname = group->name; } folder = nm_find_folder(user, gname); @@ -2603,11 +2602,10 @@ return; user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, buddy->name))) { - if (strcmp(group->name, NM_ROOT_FOLDER_NAME) == 0) { + if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { + gname = purple_group_get_name(group); + if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { gname = ""; - } else { - gname = group->name; } folder = nm_find_folder(user, gname); if (folder) { @@ -2637,7 +2635,7 @@ user = (NMUser *) gc->proto_data; if (user) { - NMFolder *folder = nm_find_folder(user, group->name); + NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); if (folder) { rc = nm_send_remove_folder(user, folder, @@ -2777,8 +2775,9 @@ user = gc->proto_data; if (user) { + const char *gname = purple_group_get_name(group); /* Does new folder exist already? */ - if (nm_find_folder(user, group->name)) { + if (nm_find_folder(user, gname)) { /* purple_blist_rename_group() adds the buddies * to the new group and removes the old group... * so there is nothing more to do here. @@ -2793,7 +2792,7 @@ folder = nm_find_folder(user, old_name); if (folder) { - rc = nm_send_rename_folder(user, folder, group->name, + rc = nm_send_rename_folder(user, folder, gname, _rename_folder_resp_cb, NULL); _check_for_disconnect(user, rc); } @@ -2819,12 +2818,12 @@ if (buddy == NULL) return; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); if (gc == NULL || (user = gc->proto_data) == NULL) return; if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - user_record = nm_find_user_record(user, buddy->name); + user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); if (user_record) { status = nm_user_record_get_status(user_record); text = nm_user_record_get_status_text(user_record); @@ -2923,14 +2922,16 @@ { const char *text = NULL; const char *dn = NULL; - - if (buddy && buddy->account) { - PurpleConnection *gc = purple_account_get_connection(buddy->account); + PurpleAccount *account; + + account = buddy ? purple_buddy_get_account(buddy) : NULL; + if (buddy && account) { + PurpleConnection *gc = purple_account_get_connection(account); if (gc && gc->proto_data) { NMUser *user = gc->proto_data; - dn = nm_lookup_dn(user, buddy->name); + dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); if (dn) { NMUserRecord *user_record = nm_find_user_record(user, dn); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/oscar/oscar.c --- a/libpurple/protocols/oscar/oscar.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Fri Oct 31 08:21:45 2008 +0000 @@ -807,11 +807,13 @@ PurpleStatus *status = NULL; gchar *message = NULL, *itmsurl = NULL, *tmp; gboolean is_away; + const char *bname; od = gc->proto_data; + bname = purple_buddy_get_name(b); if (userinfo == NULL) - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, bname); if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL))) return; @@ -884,7 +886,7 @@ if (b) { if (purple_presence_is_online(presence)) { - if (aim_snvalid_icq(b->name) || is_away || !message || !(*message)) { + if (aim_snvalid_icq(bname) || is_away || !message || !(*message)) { /* Append the status name for online ICQ statuses, away AIM statuses, and for all buddies with no message. * If the status name and the message are the same, only show one. */ const char *status_name = purple_status_get_name(status); @@ -901,8 +903,8 @@ } else { if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, b->name), - b->name)) { + aim_ssi_itemlist_findparentname(od->ssi.local, bname), + bname)) { /* Note if an offline buddy is not authorized */ tmp = g_strdup_printf("%s%s%s", _("Not Authorized"), @@ -931,6 +933,7 @@ PurpleGroup *g = NULL; struct buddyinfo *bi = NULL; char *tmp; + const char *bname, *gname = NULL; od = gc->proto_data; account = purple_connection_get_account(gc); @@ -938,14 +941,16 @@ if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL))) return; + bname = purple_buddy_get_name(b); if (userinfo == NULL) - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, bname); if (b == NULL) b = purple_find_buddy(account, userinfo->sn); if (b != NULL) { g = purple_buddy_get_group(b); + gname = purple_group_get_name(g); presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); } @@ -969,8 +974,8 @@ g_free(tmp); } - if ((b != NULL) && (b->name != NULL) && (g != NULL) && (g->name != NULL)) { - tmp = aim_ssi_getcomment(od->ssi.local, g->name, b->name); + if ((b != NULL) && (bname != NULL) && (g != NULL) && (gname != NULL)) { + tmp = aim_ssi_getcomment(od->ssi.local, gname, bname); if (tmp != NULL) { char *tmp2 = g_markup_escape_text(tmp, strlen(tmp)); g_free(tmp); @@ -2452,6 +2457,7 @@ PurpleAccount *account; PurpleBuddy *buddy; PurpleGroup *group; + const char *bname, *gname; gc = data->gc; od = gc->proto_data; @@ -2464,15 +2470,17 @@ if (group != NULL) { + bname = purple_buddy_get_name(buddy); + gname = purple_group_get_name(group); purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n", - buddy->name, group->name); + bname, gname); aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); - if (!aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) + if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { - aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); + aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); /* Mobile users should always be online */ - if (buddy->name[0] == '+') { + if (bname[0] == '+') { purple_prpl_got_user_status(account, purple_buddy_get_name(buddy), OSCAR_STATUS_ID_AVAILABLE, NULL); @@ -2512,8 +2520,8 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - purple_auth_sendrequest(gc, buddy->name); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); + purple_auth_sendrequest(gc, purple_buddy_get_name(buddy)); } /* When other people ask you for authorization */ @@ -3898,9 +3906,9 @@ user_info = purple_notify_user_info_new(); g_snprintf(who, sizeof(who), "%u", info->uin); - buddy = purple_find_buddy(purple_connection_get_account(gc), who); + buddy = purple_find_buddy(account, who); if (buddy != NULL) - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(buddy->account, buddy->name)); + bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, purple_buddy_get_name(buddy))); else bi = NULL; @@ -3917,7 +3925,7 @@ } oscar_user_info_convert_and_add(account, user_info, _("First Name"), info->first); oscar_user_info_convert_and_add(account, user_info, _("Last Name"), info->last); - if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email))) { + if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(account, info->email))) { buf = g_strdup_printf("%s", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); g_free(buf); @@ -3926,7 +3934,7 @@ if (info->numaddresses && info->email2) { int i; for (i = 0; i < info->numaddresses; i++) { - if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email2[i]))) { + if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(account, info->email2[i]))) { buf = g_strdup_printf("%s", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); g_free(buf); @@ -3961,7 +3969,7 @@ snprintf(age, sizeof(age), "%hhd", info->age); purple_notify_user_info_add_pair(user_info, _("Age"), age); } - if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->personalwebpage))) { + if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(account, info->personalwebpage))) { buf = g_strdup_printf("%s", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf); g_free(buf); @@ -3997,7 +4005,7 @@ oscar_user_info_convert_and_add(account, user_info, _("Division"), info->workdivision); oscar_user_info_convert_and_add(account, user_info, _("Position"), info->workposition); - if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->workwebpage))) { + if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(account, info->workwebpage))) { char *webpage = g_strdup_printf("%s", utf8, utf8); purple_notify_user_info_add_pair(user_info, _("Web Page"), webpage); g_free(webpage); @@ -4031,7 +4039,7 @@ if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, info->nick))) { g_snprintf(who, sizeof(who), "%u", info->uin); serv_got_alias(gc, who, utf8); - if ((b = purple_find_buddy(gc->account, who))) { + if ((b = purple_find_buddy(account, who))) { purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8); } g_free(utf8); @@ -4799,14 +4807,17 @@ oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { OscarData *od; PurpleAccount *account; + const char *bname, *gname; od = (OscarData *)gc->proto_data; account = purple_connection_get_account(gc); - - if (!aim_snvalid(buddy->name)) { + bname = purple_buddy_get_name(buddy); + gname = purple_group_get_name(group); + + if (!aim_snvalid(bname)) { gchar *buf; - buf = g_strdup_printf(_("Could not add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name); - if (!purple_conv_present_error(buddy->name, account, buf)) + buf = g_strdup_printf(_("Could not add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), bname); + if (!purple_conv_present_error(bname, account, buf)) purple_notify_error(gc, NULL, _("Unable To Add"), buf); g_free(buf); @@ -4816,34 +4827,34 @@ return; } - if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) { + if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY))) { purple_debug_info("oscar", - "ssi: adding buddy %s to group %s\n", buddy->name, group->name); - aim_ssi_addbuddy(od, buddy->name, group->name, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); + "ssi: adding buddy %s to group %s\n", bname, gname); + aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); /* Mobile users should always be online */ - if (buddy->name[0] == '+') { + if (bname[0] == '+') { purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_AVAILABLE, NULL); + bname, OSCAR_STATUS_ID_AVAILABLE, NULL); purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_MOBILE, NULL); + bname, OSCAR_STATUS_ID_MOBILE, NULL); } } /* XXX - Should this be done from AIM accounts, as well? */ if (od->icq) - aim_icq_getalias(od, buddy->name); + aim_icq_getalias(od, bname); } void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { OscarData *od = (OscarData *)gc->proto_data; if (od->ssi.received_data) { + const char *gname = purple_group_get_name(group); + const char *bname = purple_buddy_get_name(buddy); purple_debug_info("oscar", - "ssi: deleting buddy %s from group %s\n", buddy->name, group->name); - aim_ssi_delbuddy(od, buddy->name, group->name); + "ssi: deleting buddy %s from group %s\n", bname, gname); + aim_ssi_delbuddy(od, bname, gname); } } @@ -4875,7 +4886,8 @@ OscarData *od = (OscarData *)gc->proto_data; if (od->ssi.received_data) { - if (aim_ssi_itemlist_finditem(od->ssi.local, group->name, NULL, AIM_SSI_TYPE_GROUP)) { + const char *gname = purple_group_get_name(group); + if (aim_ssi_itemlist_finditem(od->ssi.local, gname, NULL, AIM_SSI_TYPE_GROUP)) { GList *cur, *groups = NULL; PurpleAccount *account = purple_connection_get_account(gc); @@ -4892,18 +4904,18 @@ purple_account_add_buddies(account, moved_buddies); g_list_free(groups); purple_debug_info("oscar", - "ssi: moved all buddies from group %s to %s\n", old_name, group->name); + "ssi: moved all buddies from group %s to %s\n", old_name, gname); } else { - aim_ssi_rename_group(od, old_name, group->name); + aim_ssi_rename_group(od, old_name, gname); purple_debug_info("oscar", - "ssi: renamed group %s to %s\n", old_name, group->name); + "ssi: renamed group %s to %s\n", old_name, gname); } } } void oscar_remove_group(PurpleConnection *gc, PurpleGroup *group) { - aim_ssi_delgroup(gc->proto_data, group->name); + aim_ssi_delgroup(gc->proto_data, purple_group_get_name(group)); } static gboolean purple_ssi_rerequestdata(gpointer data) { @@ -5012,33 +5024,37 @@ /* Buddies */ cur = NULL; if ((blist = purple_get_blist()) != NULL) { - for (gnode = blist->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { + const char *gname; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; g = (PurpleGroup *)gnode; + gname = purple_group_get_name(g); for (cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for (bnode = cnode->child; bnode; bnode = bnode->next) { + const char *bname; if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if (b->account == gc->account) { - if (aim_ssi_itemlist_exists(od->ssi.local, b->name)) { + bname = purple_buddy_get_name(b); + if (purple_buddy_get_account(b) == account) { + if (aim_ssi_itemlist_exists(od->ssi.local, bname)) { /* If the buddy is an ICQ user then load his nickname */ const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"); char *alias; if (servernick) - serv_got_alias(gc, b->name, servernick); + serv_got_alias(gc, bname, servernick); /* Store local alias on server */ - alias = aim_ssi_getalias(od->ssi.local, g->name, b->name); + alias = aim_ssi_getalias(od->ssi.local, gname, bname); if (!alias && b->alias && strlen(b->alias)) - aim_ssi_aliasbuddy(od, g->name, b->name, b->alias); + aim_ssi_aliasbuddy(od, gname, bname, b->alias); g_free(alias); } else { purple_debug_info("oscar", - "ssi: removing buddy %s from local list\n", b->name); + "ssi: removing buddy %s from local list\n", bname); /* We can't actually remove now because it will screw up our looping */ cur = g_slist_prepend(cur, b); } @@ -5134,15 +5150,15 @@ } else alias_utf8 = NULL; - b = purple_find_buddy_in_group(gc->account, curitem->name, g); + b = purple_find_buddy_in_group(account, curitem->name, g); if (b) { /* Get server stored alias */ purple_blist_alias_buddy(b, alias_utf8); } else { - b = purple_buddy_new(gc->account, curitem->name, alias_utf8); + b = purple_buddy_new(account, curitem->name, alias_utf8); purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", curitem->name, g->name); + "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname); purple_blist_add_buddy(b, NULL, g, NULL); } if (!aim_sncmp(curitem->name, account->username)) { @@ -5155,7 +5171,7 @@ } /* Mobile users should always be online */ - if (b->name[0] == '+') { + if (curitem->name[0] == '+') { purple_prpl_got_user_status(account, purple_buddy_get_name(b), OSCAR_STATUS_ID_AVAILABLE, NULL); @@ -5369,13 +5385,11 @@ purple_blist_add_buddy(b, NULL, g, NULL); /* Mobile users should always be online */ - if (b->name[0] == '+') { + if (name[0] == '+') { purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_AVAILABLE, NULL); + name, OSCAR_STATUS_ID_AVAILABLE, NULL); purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_MOBILE, NULL); + name, OSCAR_STATUS_ID_MOBILE, NULL); } } @@ -5707,7 +5721,8 @@ const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b) { - if ((b == NULL) || (b->name == NULL) || aim_snvalid_sms(b->name)) + const char *name = b ? purple_buddy_get_name(b) : NULL; + if ((b == NULL) || (name == NULL) || aim_snvalid_sms(name)) { if (a == NULL || aim_snvalid_icq(purple_account_get_username(a))) return "icq"; @@ -5715,14 +5730,15 @@ return "aim"; } - if (aim_snvalid_icq(b->name)) + if (aim_snvalid_icq(name)) return "icq"; return "aim"; } const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b) { - if ((b == NULL) || (b->name == NULL) || aim_snvalid_sms(b->name)) + const char *name = b ? purple_buddy_get_name(b) : NULL; + if ((b == NULL) || (name == NULL) || aim_snvalid_sms(name)) { if (a != NULL && aim_snvalid_icq(purple_account_get_username(a))) return "icq"; @@ -5730,7 +5746,7 @@ return "aim"; } - if (aim_snvalid_icq(b->name)) + if (aim_snvalid_icq(name)) return "icq"; return "aim"; } @@ -5744,14 +5760,16 @@ PurpleStatus *status; const char *status_id; aim_userinfo_t *userinfo = NULL; - - account = b->account; + const char *name; + + account = purple_buddy_get_account(b); + name = purple_buddy_get_name(b); if (account != NULL) - gc = account->gc; + gc = purple_account_get_connection(account); if (gc != NULL) od = gc->proto_data; if (od != NULL) - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, name); presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); @@ -5759,9 +5777,9 @@ if (purple_presence_is_online(presence) == FALSE) { char *gname; - if ((b->name) && (od) && (od->ssi.received_data) && - (gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name)) && - (aim_ssi_waitingforauth(od->ssi.local, gname, b->name))) { + if ((name) && (od) && (od->ssi.received_data) && + (gname = aim_ssi_itemlist_findparentname(od->ssi.local, name)) && + (aim_ssi_waitingforauth(od->ssi.local, gname, name))) { return "not-authorized"; } } @@ -5784,15 +5802,17 @@ void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { PurpleConnection *gc; + PurpleAccount *account; OscarData *od; aim_userinfo_t *userinfo; if (!PURPLE_BUDDY_IS_ONLINE(b)) return; - gc = b->account->gc; + account = purple_buddy_get_account(b); + gc = purple_account_get_connection(account); od = gc->proto_data; - userinfo = aim_locate_finduserinfo(od, b->name); + userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); oscar_user_info_append_status(gc, user_info, b, userinfo, /* strip_html_tags */ TRUE); @@ -5820,8 +5840,9 @@ if ((od != NULL) && !purple_presence_is_online(presence)) { - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name); - if (aim_ssi_waitingforauth(od->ssi.local, gname, b->name)) + const char *name = purple_buddy_get_name(b); + char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); + if (aim_ssi_waitingforauth(od->ssi.local, gname, name)) ret = g_strdup(_("Not Authorized")); else ret = g_strdup(_("Offline")); @@ -6066,7 +6087,7 @@ return; } - aim_ssi_editcomment(od, g->name, data->name, text); + aim_ssi_editcomment(od, purple_group_get_name(g), data->name, text); if (!aim_sncmp(data->name, gc->account->username)) purple_check_comment(od, text); @@ -6084,22 +6105,26 @@ char *comment; gchar *comment_utf8; gchar *title; + PurpleAccount *account; + const char *name; g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + name = purple_buddy_get_name(buddy); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); od = gc->proto_data; data = g_new(struct name_data, 1); if (!(g = purple_buddy_get_group(buddy))) return; - comment = aim_ssi_getcomment(od->ssi.local, g->name, buddy->name); - comment_utf8 = comment ? oscar_utf8_try_convert(gc->account, comment) : NULL; + comment = aim_ssi_getcomment(od->ssi.local, purple_group_get_name(g), name); + comment_utf8 = comment ? oscar_utf8_try_convert(account, comment) : NULL; data->gc = gc; - data->name = g_strdup(purple_buddy_get_name(buddy)); + data->name = g_strdup(name); data->nick = g_strdup(purple_buddy_get_alias_only(buddy)); title = g_strdup_printf(_("Buddy Comment for %s"), data->name); @@ -6107,7 +6132,7 @@ comment_utf8, TRUE, FALSE, NULL, _("_OK"), G_CALLBACK(oscar_ssi_editcomment), _("_Cancel"), G_CALLBACK(oscar_free_name_data), - purple_connection_get_account(gc), data->name, NULL, + account, data->name, NULL, data); g_free(title); @@ -6139,26 +6164,28 @@ PurpleConnection *gc; gchar *buf; struct oscar_ask_directim_data *data; + PurpleAccount *account; node = object; g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(buddy->account); + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); data = g_new0(struct oscar_ask_directim_data, 1); - data->who = g_strdup(buddy->name); + data->who = g_strdup(purple_buddy_get_name(buddy)); data->od = gc->proto_data; buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), - buddy->name); + data->who); purple_request_action(gc, NULL, buf, _("Because this reveals your IP address, it " "may be considered a security risk. Do you " "wish to continue?"), 0, /* Default action is "connect" */ - purple_connection_get_account(gc), data->who, NULL, + account, data->who, NULL, data, 2, _("C_onnect"), G_CALLBACK(oscar_ask_directim_yes_cb), _("_Cancel"), G_CALLBACK(oscar_ask_directim_no_cb)); @@ -6174,7 +6201,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); aim_locate_getinfoshort(gc->proto_data, purple_buddy_get_name(buddy), 0x00000003); } @@ -6187,13 +6214,16 @@ GList *menu; PurpleMenuAction *act; aim_userinfo_t *userinfo; - - gc = purple_account_get_connection(buddy->account); + PurpleAccount *account; + const char *bname = purple_buddy_get_name(buddy); + + account = purple_buddy_get_account(buddy); + gc = purple_account_get_connection(account); od = gc->proto_data; - userinfo = aim_locate_finduserinfo(od, buddy->name); + userinfo = aim_locate_finduserinfo(od, bname); menu = NULL; - if (od->icq && aim_snvalid_icq(purple_buddy_get_name(buddy))) + if (od->icq && aim_snvalid_icq(bname)) { act = purple_menu_action_new(_("Get AIM Info"), PURPLE_CALLBACK(oscar_get_aim_info_cb), @@ -6217,7 +6247,7 @@ #endif if (userinfo && - aim_sncmp(purple_account_get_username(buddy->account), buddy->name) && + aim_sncmp(purple_account_get_username(account), bname) && PURPLE_BUDDY_IS_ONLINE(buddy)) { if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM) @@ -6241,8 +6271,8 @@ if (od->ssi.received_data) { char *gname; - gname = aim_ssi_itemlist_findparentname(od->ssi.local, buddy->name); - if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, buddy->name)) + gname = aim_ssi_itemlist_findparentname(od->ssi.local, bname); + if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, bname)) { act = purple_menu_action_new(_("Re-request Authorization"), PURPLE_CALLBACK(purple_auth_sendrequest_menu), @@ -6399,26 +6429,32 @@ OscarData *od = gc->proto_data; gchar *nombre, *text, *tmp; PurpleBlistNode *gnode, *cnode, *bnode; + PurpleAccount *account; int num=0; text = g_strdup(""); - - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + account = purple_connection_get_account(gc); + + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { PurpleGroup *group = (PurpleGroup *)gnode; + const char *gname; if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; + gname = purple_group_get_name(group); for (cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for (bnode = cnode->child; bnode; bnode = bnode->next) { PurpleBuddy *buddy = (PurpleBuddy *)bnode; + const char *bname; if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if (buddy->account == gc->account && aim_ssi_waitingforauth(od->ssi.local, group->name, buddy->name)) { + bname = purple_buddy_get_name(buddy); + if (purple_buddy_get_account(buddy) == account && aim_ssi_waitingforauth(od->ssi.local, gname, bname)) { if (purple_buddy_get_alias_only(buddy)) - nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy)); + nombre = g_strdup_printf(" %s (%s)", bname, purple_buddy_get_alias_only(buddy)); else - nombre = g_strdup_printf(" %s", buddy->name); + nombre = g_strdup_printf(" %s", bname); tmp = g_strdup_printf("%s%s
", text, nombre); g_free(text); text = tmp; diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/qq/im.c --- a/libpurple/protocols/qq/im.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/qq/im.c Fri Oct 31 08:21:45 2008 +0000 @@ -341,7 +341,7 @@ if(im_text.fragmentCount == 0) im_text.fragmentCount = 1; - // Filter tail space + /* Filter tail space */ if(im_text.fragmentIndex == im_text.fragmentCount -1) { gint real_len = text_len; @@ -349,7 +349,7 @@ real_len --; text_len = real_len; - // Null string instaed of space + /* Null string instead of space */ im_text.msg[text_len] = 0; } diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/qq/qq.c --- a/libpurple/protocols/qq/qq.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/qq/qq.c Fri Oct 31 08:21:45 2008 +0000 @@ -271,9 +271,9 @@ case QQ_BUDDY_ONLINE_INVISIBLE: g_string_append(status, _("Invisible")); break; - case QQ_BUDDY_ONLINE_BUSY: - g_string_append(status, _("Busy")); - break; + case QQ_BUDDY_ONLINE_BUSY: + g_string_append(status, _("Busy")); + break; default: g_string_printf(status, _("Unknown-%d"), bd->status); } @@ -419,9 +419,9 @@ "invisible", _("Invisible"), FALSE, TRUE, FALSE); types = g_list_append(types, status); - status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, - "busy", _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); + status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, + "busy", _("Busy"), TRUE, TRUE, FALSE); + types = g_list_append(types, status); status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, "offline", _("Offline"), FALSE, TRUE, FALSE); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/sametime/sametime.c --- a/libpurple/protocols/sametime/sametime.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/sametime/sametime.c Fri Oct 31 08:21:45 2008 +0000 @@ -658,7 +658,6 @@ */ PurpleAccount *acct; - PurpleBuddyList *blist; PurpleBlistNode *gn, *cn, *bn; PurpleGroup *grp; PurpleBuddy *bdy; @@ -669,10 +668,7 @@ acct = purple_connection_get_account(gc); g_return_if_fail(acct != NULL); - blist = purple_get_blist(); - g_return_if_fail(blist != NULL); - - for(gn = blist->root; gn; gn = gn->next) { + for(gn = purple_blist_get_root(); gn; gn = gn->next) { const char *owner; const char *gname; enum mwSametimeGroupType gtype; @@ -697,13 +693,13 @@ /* the group's actual name may be different from the purple group's name. Find whichever is there */ gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = grp->name; + if(! gname) gname = purple_group_get_name(grp); /* we save this, but never actually honor it */ gopen = ! purple_blist_node_get_bool(gn, GROUP_KEY_COLLAPSED); stg = mwSametimeGroup_new(stlist, gtype, gname); - mwSametimeGroup_setAlias(stg, grp->name); + mwSametimeGroup_setAlias(stg, purple_group_get_name(grp)); mwSametimeGroup_setOpen(stg, gopen); /* don't attempt to put buddies in a dynamic group, it breaks @@ -720,17 +716,17 @@ bdy = (PurpleBuddy *) bn; - if(bdy->account == acct) { + if(purple_buddy_get_account(bdy) == acct) { struct mwSametimeUser *stu; enum mwSametimeUserType utype; - idb.user = bdy->name; + idb.user = (char *)purple_buddy_get_name(bdy); utype = purple_blist_node_get_int(bn, BUDDY_KEY_TYPE); if(! utype) utype = mwSametimeUser_NORMAL; stu = mwSametimeUser_new(stg, utype, &idb); - mwSametimeUser_setShortName(stu, bdy->server_alias); + mwSametimeUser_setShortName(stu, purple_buddy_get_server_alias(bdy)); mwSametimeUser_setAlias(stu, bdy->alias); } } @@ -811,7 +807,7 @@ static gboolean buddy_is_external(PurpleBuddy *b) { g_return_val_if_fail(b != NULL, FALSE); - return purple_str_has_prefix(b->name, "@E "); + return purple_str_has_prefix(purple_buddy_get_name(b), "@E "); } @@ -820,7 +816,7 @@ static void buddy_add(struct mwPurplePluginData *pd, PurpleBuddy *buddy) { - struct mwAwareIdBlock idb = { mwAware_USER, (char *) buddy->name, NULL }; + struct mwAwareIdBlock idb = { mwAware_USER, (char *) purple_buddy_get_name(buddy), NULL }; struct mwAwareList *list; PurpleGroup *group; @@ -885,7 +881,7 @@ GList *add; n = purple_blist_node_get_string((PurpleBlistNode *) group, GROUP_KEY_NAME); - if(! n) n = group->name; + if(! n) n = purple_group_get_name(group); idb.user = (char *) n; add = g_list_prepend(NULL, &idb); @@ -921,7 +917,7 @@ NSTR(name), NSTR(alias)); /* first attempt at finding the group, by the name key */ - for(gn = blist->root; gn; gn = gn->next) { + for(gn = purple_blist_get_root(); gn; gn = gn->next) { const char *n, *o; if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; n = purple_blist_node_get_string(gn, GROUP_KEY_NAME); @@ -1001,7 +997,7 @@ g_return_if_fail(group != NULL); - DEBUG_INFO("clearing members from pruned group %s\n", NSTR(group->name)); + DEBUG_INFO("clearing members from pruned group %s\n", NSTR(purple_group_get_name(group))); gc = purple_account_get_connection(acct); g_return_if_fail(gc != NULL); @@ -1016,8 +1012,8 @@ if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - if(gb->account == acct) { - DEBUG_INFO("clearing %s from group\n", NSTR(gb->name)); + if(purple_buddy_get_account(gb) == acct) { + DEBUG_INFO("clearing %s from group\n", NSTR(purple_buddy_get_name(gb))); prune = g_list_prepend(prune, gb); } } @@ -1054,7 +1050,7 @@ g_return_if_fail(group != NULL); - DEBUG_INFO("pruning membership of group %s\n", NSTR(group->name)); + DEBUG_INFO("pruning membership of group %s\n", NSTR(purple_group_get_name(group))); acct = purple_connection_get_account(gc); g_return_if_fail(acct != NULL); @@ -1083,8 +1079,8 @@ /* if the account is correct and they're not in our table, mark them for pruning */ - if(gb->account == acct && !g_hash_table_lookup(stusers, gb->name)) { - DEBUG_INFO("marking %s for pruning\n", NSTR(gb->name)); + if(purple_buddy_get_account(gb) == acct && !g_hash_table_lookup(stusers, purple_buddy_get_name(gb))) { + DEBUG_INFO("marking %s for pruning\n", NSTR(purple_buddy_get_name(gb))); prune = g_list_prepend(prune, gb); } } @@ -1140,7 +1136,7 @@ g_list_free(gtl); /* find all groups which should be pruned from the local list */ - for(gn = blist->root; gn; gn = gn->next) { + for(gn = purple_blist_get_root(); gn; gn = gn->next) { PurpleGroup *grp = (PurpleGroup *) gn; const char *gname, *owner; struct mwSametimeGroup *stgrp; @@ -1159,12 +1155,12 @@ /* we actually are synching by this key as opposed to the group title, which can be different things in the st list */ gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = grp->name; + if(! gname) gname = purple_group_get_name(grp); stgrp = g_hash_table_lookup(stgroups, gname); if(! stgrp) { /* remove the whole group */ - DEBUG_INFO("marking group %s for pruning\n", grp->name); + DEBUG_INFO("marking group %s for pruning\n", purple_group_get_name(grp)); g_prune = g_list_prepend(g_prune, grp); } else { @@ -1279,6 +1275,7 @@ GString *str; char *tmp; + const char *gname; g_return_if_fail(pd != NULL); @@ -1290,11 +1287,12 @@ str = g_string_new(NULL); tmp = (char *) purple_blist_node_get_string(node, GROUP_KEY_NAME); - - g_string_append_printf(str, _("Group Title: %s
"), group->name); + gname = purple_group_get_name(group); + + g_string_append_printf(str, _("Group Title: %s
"), gname); g_string_append_printf(str, _("Notes Group ID: %s
"), tmp); - tmp = g_strdup_printf(_("Info for Group %s"), group->name); + tmp = g_strdup_printf(_("Info for Group %s"), gname); purple_notify_formatted(gc, tmp, _("Notes Address Book Information"), NULL, str->str, NULL, NULL); @@ -1351,7 +1349,7 @@ PurpleBlistNode *gnode, *cnode, *bnode; GList *add_buds = NULL; - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if(! PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for(cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1363,7 +1361,7 @@ continue; b = (PurpleBuddy *)bnode; - if(b->account == acct) { + if(purple_buddy_get_account(b) == acct) { add_buds = g_list_append(add_buds, b); } } @@ -1383,7 +1381,6 @@ PurpleConnection *gc; PurpleAccount *acct; struct mwStorageUnit *unit; - PurpleBuddyList *blist; PurpleBlistNode *l; gc = pd->gc; @@ -1394,8 +1391,7 @@ mwServiceStorage_load(pd->srvc_store, unit, fetch_blist_cb, pd, NULL); /* find all the NAB groups and subscribe to them */ - blist = purple_get_blist(); - for(l = blist->root; l; l = l->next) { + for(l = purple_blist_get_root(); l; l = l->next) { PurpleGroup *group = (PurpleGroup *) l; enum mwSametimeGroupType gt; const char *owner; @@ -3234,10 +3230,10 @@ static char *mw_prpl_status_text(PurpleBuddy *b) { PurpleConnection *gc; struct mwPurplePluginData *pd; - struct mwAwareIdBlock t = { mwAware_USER, b->name, NULL }; + struct mwAwareIdBlock t = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; const char *ret = NULL; - if ((gc = purple_account_get_connection(b->account)) + if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) && (pd = gc->proto_data)) ret = mwServiceAware_getText(pd->srvc_aware, &t); @@ -3294,13 +3290,13 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { PurpleConnection *gc; struct mwPurplePluginData *pd = NULL; - struct mwAwareIdBlock idb = { mwAware_USER, b->name, NULL }; + struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; const char *message = NULL; const char *status; char *tmp; - if ((gc = purple_account_get_connection(b->account)) + if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) && (pd = gc->proto_data)) message = mwServiceAware_getText(pd->srvc_aware, &idb); @@ -3316,7 +3312,7 @@ } if(full && pd != NULL) { - tmp = user_supports_text(pd->srvc_aware, b->name); + tmp = user_supports_text(pd->srvc_aware, purple_buddy_get_name(b)); if(tmp) { purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); g_free(tmp); @@ -3378,7 +3374,7 @@ struct mwConference *conf; struct mwIdBlock idb = { NULL, NULL }; - acct = buddy->account; + acct = purple_buddy_get_account(buddy); gc = purple_account_get_connection(acct); pd = gc->proto_data; srvc = pd->srvc_conf; @@ -3392,7 +3388,7 @@ conf = mwConference_new(srvc, topic); mwConference_open(conf); - idb.user = buddy->name; + idb.user = (char *)purple_buddy_get_name(buddy); mwConference_invite(conf, &idb, invite); } @@ -3412,7 +3408,7 @@ g_return_if_fail(buddy != NULL); - acct = buddy->account; + acct = purple_buddy_get_account(buddy); g_return_if_fail(acct != NULL); gc = purple_account_get_connection(acct); @@ -3432,7 +3428,7 @@ msgA = _("Create conference with user"); msgB = _("Please enter a topic for the new conference, and an invitation" " message to be sent to %s"); - msg1 = g_strdup_printf(msgB, buddy->name); + msg1 = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); purple_request_fields(gc, _("New Conference"), msgA, msg1, fields, @@ -3469,7 +3465,7 @@ blist_menu_conf_create(buddy, msg); } else { - struct mwIdBlock idb = { buddy->name, NULL }; + struct mwIdBlock idb = { (char *)purple_buddy_get_name(buddy), NULL }; mwConference_invite(d, &idb, msg); } } @@ -3490,7 +3486,7 @@ const char *msgB; char *msg; - acct = buddy->account; + acct = purple_buddy_get_account(buddy); g_return_if_fail(acct != NULL); gc = purple_account_get_connection(acct); @@ -3518,7 +3514,7 @@ msgB = _("Select a conference from the list below to send an invite to" " user %s. Select \"Create New Conference\" if you'd like to" " create a new conference to invite this user to."); - msg = g_strdup_printf(msgB, buddy->name); + msg = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); purple_request_fields(gc, _("Invite to Conference"), msgA, msg, fields, @@ -3540,7 +3536,7 @@ g_return_if_fail(node != NULL); g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - acct = buddy->account; + acct = purple_buddy_get_account(buddy); g_return_if_fail(acct != NULL); gc = purple_account_get_connection(acct); @@ -4180,8 +4176,8 @@ if(b) { guint32 type; - if(b->server_alias) { - purple_notify_user_info_add_pair(user_info, _("Full Name"), b->server_alias); + if(purple_buddy_get_server_alias(b)) { + purple_notify_user_info_add_pair(user_info, _("Full Name"), purple_buddy_get_server_alias(b)); } type = purple_blist_node_get_int((PurpleBlistNode *) b, BUDDY_KEY_CLIENT); @@ -4323,10 +4319,10 @@ static void notify_add(PurpleConnection *gc, GList *row, void *user_data) { BuddyAddData *data = user_data; - char *group_name = NULL; + const char *group_name = NULL; if (data && data->group) { - group_name = data->group->name; + group_name = purple_group_get_name(data->group); } purple_blist_request_add_buddy(purple_connection_get_account(gc), @@ -4408,14 +4404,14 @@ buddy = data->buddy; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); pd = gc->proto_data; if(results) res = results->data; if(!code && res && res->matches) { - if(g_list_length(res->matches) == 1) { + if(res->matches->next == NULL) { struct mwResolveMatch *match = res->matches->data; /* only one? that might be the right one! */ @@ -4511,7 +4507,7 @@ return; } - query = g_list_prepend(NULL, buddy->name); + query = g_list_prepend(NULL, (char *)purple_buddy_get_name(buddy)); flags = mwResolveFlag_FIRST | mwResolveFlag_USERS; req = mwServiceResolve_resolve(srvc, query, flags, add_buddy_resolved, @@ -4564,7 +4560,7 @@ /* convert PurpleBuddy into a mwAwareIdBlock */ idb->type = mwAware_USER; - idb->user = (char *) b->name; + idb->user = (char *) purple_buddy_get_name(b); idb->community = NULL; /* put idb into the list associated with the buddy's group */ @@ -4589,7 +4585,7 @@ PurpleBuddy *buddy, PurpleGroup *group) { struct mwPurplePluginData *pd; - struct mwAwareIdBlock idb = { mwAware_USER, buddy->name, NULL }; + struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(buddy), NULL }; struct mwAwareList *list; GList *rem = g_list_prepend(NULL, &idb); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/silc/buddy.c --- a/libpurple/protocols/silc/buddy.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/silc/buddy.c Fri Oct 31 08:21:45 2008 +0000 @@ -322,9 +322,12 @@ silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data) { PurpleBuddy *buddy; + PurpleAccount *account; buddy = (PurpleBuddy *)node; - silcpurple_buddy_keyagr_do(buddy->account->gc, buddy->name, FALSE); + account = purple_buddy_get_account(buddy); + silcpurple_buddy_keyagr_do(purple_account_get_connection(account), + purple_buddy_get_name(buddy), FALSE); } @@ -341,12 +344,12 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); + gc = purple_account_get_connection(purple_buddy_get_account(b)); sg = gc->proto_data; /* Find client entry */ clients = silc_client_get_clients_local(sg->client, sg->conn, - b->name, FALSE); + purple_buddy_get_name(b), FALSE); if (!clients) return; @@ -467,9 +470,9 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - silcpurple_buddy_privkey(gc, buddy->name); + silcpurple_buddy_privkey(gc, purple_buddy_get_name(buddy)); } @@ -596,9 +599,9 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - silcpurple_buddy_getkey(gc, buddy->name); + silcpurple_buddy_getkey(gc, purple_buddy_get_name(buddy)); } static void @@ -613,7 +616,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); + gc = purple_account_get_connection(purple_buddy_get_account(b)); sg = gc->proto_data; pkfile = purple_blist_node_get_string(node, "public-key"); @@ -624,7 +627,7 @@ return; } - silcpurple_show_public_key(sg, b->name, public_key, NULL, NULL); + silcpurple_show_public_key(sg, purple_buddy_get_name(b), public_key, NULL, NULL); silc_pkcs_public_key_free(public_key); } @@ -697,7 +700,7 @@ if (!b->proto_data) { g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), b->name); + _("User %s is not present in the network"), purple_buddy_get_name(b)); purple_notify_error(gc, _("User Information"), _("Cannot get user information"), tmp); return; @@ -721,7 +724,7 @@ { char tmp[512]; g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not trusted"), - r->b->name); + purple_buddy_get_name(r->b)); purple_notify_error(r->client->application, _("Add Buddy"), tmp, _("You cannot receive buddy notifications until you " "import his/her public key. You can use the Get Public Key " @@ -1033,7 +1036,7 @@ /* Now verify the public key */ r->offline_pk = silc_pkcs_public_key_encode(r->public_key, &r->offline_pk_len); - silcpurple_verify_public_key(r->client, r->conn, r->b->name, + silcpurple_verify_public_key(r->client, r->conn, purple_buddy_get_name(r->b), SILC_CONN_CLIENT, r->public_key, silcpurple_add_buddy_save, r); } @@ -1071,7 +1074,7 @@ { char tmp[512]; g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"), - r->b->name); + purple_buddy_get_name(r->b)); purple_request_action(r->client->application, _("Add Buddy"), tmp, _("To add the buddy you must import his/her public key. " "Press Import to import a public key."), 0, @@ -1209,6 +1212,7 @@ const char *filename; SilcClientEntry client_entry = NULL; SilcUInt16 cmd_ident; + const char *name; filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); @@ -1246,17 +1250,19 @@ silc_dlist_start(clients); client_entry = silc_dlist_get(clients); + name = purple_buddy_get_name(b); + /* If we searched using public keys and more than one entry was found the same person is logged on multiple times. */ - if (silc_dlist_count(clients) > 1 && r->pubkey_search && b->name) { + if (silc_dlist_count(clients) > 1 && r->pubkey_search && name) { if (r->init) { /* Find the entry that closest matches to the buddy nickname. */ SilcClientEntry entry; silc_dlist_start(clients); while ((entry = silc_dlist_get(clients))) { - if (!g_ascii_strncasecmp(b->name, entry->nickname, - strlen(b->name))) { + if (!g_ascii_strncasecmp(name, entry->nickname, + strlen(name))) { client_entry = entry; break; } @@ -1335,7 +1341,7 @@ SilcClientConnection conn = sg->conn; SilcPurpleBuddyRes r; SilcBuffer attrs; - const char *filename, *name = b->name; + const char *filename, *name = purple_buddy_get_name(b); r = silc_calloc(1, sizeof(*r)); if (!r) @@ -1395,31 +1401,27 @@ void silcpurple_send_buddylist(PurpleConnection *gc) { - PurpleBuddyList *blist; PurpleBlistNode *gnode, *cnode, *bnode; PurpleBuddy *buddy; PurpleAccount *account; account = purple_connection_get_account(gc); - if ((blist = purple_get_blist()) != NULL) + for (gnode = purple_blist_get_root(); gnode != NULL; gnode = gnode->next) { - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) + if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + continue; + for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; - for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) + for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) + if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) - { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *)bnode; - if (purple_buddy_get_account(buddy) == account) - silcpurple_add_buddy_i(gc, buddy, TRUE); - } + buddy = (PurpleBuddy *)bnode; + if (purple_buddy_get_account(buddy) == account) + silcpurple_add_buddy_i(gc, buddy, TRUE); } } } @@ -1469,7 +1471,9 @@ char *silcpurple_status_text(PurpleBuddy *b) { - SilcPurple sg = b->account->gc->proto_data; + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + SilcPurple sg = gc->proto_data; SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = b->proto_data; @@ -1533,7 +1537,9 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { - SilcPurple sg = b->account->gc->proto_data; + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + SilcPurple sg = gc->proto_data; SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = b->proto_data; @@ -1610,12 +1616,12 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); + gc = purple_account_get_connection(purple_buddy_get_account(b)); sg = gc->proto_data; /* Call KILL */ silc_client_command_call(sg->client, sg->conn, NULL, "KILL", - b->name, "Killed by operator", NULL); + purple_buddy_get_name(b), "Killed by operator", NULL); } typedef struct { @@ -1633,7 +1639,8 @@ GList *silcpurple_buddy_menu(PurpleBuddy *buddy) { - PurpleConnection *gc = purple_account_get_connection(buddy->account); + PurpleAccount *account = purple_buddy_get_account(buddy); + PurpleConnection *gc = purple_account_get_connection(account); SilcPurple sg = gc->proto_data; SilcClientConnection conn = sg->conn; const char *pkfile = NULL; diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/silc/chat.c --- a/libpurple/protocols/silc/chat.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/silc/chat.c Fri Oct 31 08:21:45 2008 +0000 @@ -182,7 +182,9 @@ silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) { PurpleChat *chat = (PurpleChat *)node; - silcpurple_chat_getinfo(chat->account->gc, chat->components); + PurpleAccount *account = purple_chat_get_account(chat); + silcpurple_chat_getinfo(purple_account_get_connection(account), + purple_chat_get_components(chat)); } @@ -496,11 +498,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+C", NULL); } @@ -549,7 +551,7 @@ g_hash_table_replace(comp, "passphrase", g_strdup(passphrase)); cn = purple_chat_new(sg->account, alias, comp); - g = (PurpleGroup *)p->c->node.parent; + g = purple_chat_get_group(p->c); purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); /* Associate to a real channel */ @@ -583,7 +585,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; p = silc_calloc(1, sizeof(*p)); @@ -591,7 +593,7 @@ return; p->sg = sg; - p->channel = g_hash_table_lookup(chat->components, "channel"); + p->channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); p->c = purple_blist_find_chat(sg->account, p->channel); fields = purple_request_fields_new(); @@ -633,11 +635,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-f", NULL); } @@ -652,7 +654,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; if (!sg->conn) @@ -663,7 +665,7 @@ (default key). */ /* Call CMODE */ - channel = g_hash_table_lookup(chat->components, "channel"); + channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, "+f", NULL); } @@ -729,13 +731,13 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; if (!sg->conn) return; - ch = g_strdup(g_hash_table_lookup(chat->components, "channel")); + ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel")); channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); if (!channel) return; @@ -764,11 +766,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-t", NULL); } @@ -782,11 +784,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+t", NULL); } @@ -800,11 +802,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-p", NULL); } @@ -818,11 +820,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+p", NULL); } @@ -836,11 +838,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "-s", NULL); } @@ -854,11 +856,11 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); + gc = purple_account_get_connection(purple_chat_get_account(chat)); sg = gc->proto_data; silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), + g_hash_table_lookup(purple_chat_get_components(chat), "channel"), "+s", NULL); } @@ -877,8 +879,8 @@ GList *silcpurple_chat_menu(PurpleChat *chat) { - GHashTable *components = chat->components; - PurpleConnection *gc = purple_account_get_connection(chat->account); + GHashTable *components = purple_chat_get_components(chat); + PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); SilcPurple sg = gc->proto_data; SilcClientConnection conn = sg->conn; const char *chname = NULL; diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/silc/ops.c --- a/libpurple/protocols/silc/ops.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/silc/ops.c Fri Oct 31 08:21:45 2008 +0000 @@ -431,6 +431,7 @@ va_list va; PurpleConnection *gc = client->application; SilcPurple sg = gc->proto_data; + PurpleAccount *account = purple_connection_get_account(gc); PurpleConversation *convo; SilcClientEntry client_entry, client_entry2; SilcChannelEntry channel; @@ -856,7 +857,7 @@ silc_free(pk); /* Find buddy by associated public key */ - for (gnode = purple_get_blist()->root; gnode; + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -868,7 +869,7 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; - if (b->account != gc->account) + if (purple_buddy_get_account(b) != account) continue; f = purple_blist_node_get_string(bnode, "public-key"); if (f && !strcmp(f, buf)) diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/simple/simple.c --- a/libpurple/protocols/simple/simple.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/simple/simple.c Fri Oct 31 08:21:45 2008 +0000 @@ -196,33 +196,36 @@ { struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; struct simple_buddy *b; - if(strncmp("sip:", buddy->name, 4)) { - gchar *buf = g_strdup_printf("sip:%s", buddy->name); + const char *name = purple_buddy_get_name(buddy); + if(strncmp("sip:", name, 4)) { + gchar *buf = g_strdup_printf("sip:%s", name); purple_blist_rename_buddy(buddy, buf); g_free(buf); } - if(!g_hash_table_lookup(sip->buddies, buddy->name)) { + if(!g_hash_table_lookup(sip->buddies, name)) { b = g_new0(struct simple_buddy, 1); - purple_debug_info("simple", "simple_add_buddy %s\n", buddy->name); - b->name = g_strdup(buddy->name); + purple_debug_info("simple", "simple_add_buddy %s\n", name); + b->name = g_strdup(name); g_hash_table_insert(sip->buddies, b->name, b); } else { - purple_debug_info("simple", "buddy %s already in internal list\n", buddy->name); + purple_debug_info("simple", "buddy %s already in internal list\n", name); } } static void simple_get_buddies(PurpleConnection *gc) { PurpleBlistNode *gnode, *cnode, *bnode; + PurpleAccount *account; purple_debug_info("simple", "simple_get_buddies\n"); - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + account = purple_connection_get_account(gc); + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for(cnode = gnode->child; cnode; cnode = cnode->next) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for(bnode = cnode->child; bnode; bnode = bnode->next) { if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if(((PurpleBuddy*)bnode)->account == gc->account) + if(purple_buddy_get_account((PurpleBuddy*)bnode) == account) simple_add_buddy(gc, (PurpleBuddy*)bnode, (PurpleGroup *)gnode); } } @@ -231,9 +234,10 @@ static void simple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { + const char *name = purple_buddy_get_name(buddy); struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; - struct simple_buddy *b = g_hash_table_lookup(sip->buddies, buddy->name); - g_hash_table_remove(sip->buddies, buddy->name); + struct simple_buddy *b = g_hash_table_lookup(sip->buddies, name); + g_hash_table_remove(sip->buddies, name); g_free(b->name); g_free(b); } @@ -922,7 +926,7 @@ purple_blist_add_buddy(b, NULL, g, NULL); purple_blist_alias_buddy(b, uri); bs = g_new0(struct simple_buddy, 1); - bs->name = g_strdup(b->name); + bs->name = g_strdup(purple_buddy_get_name(b)); g_hash_table_insert(sip->buddies, bs->name, bs); } xmlnode_free(isc); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Fri Oct 31 08:21:45 2008 +0000 @@ -385,7 +385,7 @@ for (i = list; i; i = i->next) { b = i->data; g = purple_buddy_get_group(b); - if (!purple_utf8_strcasecmp(group, g->name)) { + if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) { purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Oh good, %s is in the right group (%s).\n", name, group); list = g_slist_delete_link(list, i); @@ -423,7 +423,8 @@ for (i = list; i; i = i->next) { b = i->data; g = purple_buddy_get_group(b); - purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, g->name); + purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, + purple_group_get_name(g)); purple_blist_remove_buddy(b); } } @@ -2027,21 +2028,23 @@ return; group = purple_buddy_get_group(buddy); - name = g_strdup(buddy->name); - account = buddy->account; + name = g_strdup(purple_buddy_get_name(buddy)); + account = purple_buddy_get_account(buddy); purple_debug(PURPLE_DEBUG_INFO, "blist", - "Removing '%s' from buddy list.\n", buddy->name); + "Removing '%s' from buddy list.\n", name); purple_account_remove_buddy(account, buddy, group); purple_blist_remove_buddy(buddy); - serv_add_deny(account->gc, name); + serv_add_deny(purple_account_get_connection(account), name); g_free(name); } -static void keep_buddy(PurpleBuddy *b) { - purple_privacy_deny_remove(b->account, b->name, 1); +static void keep_buddy(PurpleBuddy *b) +{ + purple_privacy_deny_remove(purple_buddy_get_account(b), + purple_buddy_get_name(b), 1); } static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { @@ -3121,11 +3124,12 @@ YahooFriend *f; PurplePresence *presence; - if (!b || !(account = b->account) || !(gc = purple_account_get_connection(account)) || - !(yd = gc->proto_data)) + if (!b || !(account = purple_buddy_get_account(b)) || + !(gc = purple_account_get_connection(account)) || + !(yd = gc->proto_data)) return NULL; - f = yahoo_friend_find(gc, b->name); + f = yahoo_friend_find(gc, purple_buddy_get_name(b)); if (!f) { return "not-authorized"; } @@ -3185,7 +3189,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); yd = gc->proto_data; id = yd->conf_id; @@ -3197,7 +3201,7 @@ yahoo_c_join(gc, components); g_hash_table_destroy(components); - yahoo_c_invite(gc, id, "Join my conference...", buddy->name); + yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy)); } static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { @@ -3206,9 +3210,9 @@ int presence_val = GPOINTER_TO_INT(data); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - yahoo_friend_update_presence(gc, buddy->name, presence_val); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); + + yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val); } static void yahoo_game(PurpleBlistNode *node, gpointer data) { @@ -3226,10 +3230,10 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); yd = (struct yahoo_data *) gc->proto_data; - f = yahoo_friend_find(gc, buddy->name); + f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); if (!f) return; @@ -3251,8 +3255,10 @@ YahooFriend *f = NULL; const char *msg; char *msg2; - - f = yahoo_friend_find(b->account->gc, b->name); + PurpleAccount *account; + + account = purple_buddy_get_account(b); + f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); if (!f) return g_strdup(_("Not on server list")); @@ -3281,8 +3287,10 @@ char *escaped; char *status = NULL; const char *presence = NULL; - - f = yahoo_friend_find(b->account->gc, b->name); + PurpleAccount *account; + + account = purple_buddy_get_account(b); + f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); if (!f) status = g_strdup_printf("\n%s", _("Not on server list")); else { @@ -3333,7 +3341,7 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); yahoo_add_buddy(gc, buddy, NULL); } @@ -3347,9 +3355,9 @@ g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - yahoo_chat_goto(gc, buddy->name); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); + + yahoo_chat_goto(gc, purple_buddy_get_name(buddy)); } static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { @@ -3393,9 +3401,10 @@ static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data) { PurpleBuddy *b = (PurpleBuddy *)node; - PurpleConnection *gc = b->account->gc; - - yahoo_doodle_initiate(gc, b->name); + PurpleAccount *account = purple_buddy_get_account(b); + PurpleConnection *gc = purple_account_get_connection(account); + + yahoo_doodle_initiate(gc, purple_buddy_get_name(b)); } static GList *yahoo_buddy_menu(PurpleBuddy *buddy) @@ -3403,12 +3412,12 @@ GList *m = NULL; PurpleMenuAction *act; - PurpleConnection *gc = purple_account_get_connection(buddy->account); + PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); struct yahoo_data *yd = gc->proto_data; static char buf2[1024]; YahooFriend *f; - f = yahoo_friend_find(gc, buddy->name); + f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); if (!f && !yd->wm) { act = purple_menu_action_new(_("Add Buddy"), @@ -3917,19 +3926,20 @@ const char *group = NULL; char *group2; YahooFriend *f; + const char *bname; if (!yd->logged_in) return; - if (!purple_privacy_check(purple_connection_get_account(gc), - purple_buddy_get_name(buddy))) + bname = purple_buddy_get_name(buddy); + if (!purple_privacy_check(purple_connection_get_account(gc), bname)) return; - f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); + f = yahoo_friend_find(gc, bname); g = purple_buddy_get_group(buddy); if (g) - group = g->name; + group = purple_group_get_name(g); else group = "Buddies"; @@ -3942,7 +3952,7 @@ 1, purple_connection_get_display_name(gc), 302, "319", 300, "319", - 7, buddy->name, + 7, bname, 334, "0", 301, "319", 303, "319" @@ -3956,19 +3966,22 @@ static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; - struct yahoo_packet *pkt; + struct yahoo_packet *pkt; GSList *buddies, *l; PurpleGroup *g; gboolean remove = TRUE; char *cg; - - if (!(yahoo_friend_find(gc, buddy->name))) + const char *bname, *gname; + + bname = purple_buddy_get_name(buddy); + if (!(yahoo_friend_find(gc, bname))) return; - buddies = purple_find_buddies(purple_connection_get_account(gc), buddy->name); + gname = purple_group_get_name(group); + buddies = purple_find_buddies(purple_connection_get_account(gc), bname); for (l = buddies; l; l = l->next) { g = purple_buddy_get_group(l->data); - if (purple_utf8_strcasecmp(group->name, g->name)) { + if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) { remove = FALSE; break; } @@ -3977,12 +3990,12 @@ g_slist_free(buddies); if (remove) - g_hash_table_remove(yd->friends, buddy->name); - - cg = yahoo_string_encode(gc, group->name, NULL); + g_hash_table_remove(yd->friends, bname); + + cg = yahoo_string_encode(gc, gname, NULL); pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), - 7, buddy->name, 65, cg); + 7, bname, 65, cg); yahoo_packet_send_and_free(pkt, yd); g_free(cg); } @@ -4091,7 +4104,7 @@ struct yahoo_packet *pkt; char *gpn, *gpo; - gpn = yahoo_string_encode(gc, group->name, NULL); + gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); gpo = yahoo_string_encode(gc, old_name, NULL); if (!strcmp(gpn, gpo)) { g_free(gpn); diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/yahoo/yahoo_profile.c --- a/libpurple/protocols/yahoo/yahoo_profile.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo_profile.c Fri Oct 31 08:21:45 2008 +0000 @@ -715,7 +715,7 @@ /* Add the normal tooltip pairs */ yahoo_tooltip_text(b, user_info, TRUE); - if ((f = yahoo_friend_find(info_data->gc, b->name))) { + if ((f = yahoo_friend_find(info_data->gc, purple_buddy_get_name(b)))) { const char *ip; if ((ip = yahoo_friend_get_ip(f))) purple_notify_user_info_add_pair(user_info, _("IP Address"), ip); @@ -1215,7 +1215,9 @@ * in which case the user may or may not actually exist. * Hence this extra step. */ - f = yahoo_friend_find(b->account->gc, b->name); + PurpleAccount *account = purple_buddy_get_account(b); + f = yahoo_friend_find(purple_account_get_connection(account), + purple_buddy_get_name(b)); } g_string_append_printf(str, "%s

", f? _("Could not retrieve the user's profile. " diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/yahoo/yahoochat.c --- a/libpurple/protocols/yahoo/yahoochat.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoochat.c Fri Oct 31 08:21:45 2008 +0000 @@ -514,12 +514,12 @@ c = purple_find_chat(gc, YAHOO_CHAT_ID); if (room && (!c || purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) && members && - ((g_list_length(members) > 1) || + ((members->next != NULL) || !g_ascii_strcasecmp(members->data, purple_connection_get_display_name(gc)))) { int i; GList *flags = NULL; for (i = 0; i < g_list_length(members); i++) - flags = g_list_append(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE)); + flags = g_list_prepend(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE)); if (c && purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) { /* this might be a hack, but oh well, it should nicely */ char *tmpmsg; diff -r de22f550bae2 -r da46097b4722 libpurple/protocols/zephyr/zephyr.c --- a/libpurple/protocols/zephyr/zephyr.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/protocols/zephyr/zephyr.c Fri Oct 31 08:21:45 2008 +0000 @@ -732,7 +732,7 @@ return ret; } -static gboolean pending_zloc(zephyr_account *zephyr,char *who) +static gboolean pending_zloc(zephyr_account *zephyr, const char *who) { GList *curr; @@ -771,6 +771,8 @@ int nlocs; char *user; PurpleBuddy *b; + const char *bname; + /* XXX add real error reporting */ if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) return; @@ -780,13 +782,15 @@ b = purple_find_buddy(gc->account,stripped_user); g_free(stripped_user); } - if ((b && pending_zloc(zephyr,b->name)) || pending_zloc(zephyr,user)) { + + bname = b ? purple_buddy_get_name(b) : NULL; + if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user)) { ZLocations_t locs; int one = 1; PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); char *tmp; - purple_notify_user_info_add_pair(user_info, _("User"), (b ? b->name : user)); + purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); if (b && b->alias) purple_notify_user_info_add_pair(user_info, _("Alias"), b->alias); @@ -801,14 +805,14 @@ purple_notify_user_info_add_pair(user_info, _("Location"), tmp); g_free(tmp); } - purple_notify_userinfo(gc, (b ? b->name : user), + purple_notify_userinfo(gc, (b ? bname : user), user_info, NULL, NULL); purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); } g_free(user); @@ -1142,6 +1146,7 @@ /* XXX fix */ char *user; PurpleBuddy *b; + const char *bname; int nlocs = 0; parse_tree *locations; gchar *locval; @@ -1161,11 +1166,12 @@ nlocs = 1; } - if ((b && pending_zloc(zephyr,b->name)) || pending_zloc(zephyr,user) || pending_zloc(zephyr,local_zephyr_normalize(zephyr,user))){ + bname = b ? purple_buddy_get_name(b) : NULL; + if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user) || pending_zloc(zephyr,local_zephyr_normalize(zephyr,user))){ PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); char *tmp; - purple_notify_user_info_add_pair(user_info, _("User"), (b ? b->name : user)); + purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); if (b && b->alias) purple_notify_user_info_add_pair(user_info, _("Alias"), b->alias); @@ -1180,14 +1186,14 @@ g_free(tmp); } - purple_notify_userinfo(gc, b ? b->name : user, + purple_notify_userinfo(gc, b ? bname : user, user_info, NULL, NULL); purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL); + purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); } } else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) { @@ -1247,12 +1253,12 @@ static gint check_loc(gpointer_data) { - PurpleBlistNode *gnode, *cnode, *bnode; - ZLocations_t locations; - int numlocs; - int one = 1; + PurpleBlistNode *gnode, *cnode, *bnode; + ZLocations_t locations; + int numlocs; + int one = 1; - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for (cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1263,22 +1269,23 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if (b->account->gc == zgc) { + if (purple_buddy_get_account(b)->gc == zgc) { char *chk; - chk = local_zephyr_normalize(b->name); - ZLocateUser(chk,&numlocs, ZAUTH); - if (numlocs) { - int i; - for(i=0;iname,1,0,0,0,0); - } - } - } - } - } - } - return TRUE; + const char *bname = purple_buddy_get_name(b); + chk = local_zephyr_normalize(bname); + ZLocateUser(chk,&numlocs, ZAUTH); + if (numlocs) { + int i; + for(i=0;iproto_data; + PurpleAccount *account = purple_connection_get_account(gc); if (use_zeph02(zephyr)) { ald.user = NULL; @@ -1296,7 +1304,7 @@ ald.version = NULL; } - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for (cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1307,11 +1315,12 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; - if (b->account->gc == gc) { + if (purple_buddy_get_account(b) == account) { const char *chk; + const char *name = purple_buddy_get_name(b); - chk = local_zephyr_normalize(zephyr,b->name); - purple_debug_info("zephyr","chk: %s b->name %s\n",chk,b->name); + chk = local_zephyr_normalize(zephyr,name); + purple_debug_info("zephyr","chk: %s b->name %s\n",chk,name); /* XXX add real error reporting */ /* doesn't matter if this fails or not; we'll just move on to the next one */ if (use_zeph02(zephyr)) { @@ -1324,9 +1333,9 @@ for(i=0;i0) - purple_prpl_got_user_status(gc->account,b->name,"available",NULL); + purple_prpl_got_user_status(account,name,"available",NULL); else - purple_prpl_got_user_status(gc->account,b->name,"offline",NULL); + purple_prpl_got_user_status(account,name,"offline",NULL); } } #else @@ -1934,6 +1943,7 @@ PurpleBuddy *b; char *fname; FILE *fd; + PurpleAccount *account; zephyr_account* zephyr = gc->proto_data; fname = g_strdup_printf("%s/.anyone", purple_home_dir()); fd = g_fopen(fname, "w"); @@ -1942,7 +1952,8 @@ return; } - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + account = purple_connection_get_account(gc); + for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for (cnode = gnode->child; cnode; cnode = cnode->next) { @@ -1952,8 +1963,8 @@ if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *) bnode; - if (b->account == gc->account) { - gchar *stripped_user = zephyr_strip_local_realm(zephyr,b->name); + if (purple_buddy_get_account(b) == account) { + gchar *stripped_user = zephyr_strip_local_realm(zephyr, purple_buddy_get_name(b)); fprintf(fd, "%s\n", stripped_user); g_free(stripped_user); } @@ -2496,26 +2507,28 @@ PurpleBlistNode *gnode, *cnode; /* XXX needs to be %host%,%canon%, and %me% clean */ - for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + for(gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { for(cnode = gnode->child; cnode; cnode = cnode->next) { PurpleChat *chat = (PurpleChat*)cnode; char *zclass, *inst, *recip; char** triple; + GHashTable *components; if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) continue; - if(chat->account !=account) - continue; - if(!(zclass = g_hash_table_lookup(chat->components, "class"))) + if(purple_chat_get_account(chat) != account) continue; - if(!(inst = g_hash_table_lookup(chat->components, "instance"))) + components = purple_chat_get_components(chat); + if(!(zclass = g_hash_table_lookup(components, "class"))) + continue; + if(!(inst = g_hash_table_lookup(components, "instance"))) inst = g_strdup(""); - if(!(recip = g_hash_table_lookup(chat->components, "recipient"))) + if(!(recip = g_hash_table_lookup(components, "recipient"))) recip = g_strdup(""); /* purple_debug_info("zephyr","in zephyr_find_blist_chat name: %s\n",name?name:""); */ triple = g_strsplit(name,",",3); if (!g_ascii_strcasecmp(triple[0],zclass) && !g_ascii_strcasecmp(triple[1],inst) && !g_ascii_strcasecmp(triple[2],recip)) return chat; - + } } return NULL; diff -r de22f550bae2 -r da46097b4722 libpurple/sslconn.c --- a/libpurple/sslconn.c Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/sslconn.c Fri Oct 31 08:21:45 2008 +0000 @@ -23,6 +23,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#define _PURPLE_SSLCONN_C_ + #include "internal.h" #include "certificate.h" diff -r de22f550bae2 -r da46097b4722 libpurple/sslconn.h --- a/libpurple/sslconn.h Fri Oct 31 08:09:31 2008 +0000 +++ b/libpurple/sslconn.h Fri Oct 31 08:21:45 2008 +0000 @@ -185,7 +185,7 @@ PurpleSslErrorFunction error_func, void *data); -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_SSLCONN_C_) /** * Makes a SSL connection using an already open file descriptor. * diff -r de22f550bae2 -r da46097b4722 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkconv.c Fri Oct 31 08:21:45 2008 +0000 @@ -24,6 +24,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ +#define _PIDGIN_GTKCONV_C_ + #include "internal.h" #include "pidgin.h" diff -r de22f550bae2 -r da46097b4722 pidgin/gtkconv.h --- a/pidgin/gtkconv.h Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkconv.h Fri Oct 31 08:21:45 2008 +0000 @@ -143,7 +143,7 @@ GtkWidget *tab_label; GtkWidget *menu_icon; GtkWidget *menu_label; -#ifndef PIDGIN_DISABLE_DEPRECATED +#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKCONV_C_) /** @deprecated */ GtkSizeGroup *sg; #else diff -r de22f550bae2 -r da46097b4722 pidgin/gtkdialogs.c --- a/pidgin/gtkdialogs.c Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkdialogs.c Fri Oct 31 08:21:45 2008 +0000 @@ -23,6 +23,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#define _PIDGIN_GTKDIALOGS_C_ + #include "internal.h" #include "pidgin.h" @@ -967,7 +969,7 @@ static void pidgin_dialogs_alias_contact_cb(PurpleContact *contact, const char *new_alias) { - purple_contact_set_alias(contact, new_alias); + purple_blist_alias_contact(contact, new_alias); } void diff -r de22f550bae2 -r da46097b4722 pidgin/gtkdialogs.h --- a/pidgin/gtkdialogs.h Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkdialogs.h Fri Oct 31 08:21:45 2008 +0000 @@ -38,11 +38,13 @@ void pidgin_dialogs_info(void); void pidgin_dialogs_log(void); +#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKDIALOGS_C_) /** * @deprecated This function is no longer used and will be removed in * Pidgin 3.0.0 unless there is sufficient demand to keep it. */ void pidgin_dialogs_alias_contact(PurpleContact *); +#endif void pidgin_dialogs_alias_buddy(PurpleBuddy *); void pidgin_dialogs_alias_chat(PurpleChat *); @@ -55,9 +57,12 @@ /* Everything after this should probably be moved elsewhere */ #ifndef PIDGIN_DISABLE_DEPRECATED +/* This PIDGIN_DISABLE_DEPRECATED doesn't need to be deactivated by + * _PIDGIN_GTKDIALOGS_C_, because it shouldn't be using this macro. */ #define PIDGIN_DIALOG(x) x = gtk_window_new(GTK_WINDOW_TOPLEVEL); \ gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG) #endif + #define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) #endif /* _PIDGINDIALOGS_H_ */ diff -r de22f550bae2 -r da46097b4722 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkimhtml.c Fri Oct 31 08:21:45 2008 +0000 @@ -24,6 +24,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ +#define _PIDGIN_GTKIMHTML_C_ #ifdef HAVE_CONFIG_H #include diff -r de22f550bae2 -r da46097b4722 pidgin/gtkimhtml.h --- a/pidgin/gtkimhtml.h Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkimhtml.h Fri Oct 31 08:21:45 2008 +0000 @@ -130,7 +130,7 @@ GtkTextTag *link; } edit; -#ifndef PIDGIN_DISABLE_DEPRECATED +#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKIMHTML_C_) /** @deprecated */ char *clipboard_text_string; /** @deprecated */ diff -r de22f550bae2 -r da46097b4722 pidgin/gtkutils.c --- a/pidgin/gtkutils.c Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkutils.c Fri Oct 31 08:21:45 2008 +0000 @@ -23,6 +23,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#define _PIDGIN_GTKUTILS_C_ + #include "internal.h" #include "pidgin.h" @@ -2878,7 +2880,6 @@ } #endif /* ! Gtk 2.6.0 */ -#ifndef PURPLE_DISABLE_DEPRECATED void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename) { PurpleBuddy *buddy; @@ -2893,7 +2894,6 @@ contact = purple_buddy_get_contact(buddy); purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, filename); } -#endif char *pidgin_make_pretty_arrows(const char *str) { diff -r de22f550bae2 -r da46097b4722 pidgin/gtkutils.h --- a/pidgin/gtkutils.h Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/gtkutils.h Fri Oct 31 08:21:45 2008 +0000 @@ -638,7 +638,7 @@ GError **error); #endif -#ifndef PURPLE_DISABLE_DEPRECATED +#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKUTILS_C_) /** * Set or unset a custom buddyicon for a user. * diff -r de22f550bae2 -r da46097b4722 pidgin/pidgintooltip.c --- a/pidgin/pidgintooltip.c Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/pidgintooltip.c Fri Oct 31 08:21:45 2008 +0000 @@ -61,7 +61,9 @@ static void initialize_tooltip_delay() { +#if GTK_CHECK_VERSION(2,14,0) GtkSettings *settings; +#endif if (tooltip_delay != -1) return; diff -r de22f550bae2 -r da46097b4722 pidgin/plugins/perl/common/gtkmodule.h --- a/pidgin/plugins/perl/common/gtkmodule.h Fri Oct 31 08:09:31 2008 +0000 +++ b/pidgin/plugins/perl/common/gtkmodule.h Fri Oct 31 08:21:45 2008 +0000 @@ -1,3 +1,7 @@ +/* Allow the Perl code to see deprecated functions, so we can continue to + * export them to Perl plugins. */ +#undef PIDGIN_DISABLE_DEPRECATED + typedef struct group *Pidgin__Group; #define group perl_group