diff pidgin/gtkblist.c @ 15823:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 84b0f9b23ede
children 66dff3dfdea6
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Mon Mar 19 06:11:46 2007 +0000
+++ b/pidgin/gtkblist.c	Mon Mar 19 07:01:17 2007 +0000
@@ -2,9 +2,9 @@
  * @file gtkblist.c GTK+ BuddyList API
  * @ingroup gtkui
  *
- * gaim
+ * purple
  *
- * Gaim is the legal property of its developers, whose names are too numerous
+ * Purple is the legal property of its developers, whose names are too numerous
  * to list here.  Please refer to the COPYRIGHT file distributed with this
  * source distribution.
  *
@@ -65,7 +65,7 @@
 
 typedef struct
 {
-	GaimAccount *account;
+	PurpleAccount *account;
 
 	GtkWidget *window;
 	GtkWidget *combo;
@@ -77,7 +77,7 @@
 
 typedef struct
 {
-	GaimAccount *account;
+	PurpleAccount *account;
 	gchar *default_chat_name;
 
 	GtkWidget *window;
@@ -93,7 +93,7 @@
 
 typedef struct
 {
-	GaimAccount *account;
+	PurpleAccount *account;
 
 	GtkWidget *window;
 	GtkWidget *account_menu;
@@ -111,29 +111,29 @@
 
 static GList *pidgin_blist_sort_methods = NULL;
 static struct pidgin_blist_sort_method *current_sort_method = NULL;
-static void sort_method_none(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
+static void sort_method_none(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
 
 /* The functions we use for sorting aren't available in gtk 2.0.x, and
  * segfault in 2.2.0.  2.2.1 is known to work, so I'll require that */
 #if GTK_CHECK_VERSION(2,2,1)
-static void sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
-static void sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
-static void sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
+static void sort_method_alphabetical(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
+static void sort_method_status(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
+static void sort_method_log(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
 #endif
 static PidginBuddyList *gtkblist = NULL;
 
-static gboolean pidgin_blist_refresh_timer(GaimBuddyList *list);
-static void pidgin_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node, gboolean statusChange);
+static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list);
+static void pidgin_blist_update_buddy(PurpleBuddyList *list, PurpleBlistNode *node, gboolean statusChange);
 static void pidgin_blist_selection_changed(GtkTreeSelection *selection, gpointer data);
-static void pidgin_blist_update(GaimBuddyList *list, GaimBlistNode *node);
-static void pidgin_blist_update_group(GaimBuddyList *list, GaimBlistNode *node);
-static void pidgin_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node);
-static char *pidgin_get_tooltip_text(GaimBlistNode *node, gboolean full);
+static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node);
+static void pidgin_blist_update_group(PurpleBuddyList *list, PurpleBlistNode *node);
+static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node);
+static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full);
 static const char *item_factory_translate_func (const char *path, gpointer func_data);
-static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter);
-static void redo_buddy_list(GaimBuddyList *list, gboolean remove, gboolean rerender);
-static void pidgin_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node);
-static char *pidgin_get_group_title(GaimBlistNode *gnode, gboolean expanded);
+static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter);
+static void redo_buddy_list(PurpleBuddyList *list, gboolean remove, gboolean rerender);
+static void pidgin_blist_collapse_contact_cb(GtkWidget *w, PurpleBlistNode *node);
+static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded);
 
 static void pidgin_blist_tooltip_destroy(void);
 
@@ -168,7 +168,7 @@
 		gtk_blist_obscured = TRUE;
 	else if (gtk_blist_obscured) {
 			gtk_blist_obscured = FALSE;
-			pidgin_blist_refresh_timer(gaim_get_blist());
+			pidgin_blist_refresh_timer(purple_get_blist());
 	}
 
 	/* continue to handle event normally */
@@ -179,24 +179,24 @@
 {
 	if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) {
 		if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)
-			gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", FALSE);
+			purple_prefs_set_bool("/purple/gtk/blist/list_visible", FALSE);
 		else {
-			gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", TRUE);
-			pidgin_blist_refresh_timer(gaim_get_blist());
+			purple_prefs_set_bool("/purple/gtk/blist/list_visible", TRUE);
+			pidgin_blist_refresh_timer(purple_get_blist());
 		}
 	}
 
 	if(event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
 		if(event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
-			gaim_prefs_set_bool("/gaim/gtk/blist/list_maximized", TRUE);
+			purple_prefs_set_bool("/purple/gtk/blist/list_maximized", TRUE);
 		else
-			gaim_prefs_set_bool("/gaim/gtk/blist/list_maximized", FALSE);
+			purple_prefs_set_bool("/purple/gtk/blist/list_maximized", FALSE);
 	}
 
 	/* Refresh gtkblist if un-iconifying */
 	if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED){
 		if (!(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED))
-			pidgin_blist_refresh_timer(gaim_get_blist());
+			pidgin_blist_refresh_timer(purple_get_blist());
 	}
 
 	return FALSE;
@@ -205,9 +205,9 @@
 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
 {
 	if(visibility_manager_count)
-		gaim_blist_set_visible(FALSE);
+		purple_blist_set_visible(FALSE);
 	else
-		gaim_core_quit();
+		purple_core_quit();
 
 	/* we handle everything, event should not propogate further */
 	return TRUE;
@@ -239,10 +239,10 @@
 #endif
 
 	/* don't save if nothing changed */
-	if (x == gaim_prefs_get_int("/gaim/gtk/blist/x") &&
-		y == gaim_prefs_get_int("/gaim/gtk/blist/y") &&
-		event->width  == gaim_prefs_get_int("/gaim/gtk/blist/width") &&
-		event->height == gaim_prefs_get_int("/gaim/gtk/blist/height")) {
+	if (x == purple_prefs_get_int("/purple/gtk/blist/x") &&
+		y == purple_prefs_get_int("/purple/gtk/blist/y") &&
+		event->width  == purple_prefs_get_int("/purple/gtk/blist/width") &&
+		event->height == purple_prefs_get_int("/purple/gtk/blist/height")) {
 
 		return FALSE; /* carry on normally */
 	}
@@ -257,57 +257,57 @@
 	}
 
 	/* ignore changes when maximized */
-	if(gaim_prefs_get_bool("/gaim/gtk/blist/list_maximized"))
+	if(purple_prefs_get_bool("/purple/gtk/blist/list_maximized"))
 		return FALSE;
 
 	/* store the position */
-	gaim_prefs_set_int("/gaim/gtk/blist/x",      x);
-	gaim_prefs_set_int("/gaim/gtk/blist/y",      y);
-	gaim_prefs_set_int("/gaim/gtk/blist/width",  event->width);
-	gaim_prefs_set_int("/gaim/gtk/blist/height", event->height);
+	purple_prefs_set_int("/purple/gtk/blist/x",      x);
+	purple_prefs_set_int("/purple/gtk/blist/y",      y);
+	purple_prefs_set_int("/purple/gtk/blist/width",  event->width);
+	purple_prefs_set_int("/purple/gtk/blist/height", event->height);
 
 	gtk_widget_set_size_request(gtkblist->headline_label,
-				    gaim_prefs_get_int("/gaim/gtk/blist/width")-25,-1);
+				    purple_prefs_get_int("/purple/gtk/blist/width")-25,-1);
 	/* continue to handle event normally */
 	return FALSE;
 }
 
-static void gtk_blist_menu_info_cb(GtkWidget *w, GaimBuddy *b)
+static void gtk_blist_menu_info_cb(GtkWidget *w, PurpleBuddy *b)
 {
 	serv_get_info(b->account->gc, b->name);
 }
 
-static void gtk_blist_menu_im_cb(GtkWidget *w, GaimBuddy *b)
+static void gtk_blist_menu_im_cb(GtkWidget *w, PurpleBuddy *b)
 {
 	pidgindialogs_im_with_user(b->account, b->name);
 }
 
-static void gtk_blist_menu_send_file_cb(GtkWidget *w, GaimBuddy *b)
+static void gtk_blist_menu_send_file_cb(GtkWidget *w, PurpleBuddy *b)
 {
 	serv_send_file(b->account->gc, b->name, NULL);
 }
 
-static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat)
-{
-	gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin",
+static void gtk_blist_menu_autojoin_cb(GtkWidget *w, PurpleChat *chat)
+{
+	purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin",
 			gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
 }
 
-static void gtk_blist_join_chat(GaimChat *chat)
-{
-	GaimConversation *conv;
-
-	conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
-											   gaim_chat_get_name(chat),
+static void gtk_blist_join_chat(PurpleChat *chat)
+{
+	PurpleConversation *conv;
+
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
+											   purple_chat_get_name(chat),
 											   chat->account);
 
 	if (conv != NULL)
-		gaim_conversation_present(conv);
+		purple_conversation_present(conv);
 
 	serv_join_chat(chat->account->gc, chat->components);
 }
 
-static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
+static void gtk_blist_menu_join_cb(GtkWidget *w, PurpleChat *chat)
 {
 	gtk_blist_join_chat(chat);
 }
@@ -318,8 +318,8 @@
 	GtkTreeIter iter;
 	GtkTreePath *path;
 	GValue val;
-	GaimBlistNode *node;
-	GaimGroup *dest;
+	PurpleBlistNode *node;
+	PurpleGroup *dest;
 
 	path = gtk_tree_path_new_from_string (arg1);
 	gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
@@ -332,42 +332,42 @@
 
 	switch (node->type)
 	{
-		case GAIM_BLIST_CONTACT_NODE:
+		case PURPLE_BLIST_CONTACT_NODE:
 			{
-				GaimContact *contact = (GaimContact *)node;
+				PurpleContact *contact = (PurpleContact *)node;
 				struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
 
 				if (contact->alias || gtknode->contact_expanded)
-					gaim_blist_alias_contact(contact, arg2);
+					purple_blist_alias_contact(contact, arg2);
 				else
 				{
-					GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact);
-					gaim_blist_alias_buddy(buddy, arg2);
+					PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact);
+					purple_blist_alias_buddy(buddy, arg2);
 					serv_alias_buddy(buddy);
 				}
 			}
 			break;
 
-		case GAIM_BLIST_BUDDY_NODE:
-			gaim_blist_alias_buddy((GaimBuddy*)node, arg2);
-			serv_alias_buddy((GaimBuddy *)node);
+		case PURPLE_BLIST_BUDDY_NODE:
+			purple_blist_alias_buddy((PurpleBuddy*)node, arg2);
+			serv_alias_buddy((PurpleBuddy *)node);
 			break;
-		case GAIM_BLIST_GROUP_NODE:
-			dest = gaim_find_group(arg2);
-			if (dest != NULL && strcmp(arg2, ((GaimGroup*) node)->name)) {
-				pidgindialogs_merge_groups((GaimGroup*) node, arg2);
+		case PURPLE_BLIST_GROUP_NODE:
+			dest = purple_find_group(arg2);
+			if (dest != NULL && strcmp(arg2, ((PurpleGroup*) node)->name)) {
+				pidgindialogs_merge_groups((PurpleGroup*) node, arg2);
 			} else
-				gaim_blist_rename_group((GaimGroup*)node, arg2);
+				purple_blist_rename_group((PurpleGroup*)node, arg2);
 			break;
-		case GAIM_BLIST_CHAT_NODE:
-			gaim_blist_alias_chat((GaimChat*)node, arg2);
+		case PURPLE_BLIST_CHAT_NODE:
+			purple_blist_alias_chat((PurpleChat*)node, arg2);
 			break;
 		default:
 			break;
 	}
 }
 
-static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
+static void gtk_blist_menu_alias_cb(GtkWidget *w, PurpleBlistNode *node)
 {
 	GtkTreeIter iter;
 	GtkTreePath *path;
@@ -383,17 +383,17 @@
 	}
 
 	switch (node->type) {
-	case GAIM_BLIST_BUDDY_NODE:
-		text = gaim_buddy_get_alias((GaimBuddy *)node);
+	case PURPLE_BLIST_BUDDY_NODE:
+		text = purple_buddy_get_alias((PurpleBuddy *)node);
 		break;
-	case GAIM_BLIST_CONTACT_NODE:
-		text = gaim_contact_get_alias((GaimContact *)node);
+	case PURPLE_BLIST_CONTACT_NODE:
+		text = purple_contact_get_alias((PurpleContact *)node);
 		break;
-	case GAIM_BLIST_GROUP_NODE:
-		text = ((GaimGroup *)node)->name;
+	case PURPLE_BLIST_GROUP_NODE:
+		text = ((PurpleGroup *)node)->name;
 		break;
-	case GAIM_BLIST_CHAT_NODE:
-		text = gaim_chat_get_name((GaimChat *)node);
+	case PURPLE_BLIST_CHAT_NODE:
+		text = purple_chat_get_name((PurpleChat *)node);
 		break;
 	default:
 		g_return_if_reached();
@@ -416,35 +416,35 @@
 	gtk_tree_path_free(path);
 }
 
-static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
+static void gtk_blist_menu_bp_cb(GtkWidget *w, PurpleBuddy *b)
 {
 	pidgin_pounce_editor_show(b->account, b->name, NULL);
 }
 
-static void gtk_blist_menu_showlog_cb(GtkWidget *w, GaimBlistNode *node)
-{
-	GaimLogType type;
-	GaimAccount *account;
+static void gtk_blist_menu_showlog_cb(GtkWidget *w, PurpleBlistNode *node)
+{
+	PurpleLogType type;
+	PurpleAccount *account;
 	char *name = NULL;
 
 	pidgin_set_cursor(gtkblist->window, GDK_WATCH);
 
-	if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		GaimBuddy *b = (GaimBuddy*) node;
-		type = GAIM_LOG_IM;
+	if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		PurpleBuddy *b = (PurpleBuddy*) node;
+		type = PURPLE_LOG_IM;
 		name = g_strdup(b->name);
 		account = b->account;
-	} else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
-		GaimChat *c = (GaimChat*) node;
-		GaimPluginProtocolInfo *prpl_info = NULL;
-		type = GAIM_LOG_CHAT;
+	} else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		PurpleChat *c = (PurpleChat*) node;
+		PurplePluginProtocolInfo *prpl_info = NULL;
+		type = PURPLE_LOG_CHAT;
 		account = c->account;
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account)));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account)));
 		if (prpl_info && prpl_info->get_chat_name) {
 			name = prpl_info->get_chat_name(c->components);
 		}
-	} else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		pidgin_log_show_contact((GaimContact *)node);
+	} else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+		pidgin_log_show_contact((PurpleContact *)node);
 		pidgin_clear_cursor(gtkblist->window);
 		return;
 	} else {
@@ -470,7 +470,7 @@
 
 static void gtk_blist_show_onlinehelp_cb()
 {
-	gaim_notify_uri(NULL, GAIM_WEBSITE "documentation.php");
+	purple_notify_uri(NULL, PURPLE_WEBSITE "documentation.php");
 }
 
 static void
@@ -481,7 +481,7 @@
 		GHashTable *components =
 			g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 		GList *tmp;
-		GaimChat *chat;
+		PurpleChat *chat;
 
 		for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
 		{
@@ -500,9 +500,9 @@
 			}
 		}
 
-		chat = gaim_chat_new(data->account, NULL, components);
+		chat = purple_chat_new(data->account, NULL, components);
 		gtk_blist_join_chat(chat);
-		gaim_blist_remove_chat(chat);
+		purple_blist_remove_chat(chat);
 	}
 }
 
@@ -552,15 +552,15 @@
 }
 
 static void
-pidgin_blist_update_privacy_cb(GaimBuddy *buddy)
-{
-	pidgin_blist_update_buddy(gaim_get_blist(), (GaimBlistNode*)(buddy), TRUE);
+pidgin_blist_update_privacy_cb(PurpleBuddy *buddy)
+{
+	pidgin_blist_update_buddy(purple_get_blist(), (PurpleBlistNode*)(buddy), TRUE);
 }
 
 static void
 rebuild_joinchat_entries(PidginJoinChatData *data)
 {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	GList *list = NULL, *tmp;
 	GHashTable *defaults = NULL;
 	struct proto_chat_entry *pce;
@@ -568,7 +568,7 @@
 
 	g_return_if_fail(data->account != NULL);
 
-	gc = gaim_account_get_connection(data->account);
+	gc = purple_account_get_connection(data->account);
 
 	while ((tmp = gtk_container_get_children(GTK_CONTAINER(data->entries_box))))
 		gtk_widget_destroy(tmp->data);
@@ -576,11 +576,11 @@
 	g_list_free(data->entries);
 	data->entries = NULL;
 
-	if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
-		list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
-
-	if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
-		defaults = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, NULL);
+	if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
+		list = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
+
+	if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
+		defaults = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, NULL);
 
 	for (tmp = list; tmp; tmp = tmp->next)
 	{
@@ -652,7 +652,7 @@
 }
 
 static void
-joinchat_select_account_cb(GObject *w, GaimAccount *account,
+joinchat_select_account_cb(GObject *w, PurpleAccount *account,
                            PidginJoinChatData *data)
 {
     data->account = account;
@@ -660,12 +660,12 @@
 }
 
 static gboolean
-chat_account_filter_func(GaimAccount *account)
-{
-	GaimConnection *gc = gaim_account_get_connection(account);
-	GaimPluginProtocolInfo *prpl_info = NULL;
-
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
+chat_account_filter_func(PurpleAccount *account)
+{
+	PurpleConnection *gc = purple_account_get_connection(account);
+	PurplePluginProtocolInfo *prpl_info = NULL;
+
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 	return (prpl_info->chat_info != NULL);
 }
@@ -674,12 +674,12 @@
 pidgin_blist_joinchat_is_showable()
 {
 	GList *c;
-	GaimConnection *gc;
-
-	for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
+	PurpleConnection *gc;
+
+	for (c = purple_connections_get_all(); c != NULL; c = c->next) {
 		gc = c->data;
 
-		if (chat_account_filter_func(gaim_connection_get_account(gc)))
+		if (chat_account_filter_func(purple_connection_get_account(gc)))
 			return TRUE;
 	}
 
@@ -696,7 +696,7 @@
 	GtkWidget *img = NULL;
 	PidginJoinChatData *data = NULL;
 
-	gtkblist = PIDGIN_BLIST(gaim_get_blist());
+	gtkblist = PIDGIN_BLIST(purple_get_blist());
 	img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
 					gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
 	data = g_new0(PidginJoinChatData, 1);
@@ -763,7 +763,7 @@
 }
 
 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GValue val;
 
 	val.g_type = 0;
@@ -771,7 +771,7 @@
 
 	node = g_value_get_pointer(&val);
 
-	if (GAIM_BLIST_NODE_IS_GROUP(node)) {
+	if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 		char *title;
 
 		title = pidgin_get_group_title(node, TRUE);
@@ -782,12 +782,12 @@
 
 		g_free(title);
 
-		gaim_blist_node_set_bool(node, "collapsed", FALSE);
+		purple_blist_node_set_bool(node, "collapsed", FALSE);
 	}
 }
 
 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GValue val;
 
 	val.g_type = 0;
@@ -795,7 +795,7 @@
 
 	node = g_value_get_pointer(&val);
 
-	if (GAIM_BLIST_NODE_IS_GROUP(node)) {
+	if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 		char *title;
 
 		title = pidgin_get_group_title(node, FALSE);
@@ -806,14 +806,14 @@
 
 		g_free(title);
 
-		gaim_blist_node_set_bool(node, "collapsed", TRUE);
-	} else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
+		purple_blist_node_set_bool(node, "collapsed", TRUE);
+	} else if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		pidgin_blist_collapse_contact_cb(NULL, node);
 	}
 }
 
 static void gtk_blist_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) {
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GtkTreeIter iter;
 	GValue val;
 
@@ -823,18 +823,18 @@
 	gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
 	node = g_value_get_pointer(&val);
 
-	if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		GaimBuddy *buddy;
-
-		if(GAIM_BLIST_NODE_IS_CONTACT(node))
-			buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		PurpleBuddy *buddy;
+
+		if(PURPLE_BLIST_NODE_IS_CONTACT(node))
+			buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
 		else
-			buddy = (GaimBuddy*)node;
+			buddy = (PurpleBuddy*)node;
 
 		pidgindialogs_im_with_user(buddy->account, buddy->name);
-	} else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
-		gtk_blist_join_chat((GaimChat *)node);
-	} else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
+	} else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		gtk_blist_join_chat((PurpleChat *)node);
+	} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 /*		if (gtk_tree_view_row_expanded(tv, path))
 			gtk_tree_view_collapse_row(tv, path);
 		else
@@ -846,19 +846,19 @@
 {
 	GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
 	GtkTreeIter iter;
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 
 	if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
 		gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
-		if (GAIM_BLIST_NODE_IS_BUDDY(node))
-			gaim_blist_request_add_chat(NULL, (GaimGroup*)node->parent->parent, NULL, NULL);
-		if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node))
-			gaim_blist_request_add_chat(NULL, (GaimGroup*)node->parent, NULL, NULL);
-		else if (GAIM_BLIST_NODE_IS_GROUP(node))
-			gaim_blist_request_add_chat(NULL, (GaimGroup*)node, NULL, NULL);
+		if (PURPLE_BLIST_NODE_IS_BUDDY(node))
+			purple_blist_request_add_chat(NULL, (PurpleGroup*)node->parent->parent, NULL, NULL);
+		if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_CHAT(node))
+			purple_blist_request_add_chat(NULL, (PurpleGroup*)node->parent, NULL, NULL);
+		else if (PURPLE_BLIST_NODE_IS_GROUP(node))
+			purple_blist_request_add_chat(NULL, (PurpleGroup*)node, NULL, NULL);
 	}
 	else {
-		gaim_blist_request_add_chat(NULL, NULL, NULL, NULL);
+		purple_blist_request_add_chat(NULL, NULL, NULL, NULL);
 	}
 }
 
@@ -866,43 +866,43 @@
 {
 	GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
 	GtkTreeIter iter;
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 
 	if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
 		gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
-		if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
-			gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node->parent->parent)->name,
+		if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+			purple_blist_request_add_buddy(NULL, NULL, ((PurpleGroup*)node->parent->parent)->name,
 					NULL);
-		} else if (GAIM_BLIST_NODE_IS_CONTACT(node)
-				|| GAIM_BLIST_NODE_IS_CHAT(node)) {
-			gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node->parent)->name, NULL);
-		} else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
-			gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node)->name, NULL);
+		} else if (PURPLE_BLIST_NODE_IS_CONTACT(node)
+				|| PURPLE_BLIST_NODE_IS_CHAT(node)) {
+			purple_blist_request_add_buddy(NULL, NULL, ((PurpleGroup*)node->parent)->name, NULL);
+		} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
+			purple_blist_request_add_buddy(NULL, NULL, ((PurpleGroup*)node)->name, NULL);
 		}
 	}
 	else {
-		gaim_blist_request_add_buddy(NULL, NULL, NULL, NULL);
+		purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
 	}
 }
 
 static void
-pidgin_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
-{
-	if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		pidgindialogs_remove_buddy((GaimBuddy*)node);
-	} else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
-		pidgindialogs_remove_chat((GaimChat*)node);
-	} else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
-		pidgindialogs_remove_group((GaimGroup*)node);
-	} else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		pidgindialogs_remove_contact((GaimContact*)node);
+pidgin_blist_remove_cb (GtkWidget *w, PurpleBlistNode *node)
+{
+	if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		pidgindialogs_remove_buddy((PurpleBuddy*)node);
+	} else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		pidgindialogs_remove_chat((PurpleChat*)node);
+	} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
+		pidgindialogs_remove_group((PurpleGroup*)node);
+	} else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+		pidgindialogs_remove_contact((PurpleContact*)node);
 	}
 }
 
 struct _expand {
 	GtkTreeView *treeview;
 	GtkTreePath *path;
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 };
 
 static gboolean
@@ -919,14 +919,14 @@
 }
 
 static void
-pidgin_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
+pidgin_blist_expand_contact_cb(GtkWidget *w, PurpleBlistNode *node)
 {
 	struct _pidgin_blist_node *gtknode;
 	GtkTreeIter iter, parent;
-	GaimBlistNode *bnode;
+	PurpleBlistNode *bnode;
 	GtkTreePath *path;
 
-	if(!GAIM_BLIST_NODE_IS_CONTACT(node))
+	if(!PURPLE_BLIST_NODE_IS_CONTACT(node))
 		return;
 
 	gtknode = (struct _pidgin_blist_node *)node->ui_data;
@@ -954,12 +954,12 @@
 }
 
 static void
-pidgin_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node)
-{
-	GaimBlistNode *bnode;
+pidgin_blist_collapse_contact_cb(GtkWidget *w, PurpleBlistNode *node)
+{
+	PurpleBlistNode *bnode;
 	struct _pidgin_blist_node *gtknode;
 
-	if(!GAIM_BLIST_NODE_IS_CONTACT(node))
+	if(!PURPLE_BLIST_NODE_IS_CONTACT(node))
 		return;
 
 	gtknode = (struct _pidgin_blist_node *)node->ui_data;
@@ -972,40 +972,40 @@
 }
 
 static void
-toggle_privacy(GtkWidget *widget, GaimBlistNode *node)
-{
-	GaimBuddy *buddy;
-	GaimAccount *account;
+toggle_privacy(GtkWidget *widget, PurpleBlistNode *node)
+{
+	PurpleBuddy *buddy;
+	PurpleAccount *account;
 	gboolean permitted;
 	const char *name;
 
-	if (!GAIM_BLIST_NODE_IS_BUDDY(node))
+	if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
 		return;
 
-	buddy = (GaimBuddy *)node;
-	account = gaim_buddy_get_account(buddy);
-	name = gaim_buddy_get_name(buddy);
-
-	permitted = gaim_privacy_check(account, name);
+	buddy = (PurpleBuddy *)node;
+	account = purple_buddy_get_account(buddy);
+	name = purple_buddy_get_name(buddy);
+
+	permitted = purple_privacy_check(account, name);
 
 	/* XXX: Perhaps ask whether to restore the previous lists where appropirate? */
 
 	if (permitted)
-		gaim_privacy_deny(account, name, FALSE, FALSE);
+		purple_privacy_deny(account, name, FALSE, FALSE);
 	else
-		gaim_privacy_allow(account, name, FALSE, FALSE);
-
-	pidgin_blist_update(gaim_get_blist(), node);
-}
-
-void pidgin_append_blist_node_privacy_menu(GtkWidget *menu, GaimBlistNode *node)
-{
-	GaimBuddy *buddy = (GaimBuddy *)node;
-	GaimAccount *account;
+		purple_privacy_allow(account, name, FALSE, FALSE);
+
+	pidgin_blist_update(purple_get_blist(), node);
+}
+
+void pidgin_append_blist_node_privacy_menu(GtkWidget *menu, PurpleBlistNode *node)
+{
+	PurpleBuddy *buddy = (PurpleBuddy *)node;
+	PurpleAccount *account;
 	gboolean permitted;
 
-	account = gaim_buddy_get_account(buddy);
-	permitted = gaim_privacy_check(account, gaim_buddy_get_name(buddy));
+	account = purple_buddy_get_account(buddy);
+	permitted = purple_privacy_check(account, purple_buddy_get_name(buddy));
 
 	pidgin_new_item_from_stock(menu, permitted ? _("_Block") : _("Un_block"),
 						PIDGIN_STOCK_BLOCK, G_CALLBACK(toggle_privacy),
@@ -1013,48 +1013,48 @@
 }
 
 void
-pidgin_append_blist_node_proto_menu(GtkWidget *menu, GaimConnection *gc,
-                                      GaimBlistNode *node)
+pidgin_append_blist_node_proto_menu(GtkWidget *menu, PurpleConnection *gc,
+                                      PurpleBlistNode *node)
 {
 	GList *l, *ll;
-	GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 	if(!prpl_info || !prpl_info->blist_node_menu)
 		return;
 
 	for(l = ll = prpl_info->blist_node_menu(node); l; l = l->next) {
-		GaimMenuAction *act = (GaimMenuAction *) l->data;
+		PurpleMenuAction *act = (PurpleMenuAction *) l->data;
 		pidgin_append_menu_action(menu, act, node);
 	}
 	g_list_free(ll);
 }
 
 void
-pidgin_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node)
+pidgin_append_blist_node_extended_menu(GtkWidget *menu, PurpleBlistNode *node)
 {
 	GList *l, *ll;
 
-	for(l = ll = gaim_blist_node_get_extended_menu(node); l; l = l->next) {
-		GaimMenuAction *act = (GaimMenuAction *) l->data;
+	for(l = ll = purple_blist_node_get_extended_menu(node); l; l = l->next) {
+		PurpleMenuAction *act = (PurpleMenuAction *) l->data;
 		pidgin_append_menu_action(menu, act, node);
 	}
 	g_list_free(ll);
 }
 
 void
-pidgin_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub) {
-	GaimPluginProtocolInfo *prpl_info;
-	GaimContact *contact;
+pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) {
+	PurplePluginProtocolInfo *prpl_info;
+	PurpleContact *contact;
 	gboolean contact_expanded = FALSE;
 
 	g_return_if_fail(menu);
 	g_return_if_fail(buddy);
 
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl);
-
-	contact = gaim_buddy_get_contact(buddy);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl);
+
+	contact = purple_buddy_get_contact(buddy);
 	if (contact) {
-		contact_expanded = ((struct _pidgin_blist_node *)(((GaimBlistNode*)contact)->ui_data))->contact_expanded;
+		contact_expanded = ((struct _pidgin_blist_node *)(((PurpleBlistNode*)contact)->ui_data))->contact_expanded;
 	}
 
 	if (prpl_info && prpl_info->get_info) {
@@ -1077,7 +1077,7 @@
 	pidgin_new_item_from_stock(menu, _("Add Buddy _Pounce"), NULL,
 			G_CALLBACK(gtk_blist_menu_bp_cb), buddy, 0, 0, NULL);
 
-	if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
+	if(((PurpleBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
 		pidgin_new_item_from_stock(menu, _("View _Log"), NULL,
 				G_CALLBACK(gtk_blist_menu_showlog_cb),
 				contact, 0, 0, NULL);
@@ -1088,12 +1088,12 @@
 
 
 	pidgin_append_blist_node_proto_menu(menu, buddy->account->gc,
-										  (GaimBlistNode *)buddy);
-	pidgin_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
-
-	if (((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
+										  (PurpleBlistNode *)buddy);
+	pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy);
+
+	if (((PurpleBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
 		pidgin_separator(menu);
-		pidgin_append_blist_node_privacy_menu(menu, (GaimBlistNode *)buddy);
+		pidgin_append_blist_node_privacy_menu(menu, (PurpleBlistNode *)buddy);
 		pidgin_new_item_from_stock(menu, _("Alias..."), PIDGIN_STOCK_ALIAS,
 				G_CALLBACK(gtk_blist_menu_alias_cb),
 				contact, 0, 0, NULL);
@@ -1102,7 +1102,7 @@
 				contact, 0, 0, NULL);
 	} else if (!sub || contact_expanded) {
 		pidgin_separator(menu);
-		pidgin_append_blist_node_privacy_menu(menu, (GaimBlistNode *)buddy);
+		pidgin_append_blist_node_privacy_menu(menu, (PurpleBlistNode *)buddy);
 		pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS,
 				G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
 		pidgin_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
@@ -1113,7 +1113,7 @@
 
 static gboolean
 gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) {
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GValue val;
 	GtkTreeIter iter;
 	GtkTreeSelection *sel;
@@ -1129,12 +1129,12 @@
 
 	if(event->state & GDK_CONTROL_MASK &&
 			(event->keyval == 'o' || event->keyval == 'O')) {
-		GaimBuddy *buddy;
-
-		if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
-			buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
-		} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-			buddy = (GaimBuddy*)node;
+		PurpleBuddy *buddy;
+
+		if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+			buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
+		} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+			buddy = (PurpleBuddy*)node;
 		} else {
 			return FALSE;
 		}
@@ -1146,7 +1146,7 @@
 }
 
 static GtkWidget *
-create_group_menu (GaimBlistNode *node, GaimGroup *g)
+create_group_menu (PurpleBlistNode *node, PurpleGroup *g)
 {
 	GtkWidget *menu;
 	GtkWidget *item;
@@ -1169,13 +1169,13 @@
 
 
 static GtkWidget *
-create_chat_menu(GaimBlistNode *node, GaimChat *c) {
+create_chat_menu(PurpleBlistNode *node, PurpleChat *c) {
 	GtkWidget *menu;
 	gboolean autojoin;
 
 	menu = gtk_menu_new();
-	autojoin = (gaim_blist_node_get_bool(node, "gtk-autojoin") ||
-			(gaim_blist_node_get_string(node, "gtk-autojoin") != NULL));
+	autojoin = (purple_blist_node_get_bool(node, "gtk-autojoin") ||
+			(purple_blist_node_get_string(node, "gtk-autojoin") != NULL));
 
 	pidgin_new_item_from_stock(menu, _("_Join"), PIDGIN_STOCK_CHAT,
 			G_CALLBACK(gtk_blist_menu_join_cb), node, 0, 0, NULL);
@@ -1198,7 +1198,7 @@
 }
 
 static GtkWidget *
-create_contact_menu (GaimBlistNode *node)
+create_contact_menu (PurpleBlistNode *node)
 {
 	GtkWidget *menu;
 
@@ -1227,16 +1227,16 @@
 }
 
 static GtkWidget *
-create_buddy_menu(GaimBlistNode *node, GaimBuddy *b) {
+create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) {
 	struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
 	GtkWidget *menu;
 	GtkWidget *menuitem;
-	gboolean show_offline = gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies");
+	gboolean show_offline = purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies");
 
 	menu = gtk_menu_new();
 	pidgin_blist_make_buddy_menu(menu, b, FALSE);
 
-	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		pidgin_separator(menu);
 
 		if(gtknode->contact_expanded) {
@@ -1251,10 +1251,10 @@
 						 0, 0, NULL);
 		}
 		if(node->child->next) {
-			GaimBlistNode *bnode;
+			PurpleBlistNode *bnode;
 
 			for(bnode = node->child; bnode; bnode = bnode->next) {
-				GaimBuddy *buddy = (GaimBuddy*)bnode;
+				PurpleBuddy *buddy = (PurpleBuddy*)bnode;
 				GdkPixbuf *buf;
 				GtkWidget *submenu;
 				GtkWidget *image;
@@ -1263,7 +1263,7 @@
 					continue;
 				if(!buddy->account->gc)
 					continue;
-				if(!show_offline && !GAIM_BUDDY_IS_ONLINE(buddy))
+				if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy))
 					continue;
 
 				menuitem = gtk_image_menu_item_new_with_label(buddy->name);
@@ -1288,7 +1288,7 @@
 }
 
 static gboolean
-pidgin_blist_show_context_menu(GaimBlistNode *node,
+pidgin_blist_show_context_menu(PurpleBlistNode *node,
 								 GtkMenuPositionFunc func,
 								 GtkWidget *tv,
 								 guint button,
@@ -1301,23 +1301,23 @@
 	gtknode = (struct _pidgin_blist_node *)node->ui_data;
 
 	/* Create a menu based on the thing we right-clicked on */
-	if (GAIM_BLIST_NODE_IS_GROUP(node)) {
-		GaimGroup *g = (GaimGroup *)node;
+	if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
+		PurpleGroup *g = (PurpleGroup *)node;
 
 		menu = create_group_menu(node, g);
-	} else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
-		GaimChat *c = (GaimChat *)node;
+	} else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		PurpleChat *c = (PurpleChat *)node;
 
 		menu = create_chat_menu(node, c);
-	} else if ((GAIM_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
+	} else if ((PURPLE_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
 		menu = create_contact_menu(node);
-	} else if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		GaimBuddy *b;
-
-		if (GAIM_BLIST_NODE_IS_CONTACT(node))
-			b = gaim_contact_get_priority_buddy((GaimContact*)node);
+	} else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		PurpleBuddy *b;
+
+		if (PURPLE_BLIST_NODE_IS_CONTACT(node))
+			b = purple_contact_get_priority_buddy((PurpleContact*)node);
 		else
-			b = (GaimBuddy *)node;
+			b = (PurpleBuddy *)node;
 
 		menu = create_buddy_menu(node, b);
 	}
@@ -1345,12 +1345,12 @@
 static gboolean gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_data)
 {
 	GtkTreePath *path;
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GValue val;
 	GtkTreeIter iter;
 	GtkTreeSelection *sel;
-	GaimPlugin *prpl = NULL;
-	GaimPluginProtocolInfo *prpl_info = NULL;
+	PurplePlugin *prpl = NULL;
+	PurplePluginProtocolInfo *prpl_info = NULL;
 	struct _pidgin_blist_node *gtknode;
 	gboolean handled = FALSE;
 
@@ -1369,7 +1369,7 @@
 
 	/* CTRL+middle click expands or collapse a contact */
 	} else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
-			   (event->state & GDK_CONTROL_MASK) && (GAIM_BLIST_NODE_IS_CONTACT(node))) {
+			   (event->state & GDK_CONTROL_MASK) && (PURPLE_BLIST_NODE_IS_CONTACT(node))) {
 		if (gtknode->contact_expanded)
 			pidgin_blist_collapse_contact_cb(NULL, node);
 		else
@@ -1378,16 +1378,16 @@
 
 	/* Double middle click gets info */
 	} else if ((event->button == 2) && (event->type == GDK_2BUTTON_PRESS) &&
-			   ((GAIM_BLIST_NODE_IS_CONTACT(node)) || (GAIM_BLIST_NODE_IS_BUDDY(node)))) {
-		GaimBuddy *b;
-		if(GAIM_BLIST_NODE_IS_CONTACT(node))
-			b = gaim_contact_get_priority_buddy((GaimContact*)node);
+			   ((PURPLE_BLIST_NODE_IS_CONTACT(node)) || (PURPLE_BLIST_NODE_IS_BUDDY(node)))) {
+		PurpleBuddy *b;
+		if(PURPLE_BLIST_NODE_IS_CONTACT(node))
+			b = purple_contact_get_priority_buddy((PurpleContact*)node);
 		else
-			b = (GaimBuddy *)node;
-
-		prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
+			b = (PurpleBuddy *)node;
+
+		prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
 		if (prpl != NULL)
-			prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
+			prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 		if (prpl && prpl_info->get_info)
 			serv_get_info(b->account->gc, b->name);
@@ -1418,7 +1418,7 @@
 static gboolean
 pidgin_blist_popup_menu_cb(GtkWidget *tv, void *user_data)
 {
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GValue val;
 	GtkTreeIter iter;
 	GtkTreeSelection *sel;
@@ -1443,7 +1443,7 @@
 {
 	pidgin_set_cursor(gtkblist->window, GDK_WATCH);
 
-	gaim_prefs_set_bool("/gaim/gtk/blist/show_buddy_icons",
+	purple_prefs_set_bool("/purple/gtk/blist/show_buddy_icons",
 			    gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
 
 	pidgin_clear_cursor(gtkblist->window);
@@ -1453,7 +1453,7 @@
 {
 	pidgin_set_cursor(gtkblist->window, GDK_WATCH);
 
-	gaim_prefs_set_bool("/gaim/gtk/blist/show_idle_time",
+	purple_prefs_set_bool("/purple/gtk/blist/show_idle_time",
 			    gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
 
 	pidgin_clear_cursor(gtkblist->window);
@@ -1463,7 +1463,7 @@
 {
 	pidgin_set_cursor(gtkblist->window, GDK_WATCH);
 
-	gaim_prefs_set_bool("/gaim/gtk/blist/show_empty_groups",
+	purple_prefs_set_bool("/purple/gtk/blist/show_empty_groups",
 			gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
 
 	pidgin_clear_cursor(gtkblist->window);
@@ -1474,7 +1474,7 @@
 {
 	pidgin_set_cursor(gtkblist->window, GDK_WATCH);
 
-	gaim_prefs_set_bool("/gaim/gtk/blist/show_offline_buddies",
+	purple_prefs_set_bool("/purple/gtk/blist/show_offline_buddies",
 			gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
 
 	pidgin_clear_cursor(gtkblist->window);
@@ -1482,11 +1482,11 @@
 
 static void pidgin_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item)
 {
-	gaim_prefs_set_bool("/gaim/gtk/sound/mute", GTK_CHECK_MENU_ITEM(item)->active);
+	purple_prefs_set_bool("/purple/gtk/sound/mute", GTK_CHECK_MENU_ITEM(item)->active);
 }
 
 static void
-pidgin_blist_mute_pref_cb(const char *name, GaimPrefType type,
+pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type,
 							gconstpointer value, gpointer data)
 {
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(gtkblist->ift,
@@ -1494,7 +1494,7 @@
 }
 
 static void
-pidgin_blist_sound_method_pref_cb(const char *name, GaimPrefType type,
+pidgin_blist_sound_method_pref_cb(const char *name, PurplePrefType type,
 									gconstpointer value, gpointer data)
 {
 	gboolean sensitive = TRUE;
@@ -1506,22 +1506,22 @@
 }
 
 static void
-add_buddies_from_vcard(const char *prpl_id, GaimGroup *group, GList *list,
+add_buddies_from_vcard(const char *prpl_id, PurpleGroup *group, GList *list,
 					   const char *alias)
 {
 	GList *l;
-	GaimAccount *account = NULL;
-	GaimConnection *gc;
+	PurpleAccount *account = NULL;
+	PurpleConnection *gc;
 
 	if (list == NULL)
 		return;
 
-	for (l = gaim_connections_get_all(); l != NULL; l = l->next)
+	for (l = purple_connections_get_all(); l != NULL; l = l->next)
 	{
-		gc = (GaimConnection *)l->data;
-		account = gaim_connection_get_account(gc);
-
-		if (!strcmp(gaim_account_get_protocol_id(account), prpl_id))
+		gc = (PurpleConnection *)l->data;
+		account = purple_connection_get_account(gc);
+
+		if (!strcmp(purple_account_get_protocol_id(account), prpl_id))
 			break;
 
 		account = NULL;
@@ -1531,7 +1531,7 @@
 	{
 		for (l = list; l != NULL; l = l->next)
 		{
-			gaim_blist_request_add_buddy(account, l->data,
+			purple_blist_request_add_buddy(account, l->data,
 										 (group ? group->name : NULL),
 										 alias);
 		}
@@ -1542,7 +1542,7 @@
 }
 
 static gboolean
-parse_vcard(const char *vcard, GaimGroup *group)
+parse_vcard(const char *vcard, PurpleGroup *group)
 {
 	char *temp_vcard;
 	char *s, *c;
@@ -1660,12 +1660,12 @@
 											gpointer null)
 {
 
-	if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
+	if (data->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE))
 	{
 		GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
 		GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
 		GtkTreeIter iter;
-		GaimBlistNode *node = NULL;
+		PurpleBlistNode *node = NULL;
 		GValue val;
 		if(!sourcerow)
 			return;
@@ -1674,7 +1674,7 @@
 		gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
 		node = g_value_get_pointer(&val);
 		gtk_selection_data_set (data,
-					gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
+					gdk_atom_intern ("PURPLE_BLIST_NODE", FALSE),
 					8, /* bits */
 					(void*)&node,
 					sizeof (node));
@@ -1686,9 +1686,9 @@
 		GtkTreeRowReference *ref;
 		GtkTreePath *sourcerow;
 		GtkTreeIter iter;
-		GaimBlistNode *node = NULL;
-		GaimBuddy *buddy;
-		GaimConnection *gc;
+		PurpleBlistNode *node = NULL;
+		PurpleBuddy *buddy;
+		PurpleConnection *gc;
 		GValue val;
 		GString *str;
 		const char *protocol;
@@ -1707,21 +1707,21 @@
 
 		node = g_value_get_pointer(&val);
 
-		if (GAIM_BLIST_NODE_IS_CONTACT(node))
+		if (PURPLE_BLIST_NODE_IS_CONTACT(node))
 		{
-			buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
+			buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
 		}
-		else if (!GAIM_BLIST_NODE_IS_BUDDY(node))
+		else if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
 		{
 			gtk_tree_path_free(sourcerow);
 			return;
 		}
 		else
 		{
-			buddy = (GaimBuddy *)node;
+			buddy = (PurpleBuddy *)node;
 		}
 
-		gc = gaim_account_get_connection(buddy->account);
+		gc = purple_account_get_connection(buddy->account);
 
 		if (gc == NULL)
 		{
@@ -1730,7 +1730,7 @@
 		}
 
 		protocol =
-			GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
+			PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
 														   buddy);
 
 		str = g_string_new(NULL);
@@ -1770,15 +1770,15 @@
 		gtkblist->drag_timeout = 0;
 	}
 
-	if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
-		GaimBlistNode *n = NULL;
+	if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && sd->data) {
+		PurpleBlistNode *n = NULL;
 		GtkTreePath *path = NULL;
 		GtkTreeViewDropPosition position;
 		memcpy(&n, sd->data, sizeof(n));
 		if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
 			/* if we're here, I think it means the drop is ok */
 			GtkTreeIter iter;
-			GaimBlistNode *node;
+			PurpleBlistNode *node;
 			GValue val;
 			struct _pidgin_blist_node *gtknode;
 
@@ -1790,125 +1790,125 @@
 			node = g_value_get_pointer(&val);
 			gtknode = node->ui_data;
 
-			if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
-				GaimContact *c = (GaimContact*)n;
-				if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
-					gaim_blist_merge_contact(c, node);
-				} else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
-						GAIM_BLIST_NODE_IS_CHAT(node)) {
+			if (PURPLE_BLIST_NODE_IS_CONTACT(n)) {
+				PurpleContact *c = (PurpleContact*)n;
+				if (PURPLE_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
+					purple_blist_merge_contact(c, node);
+				} else if (PURPLE_BLIST_NODE_IS_CONTACT(node) ||
+						PURPLE_BLIST_NODE_IS_CHAT(node)) {
 					switch(position) {
 						case GTK_TREE_VIEW_DROP_AFTER:
 						case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
-							gaim_blist_add_contact(c, (GaimGroup*)node->parent,
+							purple_blist_add_contact(c, (PurpleGroup*)node->parent,
 									node);
 							break;
 						case GTK_TREE_VIEW_DROP_BEFORE:
 						case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
-							gaim_blist_add_contact(c, (GaimGroup*)node->parent,
+							purple_blist_add_contact(c, (PurpleGroup*)node->parent,
 									node->prev);
 							break;
 					}
-				} else if(GAIM_BLIST_NODE_IS_GROUP(node)) {
-					gaim_blist_add_contact(c, (GaimGroup*)node, NULL);
-				} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-					gaim_blist_merge_contact(c, node);
+				} else if(PURPLE_BLIST_NODE_IS_GROUP(node)) {
+					purple_blist_add_contact(c, (PurpleGroup*)node, NULL);
+				} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+					purple_blist_merge_contact(c, node);
 				}
-			} else if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
-				GaimBuddy *b = (GaimBuddy*)n;
-				if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
+			} else if (PURPLE_BLIST_NODE_IS_BUDDY(n)) {
+				PurpleBuddy *b = (PurpleBuddy*)n;
+				if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
 					switch(position) {
 						case GTK_TREE_VIEW_DROP_AFTER:
 						case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
-							gaim_blist_add_buddy(b, (GaimContact*)node->parent,
-									(GaimGroup*)node->parent->parent, node);
+							purple_blist_add_buddy(b, (PurpleContact*)node->parent,
+									(PurpleGroup*)node->parent->parent, node);
 							break;
 						case GTK_TREE_VIEW_DROP_BEFORE:
 						case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
-							gaim_blist_add_buddy(b, (GaimContact*)node->parent,
-									(GaimGroup*)node->parent->parent,
+							purple_blist_add_buddy(b, (PurpleContact*)node->parent,
+									(PurpleGroup*)node->parent->parent,
 									node->prev);
 							break;
 					}
-				} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
-					gaim_blist_add_buddy(b, NULL, (GaimGroup*)node->parent,
+				} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
+					purple_blist_add_buddy(b, NULL, (PurpleGroup*)node->parent,
 							NULL);
-				} else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
-					gaim_blist_add_buddy(b, NULL, (GaimGroup*)node, NULL);
-				} else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
+				} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
+					purple_blist_add_buddy(b, NULL, (PurpleGroup*)node, NULL);
+				} else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 					if(gtknode->contact_expanded) {
 						switch(position) {
 							case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
 							case GTK_TREE_VIEW_DROP_AFTER:
 							case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
-								gaim_blist_add_buddy(b, (GaimContact*)node,
-										(GaimGroup*)node->parent, NULL);
+								purple_blist_add_buddy(b, (PurpleContact*)node,
+										(PurpleGroup*)node->parent, NULL);
 								break;
 							case GTK_TREE_VIEW_DROP_BEFORE:
-								gaim_blist_add_buddy(b, NULL,
-										(GaimGroup*)node->parent, node->prev);
+								purple_blist_add_buddy(b, NULL,
+										(PurpleGroup*)node->parent, node->prev);
 								break;
 						}
 					} else {
 						switch(position) {
 							case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
 							case GTK_TREE_VIEW_DROP_AFTER:
-								gaim_blist_add_buddy(b, NULL,
-										(GaimGroup*)node->parent, NULL);
+								purple_blist_add_buddy(b, NULL,
+										(PurpleGroup*)node->parent, NULL);
 								break;
 							case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
 							case GTK_TREE_VIEW_DROP_BEFORE:
-								gaim_blist_add_buddy(b, NULL,
-										(GaimGroup*)node->parent, node->prev);
+								purple_blist_add_buddy(b, NULL,
+										(PurpleGroup*)node->parent, node->prev);
 								break;
 						}
 					}
 				}
-			} else if (GAIM_BLIST_NODE_IS_CHAT(n)) {
-				GaimChat *chat = (GaimChat *)n;
-				if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
+			} else if (PURPLE_BLIST_NODE_IS_CHAT(n)) {
+				PurpleChat *chat = (PurpleChat *)n;
+				if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
 					switch(position) {
 						case GTK_TREE_VIEW_DROP_AFTER:
 						case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
 						case GTK_TREE_VIEW_DROP_BEFORE:
 						case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
-							gaim_blist_add_chat(chat,
-									(GaimGroup*)node->parent->parent,
+							purple_blist_add_chat(chat,
+									(PurpleGroup*)node->parent->parent,
 									node->parent);
 							break;
 					}
-				} else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
-						GAIM_BLIST_NODE_IS_CHAT(node)) {
+				} else if(PURPLE_BLIST_NODE_IS_CONTACT(node) ||
+						PURPLE_BLIST_NODE_IS_CHAT(node)) {
 					switch(position) {
 						case GTK_TREE_VIEW_DROP_AFTER:
 						case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
-							gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node);
+							purple_blist_add_chat(chat, (PurpleGroup*)node->parent, node);
 							break;
 						case GTK_TREE_VIEW_DROP_BEFORE:
 						case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
-							gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node->prev);
+							purple_blist_add_chat(chat, (PurpleGroup*)node->parent, node->prev);
 							break;
 					}
-				} else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
-					gaim_blist_add_chat(chat, (GaimGroup*)node, NULL);
+				} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
+					purple_blist_add_chat(chat, (PurpleGroup*)node, NULL);
 				}
-			} else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
-				GaimGroup *g = (GaimGroup*)n;
-				if (GAIM_BLIST_NODE_IS_GROUP(node)) {
+			} else if (PURPLE_BLIST_NODE_IS_GROUP(n)) {
+				PurpleGroup *g = (PurpleGroup*)n;
+				if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 					switch (position) {
 					case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
 					case GTK_TREE_VIEW_DROP_AFTER:
-						gaim_blist_add_group(g, node);
+						purple_blist_add_group(g, node);
 						break;
 					case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
 					case GTK_TREE_VIEW_DROP_BEFORE:
-						gaim_blist_add_group(g, node->prev);
+						purple_blist_add_group(g, node->prev);
 						break;
 					}
-				} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-					gaim_blist_add_group(g, node->parent->parent);
-				} else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
-						GAIM_BLIST_NODE_IS_CHAT(node)) {
-					gaim_blist_add_group(g, node->parent);
+				} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+					purple_blist_add_group(g, node->parent->parent);
+				} else if(PURPLE_BLIST_NODE_IS_CONTACT(node) ||
+						PURPLE_BLIST_NODE_IS_CHAT(node)) {
+					purple_blist_add_group(g, node->parent);
 				}
 			}
 
@@ -1919,10 +1919,10 @@
 	else if (sd->target == gdk_atom_intern("application/x-im-contact",
 										   FALSE) && sd->data)
 	{
-		GaimGroup *group = NULL;
+		PurpleGroup *group = NULL;
 		GtkTreePath *path = NULL;
 		GtkTreeViewDropPosition position;
-		GaimAccount *account;
+		PurpleAccount *account;
 		char *protocol = NULL;
 		char *username = NULL;
 		char *alias = NULL;
@@ -1931,7 +1931,7 @@
 											  x, y, &path, &position))
 		{
 			GtkTreeIter iter;
-			GaimBlistNode *node;
+			PurpleBlistNode *node;
 			GValue val;
 
 			gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
@@ -1941,18 +1941,18 @@
 									  &iter, NODE_COLUMN, &val);
 			node = g_value_get_pointer(&val);
 
-			if (GAIM_BLIST_NODE_IS_BUDDY(node))
+			if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 			{
-				group = (GaimGroup *)node->parent->parent;
+				group = (PurpleGroup *)node->parent->parent;
 			}
-			else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
-					 GAIM_BLIST_NODE_IS_CONTACT(node))
+			else if (PURPLE_BLIST_NODE_IS_CHAT(node) ||
+					 PURPLE_BLIST_NODE_IS_CONTACT(node))
 			{
-				group = (GaimGroup *)node->parent;
+				group = (PurpleGroup *)node->parent;
 			}
-			else if (GAIM_BLIST_NODE_IS_GROUP(node))
+			else if (PURPLE_BLIST_NODE_IS_GROUP(node))
 			{
-				group = (GaimGroup *)node;
+				group = (PurpleGroup *)node;
 			}
 		}
 
@@ -1961,13 +1961,13 @@
 		{
 			if (account == NULL)
 			{
-				gaim_notify_error(NULL, NULL,
+				purple_notify_error(NULL, NULL,
 					_("You are not currently signed on with an account that "
 					  "can add that buddy."), NULL);
 			}
 			else
 			{
-				gaim_blist_request_add_buddy(account, username,
+				purple_blist_request_add_buddy(account, username,
 											 (group ? group->name : NULL),
 											 alias);
 			}
@@ -1985,7 +1985,7 @@
 	else if (sd->target == gdk_atom_intern("text/x-vcard", FALSE) && sd->data)
 	{
 		gboolean result;
-		GaimGroup *group = NULL;
+		PurpleGroup *group = NULL;
 		GtkTreePath *path = NULL;
 		GtkTreeViewDropPosition position;
 
@@ -1993,7 +1993,7 @@
 											  x, y, &path, &position))
 		{
 			GtkTreeIter iter;
-			GaimBlistNode *node;
+			PurpleBlistNode *node;
 			GValue val;
 
 			gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
@@ -2003,18 +2003,18 @@
 									  &iter, NODE_COLUMN, &val);
 			node = g_value_get_pointer(&val);
 
-			if (GAIM_BLIST_NODE_IS_BUDDY(node))
+			if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 			{
-				group = (GaimGroup *)node->parent->parent;
+				group = (PurpleGroup *)node->parent->parent;
 			}
-			else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
-					 GAIM_BLIST_NODE_IS_CONTACT(node))
+			else if (PURPLE_BLIST_NODE_IS_CHAT(node) ||
+					 PURPLE_BLIST_NODE_IS_CONTACT(node))
 			{
-				group = (GaimGroup *)node->parent;
+				group = (PurpleGroup *)node->parent;
 			}
-			else if (GAIM_BLIST_NODE_IS_GROUP(node))
+			else if (PURPLE_BLIST_NODE_IS_GROUP(node))
 			{
-				group = (GaimGroup *)node;
+				group = (PurpleGroup *)node;
 			}
 		}
 
@@ -2029,7 +2029,7 @@
 											  x, y, &path, &position))
 			{
 				GtkTreeIter iter;
-				GaimBlistNode *node;
+				PurpleBlistNode *node;
 				GValue val;
 
 				gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
@@ -2039,8 +2039,8 @@
 							  &iter, NODE_COLUMN, &val);
 				node = g_value_get_pointer(&val);
 
-				if (GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CONTACT(node)) {
-					GaimBuddy *b = GAIM_BLIST_NODE_IS_BUDDY(node) ? (GaimBuddy*)node : gaim_contact_get_priority_buddy((GaimContact*)node);
+				if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+					PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? (PurpleBuddy*)node : purple_contact_get_priority_buddy((PurpleContact*)node);
 					pidgin_dnd_file_manage(sd, b->account, b->name);
 					gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
 				} else {
@@ -2089,51 +2089,51 @@
 }
 
 
-static GdkPixbuf *pidgin_blist_get_buddy_icon(GaimBlistNode *node,
+static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node,
 		gboolean scaled, gboolean greyed, gboolean custom)
 {
 	GdkPixbuf *buf, *ret = NULL;
 	GdkPixbufLoader *loader;
-	GaimBuddyIcon *icon;
+	PurpleBuddyIcon *icon;
 	const guchar *data = NULL;
 	gsize len;
-	GaimBuddy *buddy = NULL;
-	GaimChat *chat = NULL;
-	GaimAccount *account = NULL;
-	GaimPluginProtocolInfo *prpl_info = NULL;
-
-	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
-	} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		buddy = (GaimBuddy*)node;
-	} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
-		chat = (GaimChat*)node;
+	PurpleBuddy *buddy = NULL;
+	PurpleChat *chat = NULL;
+	PurpleAccount *account = NULL;
+	PurplePluginProtocolInfo *prpl_info = NULL;
+
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+		buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
+	} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		buddy = (PurpleBuddy*)node;
+	} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		chat = (PurpleChat*)node;
 	} else {
 		return NULL;
 	}
 
 	if(buddy != NULL)
-		account = gaim_buddy_get_account(buddy);
+		account = purple_buddy_get_account(buddy);
 	else if(chat != NULL)
 		account = chat->account;
 
 	if(account && account->gc)
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
 
 #if 0
-	if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
+	if (!purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons"))
 		return NULL;
 #endif
 
 	if (custom) {
-		const char *file = gaim_blist_node_get_string((GaimBlistNode*)gaim_buddy_get_contact(buddy),
+		const char *file = purple_blist_node_get_string((PurpleBlistNode*)purple_buddy_get_contact(buddy),
 							"custom_buddy_icon");
 		if (file && *file) {
 			char *contents;
 			GError *err  = NULL;
 			if (!g_file_get_contents(file, &contents, &len, &err)) {
-				gaim_debug_info("custom -icon", "Could not open custom-icon %s for %s\n",
-							file, gaim_buddy_get_name(buddy), err->message);
+				purple_debug_info("custom -icon", "Could not open custom-icon %s for %s\n",
+							file, purple_buddy_get_name(buddy), err->message);
 				g_error_free(err);
 			} else
 				data = (const guchar*)contents;
@@ -2142,10 +2142,10 @@
 
 	if (data == NULL) {
 		if(buddy != NULL) {
-			if (!(icon = gaim_buddy_get_icon(buddy)))
-				if (!(icon = gaim_buddy_icons_find(buddy->account, buddy->name))) /* Not sure I like this...*/
+			if (!(icon = purple_buddy_get_icon(buddy)))
+				if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name))) /* Not sure I like this...*/
 					return NULL;
-			data = gaim_buddy_icon_get_data(icon, &len);
+			data = purple_buddy_icon_get_data(icon, &len);
 		}
 		custom = FALSE;  /* We are not using the custom icon */
 	}
@@ -2168,10 +2168,10 @@
 		int scale_width, scale_height;
 
 		if (greyed) {
-			GaimPresence *presence = gaim_buddy_get_presence(buddy);
-			if (!GAIM_BUDDY_IS_ONLINE(buddy))
+			PurplePresence *presence = purple_buddy_get_presence(buddy);
+			if (!PURPLE_BUDDY_IS_ONLINE(buddy))
 				gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
-			if (gaim_presence_is_idle(presence))
+			if (purple_presence_is_idle(presence))
 				gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
 		}
 
@@ -2181,8 +2181,8 @@
 		scale_width = orig_width = gdk_pixbuf_get_width(buf);
 		scale_height = orig_height = gdk_pixbuf_get_height(buf);
 
-		if (prpl_info && prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_DISPLAY)
-			gaim_buddy_icon_get_scale_size(&prpl_info->icon_spec, &scale_width, &scale_height);
+		if (prpl_info && prpl_info->icon_spec.scale_rules & PURPLE_ICON_SCALE_DISPLAY)
+			purple_buddy_icon_get_scale_size(&prpl_info->icon_spec, &scale_width, &scale_height);
 
 		if (scaled) {
 			if(scale_height > scale_width) {
@@ -2254,17 +2254,17 @@
 	int height;
 };
 
-static struct tooltip_data * create_tip_for_node(GaimBlistNode *node, gboolean full)
+static struct tooltip_data * create_tip_for_node(PurpleBlistNode *node, gboolean full)
 {
 	char *tooltip_text = NULL;
 	struct tooltip_data *td = g_new0(struct tooltip_data, 1);
-	GaimAccount *account = NULL;
+	PurpleAccount *account = NULL;
 	char *tmp, *node_name;
 
-	if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		account = ((GaimBuddy*)(node))->account;
-	} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
-		account = ((GaimChat*)(node))->account;
+	if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		account = ((PurpleBuddy*)(node))->account;
+	} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		account = ((PurpleChat*)(node))->account;
 	}
 
 	td->status_icon = pidgin_blist_get_status_icon(node, PIDGIN_STATUS_ICON_LARGE);
@@ -2274,10 +2274,10 @@
 	td->layout = gtk_widget_create_pango_layout(gtkblist->tipwindow, NULL);
 	td->name_layout = gtk_widget_create_pango_layout(gtkblist->tipwindow, NULL);
 
-	if (GAIM_BLIST_NODE_IS_BUDDY(node))
-		tmp = g_markup_escape_text(gaim_buddy_get_name((GaimBuddy*)node), -1);
+	if (PURPLE_BLIST_NODE_IS_BUDDY(node))
+		tmp = g_markup_escape_text(purple_buddy_get_name((PurpleBuddy*)node), -1);
 	else
-		tmp = g_markup_escape_text(gaim_chat_get_name((GaimChat*)node), -1);
+		tmp = g_markup_escape_text(purple_chat_get_name((PurpleChat*)node), -1);
 	node_name = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>", tmp);
 
 	pango_layout_set_markup(td->layout, tooltip_text, -1);
@@ -2312,7 +2312,7 @@
 	return td;
 }
 
-static void pidgin_blist_paint_tip(GtkWidget *widget, GdkEventExpose *event, GaimBlistNode *node)
+static void pidgin_blist_paint_tip(GtkWidget *widget, GdkEventExpose *event, PurpleBlistNode *node)
 {
 	GtkStyle *style;
 	int current_height, max_width;
@@ -2453,7 +2453,7 @@
 {
 	GtkTreePath *path;
 	GtkTreeIter iter;
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GValue val;
 	struct _pidgin_blist_node *gtknode;
 
@@ -2464,7 +2464,7 @@
 	gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
 	node = g_value_get_pointer(&val);
 
-	if(!GAIM_BLIST_NODE_IS_CONTACT(node)) {
+	if(!PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		gtk_tree_path_free(path);
 		return FALSE;
 	}
@@ -2491,27 +2491,27 @@
 	return FALSE;
 }
 
-static gboolean buddy_is_displayable(GaimBuddy *buddy)
+static gboolean buddy_is_displayable(PurpleBuddy *buddy)
 {
 	struct _pidgin_blist_node *gtknode;
 
 	if(!buddy)
 		return FALSE;
 
-	gtknode = ((GaimBlistNode*)buddy)->ui_data;
-
-	return (gaim_account_is_connected(buddy->account) &&
-			(gaim_presence_is_online(buddy->presence) ||
+	gtknode = ((PurpleBlistNode*)buddy)->ui_data;
+
+	return (purple_account_is_connected(buddy->account) &&
+			(purple_presence_is_online(buddy->presence) ||
 			 (gtknode && gtknode->recent_signonoff) ||
-			 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies") ||
-			 gaim_blist_node_get_bool((GaimBlistNode*)buddy, "show_offline")));
+			 purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies") ||
+			 purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline")));
 }
 
 static gboolean pidgin_blist_tooltip_timeout(GtkWidget *tv)
 {
 	GtkTreePath *path;
 	GtkTreeIter iter;
-	GaimBlistNode *node;
+	PurpleBlistNode *node;
 	GValue val;
 	int scr_w, scr_h, w, h, x, y;
 #if GTK_CHECK_VERSION(2,2,0)
@@ -2539,25 +2539,25 @@
 
 	gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
 
-	if(GAIM_BLIST_NODE_IS_CHAT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
+	if(PURPLE_BLIST_NODE_IS_CHAT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node)) {
 		struct tooltip_data *td = create_tip_for_node(node, TRUE);
 		gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
 		w = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE +
 			MAX(td->width, td->name_width) + SMALL_SPACE + td->avatar_width + TOOLTIP_BORDER;
 		h = TOOLTIP_BORDER + MAX(td->height + td->name_height, MAX(STATUS_SIZE, td->avatar_height))
 			+ TOOLTIP_BORDER;
-	} else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		GaimBlistNode *child;
-		GaimBuddy *b = gaim_contact_get_priority_buddy((GaimContact *)node);
+	} else if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+		PurpleBlistNode *child;
+		PurpleBuddy *b = purple_contact_get_priority_buddy((PurpleContact *)node);
 		int max_text_width = 0;
 		int max_avatar_width = 0;
 		w = h = 0;
 
 		for(child = node->child; child; child = child->next)
 		{
-			if(GAIM_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((GaimBuddy*)child)) {
-				struct tooltip_data *td = create_tip_for_node(child, (b == (GaimBuddy*)child));
-				if (b == (GaimBuddy *)child) {
+			if(PURPLE_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((PurpleBuddy*)child)) {
+				struct tooltip_data *td = create_tip_for_node(child, (b == (PurpleBuddy*)child));
+				if (b == (PurpleBuddy *)child) {
 					gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td);
 				} else {
 					gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
@@ -2686,7 +2686,7 @@
 	GtkTreePath *path;
 	int delay;
 
-	delay = gaim_prefs_get_int("/gaim/gtk/blist/tooltip_delay");
+	delay = purple_prefs_get_int("/purple/gtk/blist/tooltip_delay");
 
 	if (delay == 0)
 		return FALSE;
@@ -2742,8 +2742,8 @@
 static void
 toggle_debug(void)
 {
-	gaim_prefs_set_bool("/gaim/gtk/debug/enabled",
-			!gaim_prefs_get_bool("/gaim/gtk/debug/enabled"));
+	purple_prefs_set_bool("/purple/gtk/debug/enabled",
+			!purple_prefs_get_bool("/purple/gtk/debug/enabled"));
 }
 
 
@@ -2767,9 +2767,9 @@
 	{ "/Buddies/sep2", NULL, NULL, 0, "<Separator>", NULL },
 	{ N_("/Buddies/_Add Buddy..."), "<CTL>B", pidgin_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD },
 	{ N_("/Buddies/Add C_hat..."), NULL, pidgin_blist_add_chat_cb, 0, "<StockItem>", GTK_STOCK_ADD },
-	{ N_("/Buddies/Add _Group..."), NULL, gaim_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD },
+	{ N_("/Buddies/Add _Group..."), NULL, purple_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD },
 	{ "/Buddies/sep3", NULL, NULL, 0, "<Separator>", NULL },
-	{ N_("/Buddies/_Quit"), "<CTL>Q", gaim_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
+	{ N_("/Buddies/_Quit"), "<CTL>Q", purple_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
 
 	/* Accounts menu */
 	{ N_("/_Accounts"), NULL, NULL, 0, "<Branch>", NULL },
@@ -2799,25 +2799,25 @@
  * Private Utility functions                             *
  *********************************************************/
 
-static char *pidgin_get_tooltip_text(GaimBlistNode *node, gboolean full)
+static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full)
 {
 	GString *str = g_string_new("");
-	GaimPlugin *prpl;
-	GaimPluginProtocolInfo *prpl_info = NULL;
+	PurplePlugin *prpl;
+	PurplePluginProtocolInfo *prpl_info = NULL;
 	char *tmp;
 
-	if (GAIM_BLIST_NODE_IS_CHAT(node))
+	if (PURPLE_BLIST_NODE_IS_CHAT(node))
 	{
-		GaimChat *chat;
+		PurpleChat *chat;
 		GList *cur;
 		struct proto_chat_entry *pce;
 		char *name, *value;
 
-		chat = (GaimChat *)node;
-		prpl = gaim_find_prpl(gaim_account_get_protocol_id(chat->account));
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
-
-		if (g_list_length(gaim_connections_get_all()) > 1)
+		chat = (PurpleChat *)node;
+		prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+		if (g_list_length(purple_connections_get_all()) > 1)
 		{
 			tmp = g_markup_escape_text(chat->account->username, -1);
 			g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
@@ -2836,7 +2836,7 @@
 			if (!pce->secret && (!pce->required &&
 				g_hash_table_lookup(chat->components, pce->identifier) == NULL))
 			{
-				tmp = gaim_text_strip_mnemonic(pce->label);
+				tmp = purple_text_strip_mnemonic(pce->label);
 				name = g_markup_escape_text(tmp, -1);
 				g_free(tmp);
 				value = g_markup_escape_text(g_hash_table_lookup(
@@ -2852,41 +2852,41 @@
 			cur = g_list_remove(cur, pce);
 		}
 	}
-	else if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node))
+	else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node))
 	{
 		/* NOTE: THIS FUNCTION IS NO LONGER CALLED FOR CONTACTS.
 		 * It is only called by create_tip_for_node(), and create_tip_for_node() is never called for a contact.
 		 */
-		GaimContact *c;
-		GaimBuddy *b;
-		GaimPresence *presence;
-		GaimNotifyUserInfo *user_info;
+		PurpleContact *c;
+		PurpleBuddy *b;
+		PurplePresence *presence;
+		PurpleNotifyUserInfo *user_info;
 		char *tmp;
 		time_t idle_secs, signon;
 
-		if (GAIM_BLIST_NODE_IS_CONTACT(node))
+		if (PURPLE_BLIST_NODE_IS_CONTACT(node))
 		{
-			c = (GaimContact *)node;
-			b = gaim_contact_get_priority_buddy(c);
+			c = (PurpleContact *)node;
+			b = purple_contact_get_priority_buddy(c);
 		}
 		else
 		{
-			b = (GaimBuddy *)node;
-			c = gaim_buddy_get_contact(b);
+			b = (PurpleBuddy *)node;
+			c = purple_buddy_get_contact(b);
 		}
 
-		prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
-
-		presence = gaim_buddy_get_presence(b);
-		user_info = gaim_notify_user_info_new();
+		prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+		presence = purple_buddy_get_presence(b);
+		user_info = purple_notify_user_info_new();
 
 		/* Account */
-		if (full && g_list_length(gaim_connections_get_all()) > 1)
+		if (full && g_list_length(purple_connections_get_all()) > 1)
 		{
-			tmp = g_markup_escape_text(gaim_account_get_username(
-									   gaim_buddy_get_account(b)), -1);
-			gaim_notify_user_info_add_pair(user_info, _("Account"), tmp);
+			tmp = g_markup_escape_text(purple_account_get_username(
+									   purple_buddy_get_account(b)), -1);
+			purple_notify_user_info_add_pair(user_info, _("Account"), tmp);
 			g_free(tmp);
 		}
 
@@ -2898,7 +2898,7 @@
 		    strcmp(c->alias, b->alias) != 0)
 		{
 			tmp = g_markup_escape_text(b->alias, -1);
-			gaim_notify_user_info_add_pair(user_info, _("Buddy Alias"), tmp);
+			purple_notify_user_info_add_pair(user_info, _("Buddy Alias"), tmp);
 			g_free(tmp);
 		}
 
@@ -2910,47 +2910,47 @@
 		if (full && b->server_alias != NULL && b->server_alias[0] != '\0')
 		{
 			tmp = g_markup_escape_text(b->server_alias, -1);
-			gaim_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
+			purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
 			g_free(tmp);
 		}
 
 		/* Logged In */
-		signon = gaim_presence_get_login_time(presence);
-		if (full && GAIM_BUDDY_IS_ONLINE(b) && signon > 0)
+		signon = purple_presence_get_login_time(presence);
+		if (full && PURPLE_BUDDY_IS_ONLINE(b) && signon > 0)
 		{
-			tmp = gaim_str_seconds_to_string(time(NULL) - signon);
-			gaim_notify_user_info_add_pair(user_info, _("Logged In"), tmp);
+			tmp = purple_str_seconds_to_string(time(NULL) - signon);
+			purple_notify_user_info_add_pair(user_info, _("Logged In"), tmp);
 			g_free(tmp);
 		}
 
 		/* Idle */
-		if (gaim_presence_is_idle(presence))
+		if (purple_presence_is_idle(presence))
 		{
-			idle_secs = gaim_presence_get_idle_time(presence);
+			idle_secs = purple_presence_get_idle_time(presence);
 			if (idle_secs > 0)
 			{
-				tmp = gaim_str_seconds_to_string(time(NULL) - idle_secs);
-				gaim_notify_user_info_add_pair(user_info, _("Idle"), tmp);
+				tmp = purple_str_seconds_to_string(time(NULL) - idle_secs);
+				purple_notify_user_info_add_pair(user_info, _("Idle"), tmp);
 				g_free(tmp);
 			}
 		}
 
 		/* Last Seen */
-		if (full && !GAIM_BUDDY_IS_ONLINE(b))
+		if (full && !PURPLE_BUDDY_IS_ONLINE(b))
 		{
-			struct _pidgin_blist_node *gtknode = ((GaimBlistNode *)c)->ui_data;
-			GaimBlistNode *bnode;
+			struct _pidgin_blist_node *gtknode = ((PurpleBlistNode *)c)->ui_data;
+			PurpleBlistNode *bnode;
 			int lastseen = 0;
 
-			if (!gtknode->contact_expanded || GAIM_BLIST_NODE_IS_CONTACT(node))
+			if (!gtknode->contact_expanded || PURPLE_BLIST_NODE_IS_CONTACT(node))
 			{
 				/* We're either looking at a buddy for a collapsed contact or
 				 * an expanded contact itself so we show the most recent
 				 * (largest) last_seen time for any of the buddies under
 				 * the contact. */
-				for (bnode = ((GaimBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
+				for (bnode = ((PurpleBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
 				{
-					int value = gaim_blist_node_get_int(bnode, "last_seen");
+					int value = purple_blist_node_get_int(bnode, "last_seen");
 					if (value > lastseen)
 						lastseen = value;
 				}
@@ -2959,13 +2959,13 @@
 			{
 				/* We're dealing with a buddy under an expanded contact,
 				 * so we show the last_seen time for the buddy. */
-				lastseen = gaim_blist_node_get_int(&b->node, "last_seen");
+				lastseen = purple_blist_node_get_int(&b->node, "last_seen");
 			}
 
 			if (lastseen > 0)
 			{
-				tmp = gaim_str_seconds_to_string(time(NULL) - lastseen);
-				gaim_notify_user_info_add_pair(user_info, _("Last Seen"), tmp);
+				tmp = purple_str_seconds_to_string(time(NULL) - lastseen);
+				purple_notify_user_info_add_pair(user_info, _("Last Seen"), tmp);
 				g_free(tmp);
 			}
 		}
@@ -2973,8 +2973,8 @@
 
 		/* Offline? */
 		/* FIXME: Why is this status special-cased by the core? -- rlaager */
-		if (!GAIM_BUDDY_IS_ONLINE(b)) {
-			gaim_notify_user_info_add_pair(user_info, _("Status"), _("Offline"));
+		if (!PURPLE_BUDDY_IS_ONLINE(b)) {
+			purple_notify_user_info_add_pair(user_info, _("Status"), _("Offline"));
 		}
 
 		if (prpl_info && prpl_info->tooltip_text)
@@ -2985,76 +2985,76 @@
 
 		/* These are Easter Eggs.  Patches to remove them will be rejected. */
 		if (!g_ascii_strcasecmp(b->name, "robflynn"))
-			gaim_notify_user_info_add_pair(user_info, _("Description"), _("Spooky"));
+			purple_notify_user_info_add_pair(user_info, _("Description"), _("Spooky"));
 		if (!g_ascii_strcasecmp(b->name, "seanegn"))
-			gaim_notify_user_info_add_pair(user_info, _("Status"), _("Awesome"));
+			purple_notify_user_info_add_pair(user_info, _("Status"), _("Awesome"));
 		if (!g_ascii_strcasecmp(b->name, "chipx86"))
-			gaim_notify_user_info_add_pair(user_info, _("Status"), _("Rockin'"));
-
-		tmp = gaim_notify_user_info_get_text_with_newline(user_info, "\n");
+			purple_notify_user_info_add_pair(user_info, _("Status"), _("Rockin'"));
+
+		tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n");
 		g_string_append(str, tmp);
 		g_free(tmp);
 
-		gaim_notify_user_info_destroy(user_info);
-	}
-
-	gaim_signal_emit(pidgin_blist_get_handle(),
+		purple_notify_user_info_destroy(user_info);
+	}
+
+	purple_signal_emit(pidgin_blist_get_handle(),
 			 "drawing-tooltip", node, str, full);
 
 	return g_string_free(str, FALSE);
 }
 
 GdkPixbuf *
-pidgin_blist_get_emblem(GaimBlistNode *node)
-{
-	GaimBuddy *buddy = NULL;
+pidgin_blist_get_emblem(PurpleBlistNode *node)
+{
+	PurpleBuddy *buddy = NULL;
 	struct _pidgin_blist_node *gtknode = node->ui_data;
 	struct _pidgin_blist_node *gtkbuddynode = NULL;
-	GaimPlugin *prpl;
-	GaimPluginProtocolInfo *prpl_info;
+	PurplePlugin *prpl;
+	PurplePluginProtocolInfo *prpl_info;
 	const char *name = NULL;
 	char *filename, *path;
 	GdkPixbuf *ret;
-	GaimPresence *p;
-
-
-
-	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
+	PurplePresence *p;
+
+
+
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		if(!gtknode->contact_expanded) {
-			buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
-			gtkbuddynode = ((GaimBlistNode*)buddy)->ui_data;
+			buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
+			gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
 		}
-	} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		buddy = (GaimBuddy*)node;
+	} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		buddy = (PurpleBuddy*)node;
 		gtkbuddynode = node->ui_data;
 		if (((struct _pidgin_blist_node*)(node->parent->ui_data))->contact_expanded)
-			return pidgin_create_prpl_icon(((GaimBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL);
-	} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
-		return pidgin_create_prpl_icon(((GaimChat*)node)->account, PIDGIN_PRPL_ICON_SMALL);
+			return pidgin_create_prpl_icon(((PurpleBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL);
+	} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		return pidgin_create_prpl_icon(((PurpleChat*)node)->account, PIDGIN_PRPL_ICON_SMALL);
 	} else {
 		return NULL;
 	}
 
-	if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy))) {
+	if (!purple_privacy_check(buddy->account, purple_buddy_get_name(buddy))) {
 		path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL);
 		ret = gdk_pixbuf_new_from_file(path, NULL);
 		g_free(path);
 		return ret;
 	}
 
-	p = gaim_buddy_get_presence(buddy);
-	if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_MOBILE)) {
+	p = purple_buddy_get_presence(buddy);
+	if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
 		path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "mobile.png", NULL);
 		ret = gdk_pixbuf_new_from_file(path, NULL);
 		g_free(path);
 		return ret;
 	}
 
-	prpl = gaim_find_prpl(gaim_account_get_protocol_id(buddy->account));
+	prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account));
 	if (!prpl)
 		return NULL;
 
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 	if (prpl_info && prpl_info->list_emblem)
 		name = prpl_info->list_emblem(buddy);
 
@@ -3074,46 +3074,46 @@
 
 
 GdkPixbuf *
-pidgin_blist_get_status_icon(GaimBlistNode *node, PidginStatusIconSize size)
+pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size)
 {
 	GdkPixbuf *ret;
 	const char *protoname = NULL;
 	struct _pidgin_blist_node *gtknode = node->ui_data;
 	struct _pidgin_blist_node *gtkbuddynode = NULL;
-	GaimBuddy *buddy = NULL;
-	GaimChat *chat = NULL;
+	PurpleBuddy *buddy = NULL;
+	PurpleChat *chat = NULL;
 	GtkIconSize icon_size = gtk_icon_size_from_name((size == PIDGIN_STATUS_ICON_LARGE) ? PIDGIN_ICON_SIZE_TANGO_SMALL :
 											 PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
 
-	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		if(!gtknode->contact_expanded) {
-			buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
-			gtkbuddynode = ((GaimBlistNode*)buddy)->ui_data;
+			buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
+			gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
 		}
-	} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		buddy = (GaimBuddy*)node;
+	} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		buddy = (PurpleBuddy*)node;
 		gtkbuddynode = node->ui_data;
-	} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
-		chat = (GaimChat*)node;
+	} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		chat = (PurpleChat*)node;
 	} else {
 		return NULL;
 	}
 
 	if(buddy || chat) {
-		GaimAccount *account;
-		GaimPlugin *prpl;
-		GaimPluginProtocolInfo *prpl_info;
+		PurpleAccount *account;
+		PurplePlugin *prpl;
+		PurplePluginProtocolInfo *prpl_info;
 
 		if(buddy)
 			account = buddy->account;
 		else
 			account = chat->account;
 
-		prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
+		prpl = purple_find_prpl(purple_account_get_protocol_id(account));
 		if(!prpl)
 			return NULL;
 
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 		if(prpl_info && prpl_info->list_icon) {
 			protoname = prpl_info->list_icon(account, buddy);
@@ -3121,10 +3121,10 @@
 	}
 
 	if(buddy) {
-	  	GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM,
-									     gaim_buddy_get_name(buddy),
-									     gaim_buddy_get_account(buddy));
-		GaimPresence *p;
+	  	PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
+									     purple_buddy_get_name(buddy),
+									     purple_buddy_get_account(buddy));
+		PurplePresence *p;
 		if(conv != NULL) {
 			PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
 			if(gtkconv != NULL && pidgin_conv_is_hidden(gtkconv) && size == PIDGIN_STATUS_ICON_SMALL) {
@@ -3132,39 +3132,39 @@
 							       icon_size, "GtkTreeView");
 			}
 		}
-		p = gaim_buddy_get_presence(buddy);
-
-		if (GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff)
+		p = purple_buddy_get_presence(buddy);
+
+		if (PURPLE_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff)
 			ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_LOGIN,
 					icon_size, "GtkTreeView");
 		else if (gtkbuddynode && gtkbuddynode->recent_signonoff)
 			ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_LOGOUT,
 					icon_size, "GtkTreeView");
-		else if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_UNAVAILABLE))
-			if (gaim_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
+		else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE))
+			if (purple_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
 				ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_BUSY_I,
 						icon_size, "GtkTreeView");
 			else
 				ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_BUSY,
 						icon_size, "GtkTreeView");
-		else if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_AWAY))
-		        if (gaim_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
+		else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY))
+		        if (purple_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
 		                ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_AWAY_I,
 		                                icon_size, "GtkTreeView");
 		 	else
 				ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_AWAY,
 						icon_size, "GtkTreeView");
-		else if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_EXTENDED_AWAY))
-			if (gaim_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
+		else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY))
+			if (purple_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
 		        	ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_XA_I,
 						icon_size, "GtkTreeView");
 			else
 				ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_XA,
 						icon_size, "GtkTreeView");
-		else if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_OFFLINE))
+		else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE))
 			ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_OFFLINE,
 					icon_size, "GtkTreeView");
-		else if (gaim_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
+		else if (purple_presence_is_idle(p) && size == PIDGIN_STATUS_ICON_SMALL)
 			ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_AVAILABLE_I,
 					icon_size, "GtkTreeView");
 		else
@@ -3181,20 +3181,20 @@
 	return ret;
 }
 
-static gchar *pidgin_blist_get_name_markup(GaimBuddy *b, gboolean selected)
+static gchar *pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected)
 {
 	const char *name;
 	char *esc, *text = NULL;
-	GaimPlugin *prpl;
-	GaimPluginProtocolInfo *prpl_info = NULL;
-	GaimContact *contact;
-	GaimPresence *presence;
+	PurplePlugin *prpl;
+	PurplePluginProtocolInfo *prpl_info = NULL;
+	PurpleContact *contact;
+	PurplePresence *presence;
 	struct _pidgin_blist_node *gtkcontactnode = NULL;
 	char *idletime = NULL, *statustext = NULL;
 	time_t t;
-	GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM,
-								     gaim_buddy_get_name(b),
-								     gaim_buddy_get_account(b));
+	PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
+								     purple_buddy_get_name(b),
+								     purple_buddy_get_account(b));
 	PidginConversation *gtkconv;
 	gboolean hidden_conv = FALSE;
 
@@ -3207,21 +3207,21 @@
 
 	/* XXX Good luck cleaning up this crap */
 
-	contact = (GaimContact*)((GaimBlistNode*)b)->parent;
+	contact = (PurpleContact*)((PurpleBlistNode*)b)->parent;
 	if(contact)
-		gtkcontactnode = ((GaimBlistNode*)contact)->ui_data;
+		gtkcontactnode = ((PurpleBlistNode*)contact)->ui_data;
 
 	if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
 		name = contact->alias;
 	else
-		name = gaim_buddy_get_alias(b);
+		name = purple_buddy_get_alias(b);
 	esc = g_markup_escape_text(name, strlen(name));
 
-	presence = gaim_buddy_get_presence(b);
-
-	if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
+	presence = purple_buddy_get_presence(b);
+
+	if (!purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons"))
 	{
-		if (!selected && gaim_presence_is_idle(presence))
+		if (!selected && purple_presence_is_idle(presence))
 		{
 			text = g_strdup_printf("<span color='%s'>%s</span>",
 					       dim_grey(), esc);
@@ -3242,10 +3242,10 @@
 			return esc;
 	}
 
-	prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
+	prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
 
 	if (prpl != NULL)
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 	if (prpl_info && prpl_info->status_text && b->account->gc) {
 		char *tmp = prpl_info->status_text(b);
@@ -3265,7 +3265,7 @@
 			int length = 0, vis=0;
 			gboolean inside = FALSE;
 			g_strdelimit(tmp, "\n", ' ');
-			gaim_str_strip_char(tmp, '\r');
+			purple_str_strip_char(tmp, '\r');
 
 			while(*c && vis < 20) {
 				if(*c == '&')
@@ -3291,20 +3291,20 @@
 #else
 		if(tmp) {
 			g_strdelimit(tmp, "\n", ' ');
-			gaim_str_strip_char(tmp, '\r');
+			purple_str_strip_char(tmp, '\r');
 		}
 		statustext = tmp;
 #endif
 	}
 
-	if(!gaim_presence_is_online(presence) && !statustext)
+	if(!purple_presence_is_online(presence) && !statustext)
 		statustext = g_strdup(_("Offline"));
 	else if (!statustext)
 		text = g_strdup(esc);
 
-	if (gaim_presence_is_idle(presence)) {
-		if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time")) {
-			time_t idle_secs = gaim_presence_get_idle_time(presence);
+	if (purple_presence_is_idle(presence)) {
+		if (purple_prefs_get_bool("/purple/gtk/blist/show_idle_time")) {
+			time_t idle_secs = purple_presence_get_idle_time(presence);
 
 			if (idle_secs > 0) {
 				int ihrs, imin;
@@ -3373,16 +3373,16 @@
 {
 	int blist_x, blist_y, blist_width, blist_height;
 
-	blist_width = gaim_prefs_get_int("/gaim/gtk/blist/width");
+	blist_width = purple_prefs_get_int("/purple/gtk/blist/width");
 
 	/* if the window exists, is hidden, we're saving positions, and the
 	 * position is sane... */
 	if (gtkblist && gtkblist->window &&
 		!GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
 
-		blist_x      = gaim_prefs_get_int("/gaim/gtk/blist/x");
-		blist_y      = gaim_prefs_get_int("/gaim/gtk/blist/y");
-		blist_height = gaim_prefs_get_int("/gaim/gtk/blist/height");
+		blist_x      = purple_prefs_get_int("/purple/gtk/blist/x");
+		blist_y      = purple_prefs_get_int("/purple/gtk/blist/y");
+		blist_height = purple_prefs_get_int("/purple/gtk/blist/height");
 
 		/* ...check position is on screen... */
 		if (blist_x >= gdk_screen_width())
@@ -3398,30 +3398,30 @@
 		/* ...and move it back. */
 		gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
 		gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
-		if (gaim_prefs_get_bool("/gaim/gtk/blist/list_maximized"))
+		if (purple_prefs_get_bool("/purple/gtk/blist/list_maximized"))
 			gtk_window_maximize(GTK_WINDOW(gtkblist->window));
 	}
 }
 
-static gboolean pidgin_blist_refresh_timer(GaimBuddyList *list)
-{
-	GaimBlistNode *gnode, *cnode;
+static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list)
+{
+	PurpleBlistNode *gnode, *cnode;
 
 	if (gtk_blist_obscured || !GTK_WIDGET_VISIBLE(gtkblist->window))
 		return TRUE;
 
 	for(gnode = list->root; gnode; gnode = gnode->next) {
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
+		if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
 			continue;
 		for(cnode = gnode->child; cnode; cnode = cnode->next) {
-			if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
-				GaimBuddy *buddy;
-
-				buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
+			if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
+				PurpleBuddy *buddy;
+
+				buddy = purple_contact_get_priority_buddy((PurpleContact*)cnode);
 
 				if (buddy &&
-						gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
-					pidgin_blist_update_contact(list, (GaimBlistNode*)buddy);
+						purple_presence_is_idle(purple_buddy_get_presence(buddy)))
+					pidgin_blist_update_contact(list, (PurpleBlistNode*)buddy);
 			}
 		}
 	}
@@ -3430,7 +3430,7 @@
 	return TRUE;
 }
 
-static void pidgin_blist_hide_node(GaimBuddyList *list, GaimBlistNode *node, gboolean update)
+static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, gboolean update)
 {
 	struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
 	GtkTreeIter iter;
@@ -3442,8 +3442,8 @@
 		gtkblist->selected_node = NULL;
 	if (get_iter_from_node(node, &iter)) {
 		gtk_tree_store_remove(gtkblist->treemodel, &iter);
-		if(update && (GAIM_BLIST_NODE_IS_CONTACT(node) ||
-			GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CHAT(node))) {
+		if(update && (PURPLE_BLIST_NODE_IS_CONTACT(node) ||
+			PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CHAT(node))) {
 			pidgin_blist_update(list, node->parent);
 		}
 	}
@@ -3479,7 +3479,7 @@
 
 	pidgin_blist_update_accounts_menu();
 
-	sensitive = (gaim_connections_get_all() != NULL);
+	sensitive = (purple_connections_get_all() != NULL);
 
 	for (i = 0; i < require_connection_size; i++)
 	{
@@ -3494,17 +3494,17 @@
 	gtk_widget_set_sensitive(widget, pidgin_blist_joinchat_is_showable());
 
 	widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounces"));
-	gtk_widget_set_sensitive(widget, (gaim_accounts_get_all() != NULL));
+	gtk_widget_set_sensitive(widget, (purple_accounts_get_all() != NULL));
 
 	widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
-	gtk_widget_set_sensitive(widget, (gaim_connections_get_all() != NULL));
+	gtk_widget_set_sensitive(widget, (purple_connections_get_all() != NULL));
 
 	widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List"));
 	gtk_widget_set_sensitive(widget, pidgin_roomlist_is_showable());
 }
 
 static void
-sign_on_off_cb(GaimConnection *gc, GaimBuddyList *blist)
+sign_on_off_cb(PurpleConnection *gc, PurpleBuddyList *blist)
 {
 	PidginBuddyList *gtkblist = PIDGIN_BLIST(blist);
 
@@ -3512,7 +3512,7 @@
 }
 
 static void
-plugin_changed_cb(GaimPlugin *p, gpointer *data)
+plugin_changed_cb(PurplePlugin *p, gpointer *data)
 {
 	pidgin_blist_update_plugin_actions();
 }
@@ -3528,7 +3528,7 @@
 		menu = NULL;
 	}
 
-	convs = pidgin_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, PIDGIN_UNSEEN_TEXT, TRUE, 0);
+	convs = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM, PIDGIN_UNSEEN_TEXT, TRUE, 0);
 	if (!convs)
 		/* no conversations added, don't show the menu */
 		return;
@@ -3549,10 +3549,10 @@
 
 	switch (event->button) {
 		case 1:
-			convs = pidgin_conversations_find_unseen_list(GAIM_CONV_TYPE_IM,
+			convs = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
 															PIDGIN_UNSEEN_TEXT, TRUE, 1);
 			if (convs) {
-				gaim_conversation_present((GaimConversation*)convs->data);
+				purple_conversation_present((PurpleConversation*)convs->data);
 				g_list_free(convs);
 			}
 			break;
@@ -3564,19 +3564,19 @@
 }
 
 static void
-conversation_updated_cb(GaimConversation *conv, GaimConvUpdateType type,
+conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type,
                         PidginBuddyList *gtkblist)
 {
 	GList *convs = NULL;
 	GList *l = NULL;
 
-	if (type != GAIM_CONV_UPDATE_UNSEEN)
+	if (type != PURPLE_CONV_UPDATE_UNSEEN)
 		return;
 
 	if(conv->account != NULL && conv->name != NULL) {
-		GaimBuddy *buddy = gaim_find_buddy(conv->account, conv->name);
+		PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name);
 		if(buddy != NULL)
-			pidgin_blist_update_buddy(NULL, (GaimBlistNode *)buddy, TRUE);
+			pidgin_blist_update_buddy(NULL, (PurpleBlistNode *)buddy, TRUE);
 	}
 
 	if (gtkblist->menutrayicon) {
@@ -3584,7 +3584,7 @@
 		gtkblist->menutrayicon = NULL;
 	}
 
-	convs = pidgin_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, PIDGIN_UNSEEN_TEXT, TRUE, 0);
+	convs = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM, PIDGIN_UNSEEN_TEXT, TRUE, 0);
 	if (convs) {
 		GtkWidget *img = NULL;
 		GString *tooltip_text = NULL;
@@ -3593,7 +3593,7 @@
 		l = convs;
 		while (l != NULL) {
 			if (PIDGIN_IS_PIDGIN_CONVERSATION(l->data)) {
-				PidginConversation *gtkconv = PIDGIN_CONVERSATION((GaimConversation *)l->data);
+				PidginConversation *gtkconv = PIDGIN_CONVERSATION((PurpleConversation *)l->data);
 
 				g_string_append_printf(tooltip_text,
 						ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
@@ -3622,16 +3622,16 @@
 }
 
 static void
-conversation_deleting_cb(GaimConversation *conv, PidginBuddyList *gtkblist)
-{
-	conversation_updated_cb(conv, GAIM_CONV_UPDATE_UNSEEN, gtkblist);
+conversation_deleting_cb(PurpleConversation *conv, PidginBuddyList *gtkblist)
+{
+	conversation_updated_cb(conv, PURPLE_CONV_UPDATE_UNSEEN, gtkblist);
 }
 
 /**********************************************************************************
  * Public API Functions                                                           *
  **********************************************************************************/
 
-static void pidgin_blist_new_list(GaimBuddyList *blist)
+static void pidgin_blist_new_list(PurpleBuddyList *blist)
 {
 	PidginBuddyList *gtkblist;
 
@@ -3641,17 +3641,17 @@
 	blist->ui_data = gtkblist;
 }
 
-static void pidgin_blist_new_node(GaimBlistNode *node)
+static void pidgin_blist_new_node(PurpleBlistNode *node)
 {
 	node->ui_data = g_new0(struct _pidgin_blist_node, 1);
 }
 
-gboolean pidgin_blist_node_is_contact_expanded(GaimBlistNode *node)
-{
-	if GAIM_BLIST_NODE_IS_BUDDY(node)
+gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node)
+{
+	if PURPLE_BLIST_NODE_IS_BUDDY(node)
 		node = node->parent;
 
-	g_return_val_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node), FALSE);
+	g_return_val_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node), FALSE);
 
 	return ((struct _pidgin_blist_node *)node->ui_data)->contact_expanded;
 }
@@ -3679,14 +3679,14 @@
 	pidgin_blist_sort_method_reg("status", _("By status"), sort_method_status);
 	pidgin_blist_sort_method_reg("log_size", _("By log size"), sort_method_log);
 #endif
-	pidgin_blist_sort_method_set(gaim_prefs_get_string("/gaim/gtk/blist/sort_type"));
+	pidgin_blist_sort_method_set(purple_prefs_get_string("/purple/gtk/blist/sort_type"));
 }
 
 static void _prefs_change_redo_list()
 {
 	GtkTreeSelection *sel;
 	GtkTreeIter iter;
-	GaimBlistNode *node = NULL;
+	PurpleBlistNode *node = NULL;
 
 	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
 	if (gtk_tree_selection_get_selected(sel, NULL, &iter))
@@ -3694,7 +3694,7 @@
 		gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
 	}
 
-	redo_buddy_list(gaim_get_blist(), FALSE, FALSE);
+	redo_buddy_list(purple_get_blist(), FALSE, FALSE);
 #if GTK_CHECK_VERSION(2,6,0)
 	gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
 #endif
@@ -3715,20 +3715,20 @@
 	}
 }
 
-static void _prefs_change_sort_method(const char *pref_name, GaimPrefType type,
+static void _prefs_change_sort_method(const char *pref_name, PurplePrefType type,
 									  gconstpointer val, gpointer data)
 {
-	if(!strcmp(pref_name, "/gaim/gtk/blist/sort_type"))
+	if(!strcmp(pref_name, "/purple/gtk/blist/sort_type"))
 		pidgin_blist_sort_method_set(val);
 }
 
-static void account_modified(GaimAccount *account, PidginBuddyList *gtkblist)
+static void account_modified(PurpleAccount *account, PidginBuddyList *gtkblist)
 {
 	GList *list;
 	if (!gtkblist)
 		return;
 
-	if ((list = gaim_accounts_get_all_active()) != NULL) {
+	if ((list = purple_accounts_get_all_active()) != NULL) {
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkblist->notebook), 1);
 		g_list_free(list);
 	} else
@@ -3738,8 +3738,8 @@
 }
 
 static void
-account_status_changed(GaimAccount *account, GaimStatus *old,
-					   GaimStatus *new, PidginBuddyList *gtkblist)
+account_status_changed(PurpleAccount *account, PurpleStatus *old,
+					   PurpleStatus *new, PidginBuddyList *gtkblist)
 {
 	if (!gtkblist)
 		return;
@@ -3801,7 +3801,7 @@
 static gboolean
 headline_box_motion_cb(GtkWidget *widget, GdkEventMotion *event, PidginBuddyList *gtkblist)
 {
-	gaim_debug_fatal("motion", "%d %d\n", (int)event->x, (int)event->y);
+	purple_debug_fatal("motion", "%d %d\n", (int)event->x, (int)event->y);
 	if (headline_hover_close((int)event->x, (int)event->y))
 		gtk_paint_focus(widget->style, widget->window, GTK_STATE_PRELIGHT,
 				NULL, widget, NULL,
@@ -3859,38 +3859,38 @@
 /***********************************/
 
 static void
-ce_modify_account_cb(GaimAccount *account)
+ce_modify_account_cb(PurpleAccount *account)
 {
 	pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, account);
 }
 
 static void
-ce_enable_account_cb(GaimAccount *account)
-{
-	gaim_account_set_enabled(account, gaim_core_get_ui(), TRUE);
+ce_enable_account_cb(PurpleAccount *account)
+{
+	purple_account_set_enabled(account, purple_core_get_ui(), TRUE);
 }
 
 static void
 connection_error_button_clicked_cb(GtkButton *widget, gpointer user_data)
 {
-	GaimAccount *account;
+	PurpleAccount *account;
 	char *primary;
 	const char *text;
 	gboolean enabled;
 
 	account = user_data;
 	primary = g_strdup_printf(_("%s disconnected"),
-							  gaim_account_get_username(account));
+							  purple_account_get_username(account));
 	text = g_hash_table_lookup(gtkblist->connection_errors, account);
 
-	enabled = gaim_account_get_enabled(account, gaim_core_get_ui());
-	gaim_request_action(account, _("Connection Error"), primary, text, 2,
+	enabled = purple_account_get_enabled(account, purple_core_get_ui());
+	purple_request_action(account, _("Connection Error"), primary, text, 2,
 						account, 3,
 						_("OK"), NULL,
-						_("Modify Account"), GAIM_CALLBACK(ce_modify_account_cb),
+						_("Modify Account"), PURPLE_CALLBACK(ce_modify_account_cb),
 						enabled ? _("Connect") : _("Re-enable Account"),
-						enabled ? GAIM_CALLBACK(gaim_account_connect) :
-									GAIM_CALLBACK(ce_enable_account_cb));
+						enabled ? PURPLE_CALLBACK(purple_account_connect) :
+									PURPLE_CALLBACK(ce_enable_account_cb));
 	g_free(primary);
 	gtk_widget_destroy(GTK_WIDGET(widget));
 	g_hash_table_remove(gtkblist->connection_errors, account);
@@ -3901,8 +3901,8 @@
 create_connection_error_buttons(gpointer key, gpointer value,
                                 gpointer user_data)
 {
-	GaimAccount *account;
-	GaimStatusType *status_type;
+	PurpleAccount *account;
+	PurpleStatusType *status_type;
 	gchar *escaped, *text;
 	GtkWidget *button, *label, *image, *hbox;
 	GdkPixbuf *pixbuf;
@@ -3910,15 +3910,15 @@
 	account = key;
 	escaped = g_markup_escape_text((const gchar *)value, -1);
 	text = g_strdup_printf(_("<span color=\"red\">%s disconnected: %s</span>"),
-	                       gaim_account_get_username(account),
+	                       purple_account_get_username(account),
 	                       escaped);
 	g_free(escaped);
 
 	hbox = gtk_hbox_new(FALSE, 0);
 
 	/* Create the icon */
-	if ((status_type = gaim_account_get_status_type_with_primitive(account,
-							GAIM_STATUS_OFFLINE))) {
+	if ((status_type = purple_account_get_status_type_with_primitive(account,
+							PURPLE_STATUS_OFFLINE))) {
 		pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
 		if (pixbuf != NULL) {
 			image = gtk_image_new_from_pixbuf(pixbuf);
@@ -3951,7 +3951,7 @@
 }
 
 void
-pidgin_blist_update_account_error_state(GaimAccount *account, const char *text)
+pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text)
 {
 	GList *l;
 
@@ -4000,8 +4000,8 @@
 		    GtkStyle *prev_style,
 		    gpointer data)
 {
-	GaimBuddyList *list = data;
-	GaimBlistNode *node = list->root;
+	PurpleBuddyList *list = data;
+	PurpleBlistNode *node = list->root;
 	while (node) {
 		pidgin_blist_update_group(list, node);
 		node = node->next;
@@ -4095,7 +4095,7 @@
 }
 #endif
 
-static void pidgin_blist_show(GaimBuddyList *list)
+static void pidgin_blist_show(PurpleBuddyList *list)
 {
 	void *handle;
 	GtkCellRenderer *rend;
@@ -4109,16 +4109,16 @@
 	char *pretty;
 	GtkAccelGroup *accel_group;
 	GtkTreeSelection *selection;
-	GtkTargetEntry dte[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
+	GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
 				{"application/x-im-contact", 0, DRAG_BUDDY},
 				{"text/x-vcard", 0, DRAG_VCARD },
 				{"text/uri-list", 0, DRAG_URI},
 				{"text/plain", 0, DRAG_TEXT}};
-	GtkTargetEntry ste[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
+	GtkTargetEntry ste[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
 				{"application/x-im-contact", 0, DRAG_BUDDY},
 				{"text/x-vcard", 0, DRAG_VCARD }};
 	if (gtkblist && gtkblist->window) {
-		gaim_blist_set_visible(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
+		purple_blist_set_visible(purple_prefs_get_bool("/purple/gtk/blist/list_visible"));
 		return;
 	}
 
@@ -4149,7 +4149,7 @@
 	accel_group = gtk_accel_group_new();
 	gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
 	g_object_unref(accel_group);
-	gtkblist->ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<GaimMain>", accel_group);
+	gtkblist->ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<PurpleMain>", accel_group);
 	gtk_item_factory_set_translate_func(gtkblist->ift,
 										(GtkTranslateFunc)item_factory_translate_func,
 										NULL, NULL);
@@ -4158,7 +4158,7 @@
 	pidgin_load_accels();
 	g_signal_connect(G_OBJECT(accel_group), "accel-changed",
 														G_CALLBACK(pidgin_save_accels_cb), NULL);
-	menu = gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>");
+	menu = gtk_item_factory_get_widget(gtkblist->ift, "<PurpleMain>");
 	gtkblist->menutray = pidgin_menu_tray_new();
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray);
 	gtk_widget_show(gtkblist->menutray);
@@ -4186,7 +4186,7 @@
 					       "enable accounts, you'll be able to sign on, set your status, "
 					       "and talk to your friends."));
 	label = gtk_label_new(NULL);
-	gtk_widget_set_size_request(label, gaim_prefs_get_int("/gaim/gtk/blist/width") - 12, -1);
+	gtk_widget_set_size_request(label, purple_prefs_get_int("/purple/gtk/blist/width") - 12, -1);
 	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
 	gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.2);
 	gtk_label_set_markup(GTK_LABEL(label), pretty);
@@ -4195,7 +4195,7 @@
 	gtkblist->vbox = gtk_vbox_new(FALSE, 0);
 	gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook), gtkblist->vbox, NULL);
 	gtk_widget_show_all(gtkblist->notebook);
-	if ((accounts = gaim_accounts_get_all_active())) {
+	if ((accounts = purple_accounts_get_all_active())) {
 		g_list_free(accounts);
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkblist->notebook), 1);
 	}
@@ -4209,7 +4209,7 @@
 	gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0);
 	gtkblist->headline_label = gtk_label_new(NULL);
 	gtk_widget_set_size_request(gtkblist->headline_label,
-				    gaim_prefs_get_int("/gaim/gtk/blist/width")-25,-1);
+				    purple_prefs_get_int("/purple/gtk/blist/width")-25,-1);
 	gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE);
 	gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0);
 	gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0);
@@ -4420,21 +4420,21 @@
 	 * after the treeview or faceprint gets mad. -Robot101
 	 */
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Offline Buddies"))),
-			gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
+			purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies"));
 
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Empty Groups"))),
-			gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
+			purple_prefs_get_bool("/purple/gtk/blist/show_empty_groups"));
 
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))),
-			gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
+			purple_prefs_get_bool("/purple/gtk/sound/mute"));
 
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Buddy Details"))),
-			gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"));
+			purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons"));
 
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Idle Times"))),
-			gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time"));
-
-	if(!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"))
+			purple_prefs_get_bool("/purple/gtk/blist/show_idle_time"));
+
+	if(!strcmp(purple_prefs_get_string("/purple/gtk/sound/method"), "none"))
 		gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE);
 
 	/* Update some dynamic things */
@@ -4447,7 +4447,7 @@
 	pidgin_blist_restore_position();
 	gtk_widget_show_all(GTK_WIDGET(gtkblist->vbox));
 	gtk_widget_realize(GTK_WIDGET(gtkblist->window));
-	gaim_blist_set_visible(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
+	purple_blist_set_visible(purple_prefs_get_bool("/purple/gtk/blist/list_visible"));
 
 	/* start the refresh timer */
 	gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)pidgin_blist_refresh_timer, list);
@@ -4455,64 +4455,64 @@
 	handle = pidgin_blist_get_handle();
 
 	/* things that affect how buddies are displayed */
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
+	purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_buddy_icons",
 			_prefs_change_redo_list, NULL);
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_idle_time",
+	purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_idle_time",
 			_prefs_change_redo_list, NULL);
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_empty_groups",
+	purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_empty_groups",
 			_prefs_change_redo_list, NULL);
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_offline_buddies",
+	purple_prefs_connect_callback(handle, "/purple/gtk/blist/show_offline_buddies",
 			_prefs_change_redo_list, NULL);
 
 	/* sorting */
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/sort_type",
+	purple_prefs_connect_callback(handle, "/purple/gtk/blist/sort_type",
 			_prefs_change_sort_method, NULL);
 
 	/* menus */
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/mute",
+	purple_prefs_connect_callback(handle, "/purple/gtk/sound/mute",
 			pidgin_blist_mute_pref_cb, NULL);
-	gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/method",
+	purple_prefs_connect_callback(handle, "/purple/gtk/sound/method",
 			pidgin_blist_sound_method_pref_cb, NULL);
 
-	/* Setup some gaim signal handlers. */
-	gaim_signal_connect(gaim_accounts_get_handle(), "account-enabled",
-			gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
-	gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled",
-			gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
-	gaim_signal_connect(gaim_accounts_get_handle(), "account-removed",
-			gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
-	gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
-			gtkblist, GAIM_CALLBACK(account_status_changed), gtkblist);
-
-	gaim_signal_connect(pidgin_account_get_handle(), "account-modified",
-			gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
-
-	gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
-						gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
-	gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
-						gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
-
-	gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load",
-			gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
-	gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload",
-			gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
-
-	gaim_signal_connect(gaim_conversations_get_handle(), "conversation-updated",
-						gtkblist, GAIM_CALLBACK(conversation_updated_cb),
+	/* Setup some purple signal handlers. */
+	purple_signal_connect(purple_accounts_get_handle(), "account-enabled",
+			gtkblist, PURPLE_CALLBACK(account_modified), gtkblist);
+	purple_signal_connect(purple_accounts_get_handle(), "account-disabled",
+			gtkblist, PURPLE_CALLBACK(account_modified), gtkblist);
+	purple_signal_connect(purple_accounts_get_handle(), "account-removed",
+			gtkblist, PURPLE_CALLBACK(account_modified), gtkblist);
+	purple_signal_connect(purple_accounts_get_handle(), "account-status-changed",
+			gtkblist, PURPLE_CALLBACK(account_status_changed), gtkblist);
+
+	purple_signal_connect(pidgin_account_get_handle(), "account-modified",
+			gtkblist, PURPLE_CALLBACK(account_modified), gtkblist);
+
+	purple_signal_connect(purple_connections_get_handle(), "signed-on",
+						gtkblist, PURPLE_CALLBACK(sign_on_off_cb), list);
+	purple_signal_connect(purple_connections_get_handle(), "signed-off",
+						gtkblist, PURPLE_CALLBACK(sign_on_off_cb), list);
+
+	purple_signal_connect(purple_plugins_get_handle(), "plugin-load",
+			gtkblist, PURPLE_CALLBACK(plugin_changed_cb), NULL);
+	purple_signal_connect(purple_plugins_get_handle(), "plugin-unload",
+			gtkblist, PURPLE_CALLBACK(plugin_changed_cb), NULL);
+
+	purple_signal_connect(purple_conversations_get_handle(), "conversation-updated",
+						gtkblist, PURPLE_CALLBACK(conversation_updated_cb),
 						gtkblist);
-	gaim_signal_connect(gaim_conversations_get_handle(), "deleting-conversation",
-						gtkblist, GAIM_CALLBACK(conversation_deleting_cb),
+	purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation",
+						gtkblist, PURPLE_CALLBACK(conversation_deleting_cb),
 						gtkblist);
 
 	gtk_widget_hide(gtkblist->headline_hbox);
 
 	/* emit our created signal */
-	gaim_signal_emit(handle, "gtkblist-created", list);
-}
-
-static void redo_buddy_list(GaimBuddyList *list, gboolean remove, gboolean rerender)
-{
-	GaimBlistNode *node;
+	purple_signal_emit(handle, "gtkblist-created", list);
+}
+
+static void redo_buddy_list(PurpleBuddyList *list, gboolean remove, gboolean rerender)
+{
+	PurpleBlistNode *node;
 
 	gtkblist = PIDGIN_BLIST(list);
 	if(!gtkblist || !gtkblist->treeview)
@@ -4525,21 +4525,21 @@
 		/* This is only needed when we're reverting to a non-GTK+ sorted
 		 * status.  We shouldn't need to remove otherwise.
 		 */
-		if (remove && !GAIM_BLIST_NODE_IS_GROUP(node))
+		if (remove && !PURPLE_BLIST_NODE_IS_GROUP(node))
 			pidgin_blist_hide_node(list, node, FALSE);
 
-		if (GAIM_BLIST_NODE_IS_BUDDY(node))
+		if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 			pidgin_blist_update_buddy(list, node, rerender);
-		else if (GAIM_BLIST_NODE_IS_CHAT(node))
+		else if (PURPLE_BLIST_NODE_IS_CHAT(node))
 			pidgin_blist_update(list, node);
-		else if (GAIM_BLIST_NODE_IS_GROUP(node))
+		else if (PURPLE_BLIST_NODE_IS_GROUP(node))
 			pidgin_blist_update(list, node);
-		node = gaim_blist_node_next(node, FALSE);
-	}
-
-}
-
-void pidgin_blist_refresh(GaimBuddyList *list)
+		node = purple_blist_node_next(node, FALSE);
+	}
+
+}
+
+void pidgin_blist_refresh(PurpleBuddyList *list)
 {
 	redo_buddy_list(list, FALSE, TRUE);
 }
@@ -4547,16 +4547,16 @@
 void
 pidgin_blist_update_refresh_timeout()
 {
-	GaimBuddyList *blist;
+	PurpleBuddyList *blist;
 	PidginBuddyList *gtkblist;
 
-	blist = gaim_get_blist();
-	gtkblist = PIDGIN_BLIST(gaim_get_blist());
+	blist = purple_get_blist();
+	gtkblist = PIDGIN_BLIST(purple_get_blist());
 
 	gtkblist->refresh_timer = g_timeout_add(30000,(GSourceFunc)pidgin_blist_refresh_timer, blist);
 }
 
-static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
+static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) {
 	struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
 	GtkTreePath *path;
 
@@ -4565,7 +4565,7 @@
 	}
 
 	if (!gtkblist) {
-		gaim_debug_error("gtkblist", "get_iter_from_node was called, but we don't seem to have a blist\n");
+		purple_debug_error("gtkblist", "get_iter_from_node was called, but we don't seem to have a blist\n");
 		return FALSE;
 	}
 
@@ -4584,11 +4584,11 @@
 	return TRUE;
 }
 
-static void pidgin_blist_remove(GaimBuddyList *list, GaimBlistNode *node)
+static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node)
 {
 	struct _pidgin_blist_node *gtknode = node->ui_data;
 
-	gaim_request_close_with_handle(node);
+	purple_request_close_with_handle(node);
 
 	pidgin_blist_hide_node(list, node, TRUE);
 
@@ -4606,16 +4606,16 @@
 
 	if(gtknode) {
 		if(gtknode->recent_signonoff_timer > 0)
-			gaim_timeout_remove(gtknode->recent_signonoff_timer);
+			purple_timeout_remove(gtknode->recent_signonoff_timer);
 
 		g_free(node->ui_data);
 		node->ui_data = NULL;
 	}
 }
 
-static gboolean do_selection_changed(GaimBlistNode *new_selection)
-{
-	GaimBlistNode *old_selection = NULL;
+static gboolean do_selection_changed(PurpleBlistNode *new_selection)
+{
+	PurpleBlistNode *old_selection = NULL;
 
 	/* test for gtkblist because crazy timeout means we can be called after the blist is gone */
 	if (gtkblist && new_selection != gtkblist->selected_node) {
@@ -4632,7 +4632,7 @@
 
 static void pidgin_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
 {
-	GaimBlistNode *new_selection = NULL;
+	PurpleBlistNode *new_selection = NULL;
 	GtkTreeIter iter;
 
 	if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
@@ -4644,7 +4644,7 @@
 	g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
 }
 
-static gboolean insert_node(GaimBuddyList *list, GaimBlistNode *node, GtkTreeIter *iter)
+static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter)
 {
 	GtkTreeIter parent_iter, cur, *curptr = NULL;
 	struct _pidgin_blist_node *gtknode = node->ui_data;
@@ -4659,7 +4659,7 @@
 	if(get_iter_from_node(node, &cur))
 		curptr = &cur;
 
-	if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node)) {
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_CHAT(node)) {
 		current_sort_method->func(node, list, parent_iter, curptr, iter);
 	} else {
 		sort_method_none(node, list, parent_iter, curptr, iter);
@@ -4688,10 +4688,10 @@
 		GtkTreePath *expand = NULL;
 		struct _pidgin_blist_node *gtkparentnode = node->parent->ui_data;
 
-		if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) {
-			if(!gaim_blist_node_get_bool(node->parent, "collapsed"))
+		if(PURPLE_BLIST_NODE_IS_GROUP(node->parent)) {
+			if(!purple_blist_node_get_bool(node->parent, "collapsed"))
 				expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter);
-		} else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) &&
+		} else if(PURPLE_BLIST_NODE_IS_CONTACT(node->parent) &&
 				gtkparentnode->contact_expanded) {
 			expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter);
 		}
@@ -4706,35 +4706,35 @@
 
 /*This version of pidgin_blist_update_group can take the original buddy
 or a group, but has much better algorithmic performance with a pre-known buddy*/
-static void pidgin_blist_update_group(GaimBuddyList *list, GaimBlistNode *node)
-{
-	GaimGroup *group;
+static void pidgin_blist_update_group(PurpleBuddyList *list, PurpleBlistNode *node)
+{
+	PurpleGroup *group;
 	int count;
 	gboolean show = FALSE;
-	GaimBlistNode* gnode;
+	PurpleBlistNode* gnode;
 
 	g_return_if_fail(node != NULL);
 
-	if (GAIM_BLIST_NODE_IS_GROUP(node))
+	if (PURPLE_BLIST_NODE_IS_GROUP(node))
 		gnode = node;
-	else if (GAIM_BLIST_NODE_IS_BUDDY(node))
+	else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 		gnode = node->parent->parent;
-	else if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node))
+	else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_CHAT(node))
 		gnode = node->parent;
 	else
 		return;
 
-	group = (GaimGroup*)gnode;
-
-	if(gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"))
-		count = gaim_blist_get_group_size(group, FALSE);
+	group = (PurpleGroup*)gnode;
+
+	if(purple_prefs_get_bool("/purple/gtk/blist/show_offline_buddies"))
+		count = purple_blist_get_group_size(group, FALSE);
 	else
-		count = gaim_blist_get_group_online_count(group);
-
-	if (count > 0 || gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"))
+		count = purple_blist_get_group_online_count(group);
+
+	if (count > 0 || purple_prefs_get_bool("/purple/gtk/blist/show_empty_groups"))
 		show = TRUE;
-	else if (GAIM_BLIST_NODE_IS_BUDDY(node)){ /* Or chat? */
-		if (buddy_is_displayable((GaimBuddy*)node))
+	else if (PURPLE_BLIST_NODE_IS_BUDDY(node)){ /* Or chat? */
+		if (buddy_is_displayable((PurpleBuddy*)node))
 			show = TRUE;}
 
 	if (show) {
@@ -4774,22 +4774,22 @@
 	}
 }
 
-static char *pidgin_get_group_title(GaimBlistNode *gnode, gboolean expanded)
-{
-	GaimGroup *group;
+static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded)
+{
+	PurpleGroup *group;
 	GdkColor textcolor;
 	gboolean selected;
 	char group_count[12] = "";
 	char *mark, *esc;
 
-	group = (GaimGroup*)gnode;
+	group = (PurpleGroup*)gnode;
 	textcolor = gtkblist->treeview->style->fg[GTK_STATE_ACTIVE];
 	selected = gtkblist ? (gtkblist->selected_node == gnode) : FALSE;
 
 	if (!expanded) {
 		g_snprintf(group_count, sizeof(group_count), " (%d/%d)",
-		           gaim_blist_get_group_online_count(group),
-		           gaim_blist_get_group_size(group, FALSE));
+		           purple_blist_get_group_online_count(group),
+		           purple_blist_get_group_size(group, FALSE));
 	}
 
 	esc = g_markup_escape_text(group->name, -1);
@@ -4804,36 +4804,36 @@
 	return mark;
 }
 
-static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
-{
-	GaimPresence *presence;
+static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *node)
+{
+	PurplePresence *presence;
 	GdkPixbuf *status, *avatar, *emblem;
 	char *mark;
 	char *idle = NULL;
 	gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded;
 	gboolean selected = (gtkblist->selected_node == node);
-	gboolean biglist = gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons");
-	presence = gaim_buddy_get_presence(buddy);
-
-	status = pidgin_blist_get_status_icon((GaimBlistNode*)buddy,
+	gboolean biglist = purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons");
+	presence = purple_buddy_get_presence(buddy);
+
+	status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy,
 						PIDGIN_STATUS_ICON_SMALL);
 
-	avatar = pidgin_blist_get_buddy_icon((GaimBlistNode *)buddy, TRUE, TRUE, TRUE);
+	avatar = pidgin_blist_get_buddy_icon((PurpleBlistNode *)buddy, TRUE, TRUE, TRUE);
 	if (!avatar) {
 		g_object_ref(G_OBJECT(gtkblist->empty_avatar));
 		avatar = gtkblist->empty_avatar;
-	} else if ((!GAIM_BUDDY_IS_ONLINE(buddy) || gaim_presence_is_idle(presence))) {
+	} else if ((!PURPLE_BUDDY_IS_ONLINE(buddy) || purple_presence_is_idle(presence))) {
 		do_alphashift(avatar, avatar, 77);
 	}
 
-	emblem = pidgin_blist_get_emblem((GaimBlistNode*) buddy);
+	emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy);
 	mark = pidgin_blist_get_name_markup(buddy, selected);
 
-	if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time") &&
-		gaim_presence_is_idle(presence) &&
-		!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
+	if (purple_prefs_get_bool("/purple/gtk/blist/show_idle_time") &&
+		purple_presence_is_idle(presence) &&
+		!purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons"))
 	{
-		time_t idle_secs = gaim_presence_get_idle_time(presence);
+		time_t idle_secs = purple_presence_get_idle_time(presence);
 
 		if (idle_secs > 0)
 		{
@@ -4846,7 +4846,7 @@
 		}
 	}
 
-	if (gaim_presence_is_idle(presence))
+	if (purple_presence_is_idle(presence))
 	{
 		if (idle && !selected) {
 			char *i2 = g_strdup_printf("<span color='%s'>%s</span>",
@@ -4881,28 +4881,28 @@
 
 /* This is a variation on the original gtk_blist_update_contact. Here we
 	can know in advance which buddy has changed so we can just update that */
-static void pidgin_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node)
-{
-	GaimBlistNode *cnode;
-	GaimContact *contact;
-	GaimBuddy *buddy;
+static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node)
+{
+	PurpleBlistNode *cnode;
+	PurpleContact *contact;
+	PurpleBuddy *buddy;
 	struct _pidgin_blist_node *gtknode;
 
-	if (GAIM_BLIST_NODE_IS_BUDDY(node))
+	if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 		cnode = node->parent;
 	else
 		cnode = node;
 
-	g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(cnode));
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(cnode));
 
 	/* First things first, update the group */
-	if (GAIM_BLIST_NODE_IS_BUDDY(node))
+	if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 		pidgin_blist_update_group(list, node);
 	else
 		pidgin_blist_update_group(list, cnode->parent);
 
-	contact = (GaimContact*)cnode;
-	buddy = gaim_contact_get_priority_buddy(contact);
+	contact = (PurpleContact*)cnode;
+	buddy = purple_contact_get_priority_buddy(contact);
 
 	if (buddy_is_displayable(buddy))
 	{
@@ -4920,7 +4920,7 @@
 			status = pidgin_blist_get_status_icon(cnode,
 					 PIDGIN_STATUS_ICON_SMALL);
 
-			mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1);
+			mark = g_markup_escape_text(purple_contact_get_alias(contact), -1);
 			gtk_tree_store_set(gtkblist->treemodel, &iter,
 					   STATUS_ICON_COLUMN, status,
 					   STATUS_ICON_VISIBLE_COLUMN, TRUE,
@@ -4945,17 +4945,17 @@
 
 
 
-static void pidgin_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node, gboolean statusChange)
-{
-	GaimBuddy *buddy;
+static void pidgin_blist_update_buddy(PurpleBuddyList *list, PurpleBlistNode *node, gboolean statusChange)
+{
+	PurpleBuddy *buddy;
 	struct _pidgin_blist_node *gtkparentnode;
 
-	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
 
 	if (node->parent == NULL)
 		return;
 
-	buddy = (GaimBuddy*)node;
+	buddy = (PurpleBuddy*)node;
 
 	/* First things first, update the contact */
 	pidgin_blist_update_contact(list, node);
@@ -4977,18 +4977,18 @@
 
 }
 
-static void pidgin_blist_update_chat(GaimBuddyList *list, GaimBlistNode *node)
-{
-	GaimChat *chat;
-
-	g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
+static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *node)
+{
+	PurpleChat *chat;
+
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node));
 
 	/* First things first, update the group */
 	pidgin_blist_update_group(list, node->parent);
 
-	chat = (GaimChat*)node;
-
-	if(gaim_account_is_connected(chat->account)) {
+	chat = (PurpleChat*)node;
+
+	if(purple_account_is_connected(chat->account)) {
 		GtkTreeIter iter;
 		GdkPixbuf *status;
 		GdkPixbuf *avatar;
@@ -5003,13 +5003,13 @@
 		emblem = pidgin_blist_get_emblem(node);
 		avatar = pidgin_blist_get_buddy_icon(node, TRUE, FALSE, TRUE);
 
-		mark = g_markup_escape_text(gaim_chat_get_name(chat), -1);
+		mark = g_markup_escape_text(purple_chat_get_name(chat), -1);
 
 		gtk_tree_store_set(gtkblist->treemodel, &iter,
 				STATUS_ICON_COLUMN, status,
 				STATUS_ICON_VISIBLE_COLUMN, TRUE,
 				BUDDY_ICON_COLUMN, avatar ? avatar : gtkblist->empty_avatar,
-				BUDDY_ICON_VISIBLE_COLUMN,  gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"),
+				BUDDY_ICON_VISIBLE_COLUMN,  purple_prefs_get_bool("/purple/gtk/blist/show_buddy_icons"),
 			        EMBLEM_COLUMN, emblem,
 				EMBLEM_VISIBLE_COLUMN, emblem != NULL,
 				NAME_COLUMN, mark,
@@ -5025,7 +5025,7 @@
 	}
 }
 
-static void pidgin_blist_update(GaimBuddyList *list, GaimBlistNode *node)
+static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node)
 {
 	if (list)
 		gtkblist = PIDGIN_BLIST(list);
@@ -5036,19 +5036,19 @@
 		pidgin_blist_new_node(node);
 
 	switch(node->type) {
-		case GAIM_BLIST_GROUP_NODE:
+		case PURPLE_BLIST_GROUP_NODE:
 			pidgin_blist_update_group(list, node);
 			break;
-		case GAIM_BLIST_CONTACT_NODE:
+		case PURPLE_BLIST_CONTACT_NODE:
 			pidgin_blist_update_contact(list, node);
 			break;
-		case GAIM_BLIST_BUDDY_NODE:
+		case PURPLE_BLIST_BUDDY_NODE:
 			pidgin_blist_update_buddy(list, node, TRUE);
 			break;
-		case GAIM_BLIST_CHAT_NODE:
+		case PURPLE_BLIST_CHAT_NODE:
 			pidgin_blist_update_chat(list, node);
 			break;
-		case GAIM_BLIST_OTHER_NODE:
+		case PURPLE_BLIST_OTHER_NODE:
 			return;
 	}
 
@@ -5058,12 +5058,12 @@
 }
 
 
-static void pidgin_blist_destroy(GaimBuddyList *list)
+static void pidgin_blist_destroy(PurpleBuddyList *list)
 {
 	if (!gtkblist)
 		return;
 
-	gaim_signals_disconnect_by_handle(gtkblist);
+	purple_signals_disconnect_by_handle(gtkblist);
 
 	if (gtkblist->headline_close)
 		gdk_pixbuf_unref(gtkblist->headline_close);
@@ -5096,22 +5096,22 @@
 	g_free(gtkblist);
 	accountmenu = NULL;
 	gtkblist = NULL;
-	gaim_prefs_disconnect_by_handle(pidgin_blist_get_handle());
-}
-
-static void pidgin_blist_set_visible(GaimBuddyList *list, gboolean show)
+	purple_prefs_disconnect_by_handle(pidgin_blist_get_handle());
+}
+
+static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show)
 {
 	if (!(gtkblist && gtkblist->window))
 		return;
 
 	if (show) {
 		if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && !GTK_WIDGET_VISIBLE(gtkblist->window))
-			gaim_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist);
+			purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist);
 		pidgin_blist_restore_position();
 		gtk_window_present(GTK_WINDOW(gtkblist->window));
 	} else {
 		if(visibility_manager_count) {
-			gaim_signal_emit(pidgin_blist_get_handle(), "gtkblist-hiding", gtkblist);
+			purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-hiding", gtkblist);
 			gtk_widget_hide(gtkblist->window);
 		} else {
 			if (!GTK_WIDGET_VISIBLE(gtkblist->window))
@@ -5126,23 +5126,23 @@
 {
 	GList *tmp = NULL;
 	char *tmp2;
-	GaimGroup *g;
-	GaimBlistNode *gnode;
-
-	if (gaim_get_blist()->root == NULL)
+	PurpleGroup *g;
+	PurpleBlistNode *gnode;
+
+	if (purple_get_blist()->root == NULL)
 	{
 		tmp2 = g_strdup(_("Buddies"));
 		tmp  = g_list_append(tmp, tmp2);
 	}
 	else
 	{
-		for (gnode = gaim_get_blist()->root;
+		for (gnode = purple_get_blist()->root;
 			 gnode != NULL;
 			 gnode = gnode->next)
 		{
-			if (GAIM_BLIST_NODE_IS_GROUP(gnode))
+			if (PURPLE_BLIST_NODE_IS_GROUP(gnode))
 			{
-				g    = (GaimGroup *)gnode;
+				g    = (PurpleGroup *)gnode;
 				tmp2 = g->name;
 				tmp  = g_list_append(tmp, tmp2);
 			}
@@ -5153,7 +5153,7 @@
 }
 
 static void
-add_buddy_select_account_cb(GObject *w, GaimAccount *account,
+add_buddy_select_account_cb(GObject *w, PurpleAccount *account,
 							PidginAddBuddyData *data)
 {
 	/* Save our account */
@@ -5170,10 +5170,10 @@
 add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data)
 {
 	const char *grp, *who, *whoalias;
-	GaimGroup *g;
-	GaimBuddy *b;
-	GaimConversation *c;
-	GaimBuddyIcon *icon;
+	PurpleGroup *g;
+	PurpleBuddy *b;
+	PurpleConversation *c;
+	PurpleBuddyIcon *icon;
 
 	if (resp == GTK_RESPONSE_OK)
 	{
@@ -5183,36 +5183,36 @@
 		if (*whoalias == '\0')
 			whoalias = NULL;
 
-		if ((g = gaim_find_group(grp)) == NULL)
+		if ((g = purple_find_group(grp)) == NULL)
 		{
-			g = gaim_group_new(grp);
-			gaim_blist_add_group(g, NULL);
+			g = purple_group_new(grp);
+			purple_blist_add_group(g, NULL);
 		}
 
-		b = gaim_buddy_new(data->account, who, whoalias);
-		gaim_blist_add_buddy(b, NULL, g, NULL);
-		gaim_account_add_buddy(data->account, b);
+		b = purple_buddy_new(data->account, who, whoalias);
+		purple_blist_add_buddy(b, NULL, g, NULL);
+		purple_account_add_buddy(data->account, b);
 
 		/*
 		 * XXX
 		 * It really seems like it would be better if the call to
-		 * gaim_account_add_buddy() and gaim_conversation_update() were done in
-		 * blist.c, possibly in the gaim_blist_add_buddy() function.  Maybe
-		 * gaim_account_add_buddy() should be renamed to
-		 * gaim_blist_add_new_buddy() or something, and have it call
-		 * gaim_blist_add_buddy() after it creates it.  --Mark
+		 * purple_account_add_buddy() and purple_conversation_update() were done in
+		 * blist.c, possibly in the purple_blist_add_buddy() function.  Maybe
+		 * purple_account_add_buddy() should be renamed to
+		 * purple_blist_add_new_buddy() or something, and have it call
+		 * purple_blist_add_buddy() after it creates it.  --Mark
 		 *
 		 * No that's not good.  blist.c should only deal with adding nodes to the
 		 * local list.  We need a new, non-gtk file that calls both
-		 * gaim_account_add_buddy and gaim_blist_add_buddy().
+		 * purple_account_add_buddy and purple_blist_add_buddy().
 		 * Or something.  --Mark
 		 */
 
-		c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, data->account);
+		c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, data->account);
 		if (c != NULL) {
-			icon = gaim_conv_im_get_icon(GAIM_CONV_IM(c));
+			icon = purple_conv_im_get_icon(PURPLE_CONV_IM(c));
 			if (icon != NULL)
-				gaim_buddy_icon_update(icon);
+				purple_buddy_icon_update(icon);
 		}
 	}
 
@@ -5220,7 +5220,7 @@
 }
 
 static void
-pidgin_blist_request_add_buddy(GaimAccount *account, const char *username,
+pidgin_blist_request_add_buddy(PurpleAccount *account, const char *username,
 								 const char *group, const char *alias)
 {
 	GtkWidget *table;
@@ -5234,12 +5234,12 @@
 	data->account =
 		(account != NULL
 		 ? account
-		 : gaim_connection_get_account(gaim_connections_get_all()->data));
+		 : purple_connection_get_account(purple_connections_get_all()->data));
 
 	img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
 					gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
 
-	gtkblist = PIDGIN_BLIST(gaim_get_blist());
+	gtkblist = PIDGIN_BLIST(purple_get_blist());
 
 	data->window = gtk_dialog_new_with_buttons(_("Add Buddy"),
 			NULL, GTK_DIALOG_NO_SEPARATOR,
@@ -5360,8 +5360,8 @@
 {
 	GHashTable *components;
 	GList *tmp;
-	GaimChat *chat;
-	GaimGroup *group;
+	PurpleChat *chat;
+	PurpleGroup *group;
 	const char *group_name;
 	const char *value;
 
@@ -5387,21 +5387,21 @@
 		}
 	}
 
-	chat = gaim_chat_new(data->account,
+	chat = purple_chat_new(data->account,
 							   gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
 							   components);
 
 	group_name = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->group_combo)->entry));
 
-	if ((group = gaim_find_group(group_name)) == NULL)
+	if ((group = purple_find_group(group_name)) == NULL)
 	{
-		group = gaim_group_new(group_name);
-		gaim_blist_add_group(group, NULL);
+		group = purple_group_new(group_name);
+		purple_blist_add_group(group, NULL);
 	}
 
 	if (chat != NULL)
 	{
-		gaim_blist_add_chat(chat, group, NULL);
+		purple_blist_add_chat(chat, group, NULL);
 	}
 
 	gtk_widget_destroy(data->window);
@@ -5458,7 +5458,7 @@
 static void
 rebuild_addchat_entries(PidginAddChatData *data)
 {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	GList *list = NULL, *tmp;
 	GHashTable *defaults = NULL;
 	struct proto_chat_entry *pce;
@@ -5466,7 +5466,7 @@
 
 	g_return_if_fail(data->account != NULL);
 
-	gc = gaim_account_get_connection(data->account);
+	gc = purple_account_get_connection(data->account);
 
 	while ((tmp = gtk_container_get_children(GTK_CONTAINER(data->entries_box))))
 		gtk_widget_destroy(tmp->data);
@@ -5475,11 +5475,11 @@
 
 	data->entries = NULL;
 
-	if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
-		list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
-
-	if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
-		defaults = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, data->default_chat_name);
+	if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
+		list = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
+
+	if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
+		defaults = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, data->default_chat_name);
 
 	for (tmp = list; tmp; tmp = tmp->next)
 	{
@@ -5551,11 +5551,11 @@
 }
 
 static void
-addchat_select_account_cb(GObject *w, GaimAccount *account,
+addchat_select_account_cb(GObject *w, PurpleAccount *account,
 						   PidginAddChatData *data)
 {
-	if (strcmp(gaim_account_get_protocol_id(data->account),
-		gaim_account_get_protocol_id(account)) == 0)
+	if (strcmp(purple_account_get_protocol_id(data->account),
+		purple_account_get_protocol_id(account)) == 0)
 	{
 		data->account = account;
 	}
@@ -5567,13 +5567,13 @@
 }
 
 static void
-pidgin_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
+pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group,
 								const char *alias, const char *name)
 {
 	PidginAddChatData *data;
 	PidginBuddyList *gtkblist;
 	GList *l;
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	GtkWidget *label;
 	GtkWidget *rowbox;
 	GtkWidget *hbox;
@@ -5581,25 +5581,25 @@
 	GtkWidget *img;
 
 	if (account != NULL) {
-		gc = gaim_account_get_connection(account);
-
-		if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
-			gaim_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL);
+		gc = purple_account_get_connection(account);
+
+		if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
+			purple_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL);
 			return;
 		}
 	} else {
 		/* Find an account with chat capabilities */
-		for (l = gaim_connections_get_all(); l != NULL; l = l->next) {
-			gc = (GaimConnection *)l->data;
-
-			if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
-				account = gaim_connection_get_account(gc);
+		for (l = purple_connections_get_all(); l != NULL; l = l->next) {
+			gc = (PurpleConnection *)l->data;
+
+			if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
+				account = purple_connection_get_account(gc);
 				break;
 			}
 		}
 
 		if (account == NULL) {
-			gaim_notify_error(NULL, NULL,
+			purple_notify_error(NULL, NULL,
 							  _("You are not currently signed on with any "
 								"protocols that have the ability to chat."), NULL);
 			return;
@@ -5613,7 +5613,7 @@
 	img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
 					gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
 
-	gtkblist = PIDGIN_BLIST(gaim_get_blist());
+	gtkblist = PIDGIN_BLIST(purple_get_blist());
 
 	data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
@@ -5709,21 +5709,21 @@
 }
 
 static void
-add_group_cb(GaimConnection *gc, const char *group_name)
-{
-	GaimGroup *group;
+add_group_cb(PurpleConnection *gc, const char *group_name)
+{
+	PurpleGroup *group;
 
 	if ((group_name == NULL) || (*group_name == '\0'))
 		return;
 
-	group = gaim_group_new(group_name);
-	gaim_blist_add_group(group, NULL);
+	group = purple_group_new(group_name);
+	purple_blist_add_group(group, NULL);
 }
 
 static void
 pidgin_blist_request_add_group(void)
 {
-	gaim_request_input(NULL, _("Add Group"), NULL,
+	purple_request_input(NULL, _("Add Group"), NULL,
 					   _("Please enter the name of the group to be added."),
 					   NULL, FALSE, FALSE, NULL,
 					   _("Add"), G_CALLBACK(add_group_cb),
@@ -5735,9 +5735,9 @@
 {
 	if (gtkblist && gtkblist->window) {
 		if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
-			gaim_blist_set_visible(PIDGIN_WINDOW_ICONIFIED(gtkblist->window) || gtk_blist_obscured);
+			purple_blist_set_visible(PIDGIN_WINDOW_ICONIFIED(gtkblist->window) || gtk_blist_obscured);
 		} else {
-			gaim_blist_set_visible(TRUE);
+			purple_blist_set_visible(TRUE);
 		}
 	}
 }
@@ -5746,7 +5746,7 @@
 pidgin_blist_visibility_manager_add()
 {
 	visibility_manager_count++;
-	gaim_debug_info("gtkblist", "added visibility manager: %d\n", visibility_manager_count);
+	purple_debug_info("gtkblist", "added visibility manager: %d\n", visibility_manager_count);
 }
 
 void
@@ -5755,8 +5755,8 @@
 	if (visibility_manager_count)
 		visibility_manager_count--;
 	if (!visibility_manager_count)
-		gaim_blist_set_visible(TRUE);
-	gaim_debug_info("gtkblist", "removed visibility manager: %d\n", visibility_manager_count);
+		purple_blist_set_visible(TRUE);
+	purple_debug_info("gtkblist", "removed visibility manager: %d\n", visibility_manager_count);
 }
 
 void pidgin_blist_add_alert(GtkWidget *widget)
@@ -5785,7 +5785,7 @@
 	gtk_widget_show_all(gtkblist->headline_hbox);
 }
 
-static GaimBlistUiOps blist_ui_ops =
+static PurpleBlistUiOps blist_ui_ops =
 {
 	pidgin_blist_new_list,
 	pidgin_blist_new_node,
@@ -5800,7 +5800,7 @@
 };
 
 
-GaimBlistUiOps *
+PurpleBlistUiOps *
 pidgin_blist_get_ui_ops(void)
 {
 	return &blist_ui_ops;
@@ -5811,28 +5811,28 @@
 	return gtkblist;
 }
 
-static void account_signon_cb(GaimConnection *gc, gpointer z)
-{
-	GaimAccount *account = gaim_connection_get_account(gc);
-	GaimBlistNode *gnode, *cnode;
-	for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
+static void account_signon_cb(PurpleConnection *gc, gpointer z)
+{
+	PurpleAccount *account = purple_connection_get_account(gc);
+	PurpleBlistNode *gnode, *cnode;
+	for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next)
 	{
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
+		if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
 			continue;
 		for(cnode = gnode->child; cnode; cnode = cnode->next)
 		{
-			GaimChat *chat;
-
-			if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
+			PurpleChat *chat;
+
+			if(!PURPLE_BLIST_NODE_IS_CHAT(cnode))
 				continue;
 
-			chat = (GaimChat *)cnode;
+			chat = (PurpleChat *)cnode;
 
 			if(chat->account != account)
 				continue;
 
-			if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin") ||
-					(gaim_blist_node_get_string((GaimBlistNode*)chat,
+			if(purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin") ||
+					(purple_blist_node_get_string((PurpleBlistNode*)chat,
 					 "gtk-autojoin") != NULL))
 				serv_join_chat(gc, chat->components);
 		}
@@ -5846,33 +5846,33 @@
 	return &handle;
 }
 
-static gboolean buddy_signonoff_timeout_cb(GaimBuddy *buddy)
-{
-	struct _pidgin_blist_node *gtknode = ((GaimBlistNode*)buddy)->ui_data;
+static gboolean buddy_signonoff_timeout_cb(PurpleBuddy *buddy)
+{
+	struct _pidgin_blist_node *gtknode = ((PurpleBlistNode*)buddy)->ui_data;
 
 	gtknode->recent_signonoff = FALSE;
 	gtknode->recent_signonoff_timer = 0;
 
-	pidgin_blist_update(NULL, (GaimBlistNode*)buddy);
+	pidgin_blist_update(NULL, (PurpleBlistNode*)buddy);
 
 	return FALSE;
 }
 
-static void buddy_signonoff_cb(GaimBuddy *buddy)
+static void buddy_signonoff_cb(PurpleBuddy *buddy)
 {
 	struct _pidgin_blist_node *gtknode;
 
-	if(!((GaimBlistNode*)buddy)->ui_data) {
-		pidgin_blist_new_node((GaimBlistNode*)buddy);
-	}
-
-	gtknode = ((GaimBlistNode*)buddy)->ui_data;
+	if(!((PurpleBlistNode*)buddy)->ui_data) {
+		pidgin_blist_new_node((PurpleBlistNode*)buddy);
+	}
+
+	gtknode = ((PurpleBlistNode*)buddy)->ui_data;
 
 	gtknode->recent_signonoff = TRUE;
 
 	if(gtknode->recent_signonoff_timer > 0)
-		gaim_timeout_remove(gtknode->recent_signonoff_timer);
-	gtknode->recent_signonoff_timer = gaim_timeout_add(10000,
+		purple_timeout_remove(gtknode->recent_signonoff_timer);
+	gtknode->recent_signonoff_timer = purple_timeout_add(10000,
 			(GSourceFunc)buddy_signonoff_timeout_cb, buddy);
 }
 
@@ -5880,58 +5880,58 @@
 {
 	void *gtk_blist_handle = pidgin_blist_get_handle();
 
-	gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
-						gtk_blist_handle, GAIM_CALLBACK(account_signon_cb),
+	purple_signal_connect(purple_connections_get_handle(), "signed-on",
+						gtk_blist_handle, PURPLE_CALLBACK(account_signon_cb),
 						NULL);
 
 	/* Initialize prefs */
-	gaim_prefs_add_none("/gaim/gtk/blist");
-	gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
-	gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
-	gaim_prefs_add_bool("/gaim/gtk/blist/show_idle_time", TRUE);
-	gaim_prefs_add_bool("/gaim/gtk/blist/show_offline_buddies", FALSE);
-	gaim_prefs_add_bool("/gaim/gtk/blist/list_visible", TRUE);
-	gaim_prefs_add_bool("/gaim/gtk/blist/list_maximized", FALSE);
-	gaim_prefs_add_string("/gaim/gtk/blist/sort_type", "alphabetical");
-	gaim_prefs_add_int("/gaim/gtk/blist/x", 0);
-	gaim_prefs_add_int("/gaim/gtk/blist/y", 0);
-	gaim_prefs_add_int("/gaim/gtk/blist/width", 250); /* Golden ratio, baby */
-	gaim_prefs_add_int("/gaim/gtk/blist/height", 405); /* Golden ratio, baby */
-	gaim_prefs_add_int("/gaim/gtk/blist/tooltip_delay", 500);
+	purple_prefs_add_none("/purple/gtk/blist");
+	purple_prefs_add_bool("/purple/gtk/blist/show_buddy_icons", TRUE);
+	purple_prefs_add_bool("/purple/gtk/blist/show_empty_groups", FALSE);
+	purple_prefs_add_bool("/purple/gtk/blist/show_idle_time", TRUE);
+	purple_prefs_add_bool("/purple/gtk/blist/show_offline_buddies", FALSE);
+	purple_prefs_add_bool("/purple/gtk/blist/list_visible", TRUE);
+	purple_prefs_add_bool("/purple/gtk/blist/list_maximized", FALSE);
+	purple_prefs_add_string("/purple/gtk/blist/sort_type", "alphabetical");
+	purple_prefs_add_int("/purple/gtk/blist/x", 0);
+	purple_prefs_add_int("/purple/gtk/blist/y", 0);
+	purple_prefs_add_int("/purple/gtk/blist/width", 250); /* Golden ratio, baby */
+	purple_prefs_add_int("/purple/gtk/blist/height", 405); /* Golden ratio, baby */
+	purple_prefs_add_int("/purple/gtk/blist/tooltip_delay", 500);
 
 	/* Register our signals */
-	gaim_signal_register(gtk_blist_handle, "gtkblist-hiding",
-	                     gaim_marshal_VOID__POINTER, NULL, 1,
-	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
-	                                    GAIM_SUBTYPE_BLIST));
-
-	gaim_signal_register(gtk_blist_handle, "gtkblist-unhiding",
-	                     gaim_marshal_VOID__POINTER, NULL, 1,
-	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
-	                                    GAIM_SUBTYPE_BLIST));
-
-	gaim_signal_register(gtk_blist_handle, "gtkblist-created",
-	                     gaim_marshal_VOID__POINTER, NULL, 1,
-	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
-	                                    GAIM_SUBTYPE_BLIST));
-
-	gaim_signal_register(gtk_blist_handle, "drawing-tooltip",
-	                     gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
-	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
-	                                    GAIM_SUBTYPE_BLIST_NODE),
-	                     gaim_value_new_outgoing(GAIM_TYPE_BOXED, "GString *"),
-	                     gaim_value_new(GAIM_TYPE_BOOLEAN));
-
-
-	gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL);
-	gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL);
-	gaim_signal_connect(gaim_blist_get_handle(), "buddy-privacy-changed", gtk_blist_handle, GAIM_CALLBACK(pidgin_blist_update_privacy_cb), NULL);
+	purple_signal_register(gtk_blist_handle, "gtkblist-hiding",
+	                     purple_marshal_VOID__POINTER, NULL, 1,
+	                     purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                    PURPLE_SUBTYPE_BLIST));
+
+	purple_signal_register(gtk_blist_handle, "gtkblist-unhiding",
+	                     purple_marshal_VOID__POINTER, NULL, 1,
+	                     purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                    PURPLE_SUBTYPE_BLIST));
+
+	purple_signal_register(gtk_blist_handle, "gtkblist-created",
+	                     purple_marshal_VOID__POINTER, NULL, 1,
+	                     purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                    PURPLE_SUBTYPE_BLIST));
+
+	purple_signal_register(gtk_blist_handle, "drawing-tooltip",
+	                     purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
+	                     purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                    PURPLE_SUBTYPE_BLIST_NODE),
+	                     purple_value_new_outgoing(PURPLE_TYPE_BOXED, "GString *"),
+	                     purple_value_new(PURPLE_TYPE_BOOLEAN));
+
+
+	purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL);
+	purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL);
+	purple_signal_connect(purple_blist_get_handle(), "buddy-privacy-changed", gtk_blist_handle, PURPLE_CALLBACK(pidgin_blist_update_privacy_cb), NULL);
 }
 
 void
 pidgin_blist_uninit(void) {
-	gaim_signals_unregister_by_instance(pidgin_blist_get_handle());
-	gaim_signals_disconnect_by_handle(pidgin_blist_get_handle());
+	purple_signals_unregister_by_instance(pidgin_blist_get_handle());
+	purple_signals_disconnect_by_handle(pidgin_blist_get_handle());
 }
 
 /*********************************************************************
@@ -5985,9 +5985,9 @@
 		return;
 	}
 	if (!strcmp(id, "none")) {
-		redo_buddy_list(gaim_get_blist(), TRUE, FALSE);
+		redo_buddy_list(purple_get_blist(), TRUE, FALSE);
 	} else {
-		redo_buddy_list(gaim_get_blist(), FALSE, FALSE);
+		redo_buddy_list(purple_get_blist(), FALSE, FALSE);
 	}
 }
 
@@ -5995,9 +5995,9 @@
  ** Sort Methods
  ******************************************/
 
-static void sort_method_none(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter parent_iter, GtkTreeIter *cur, GtkTreeIter *iter)
-{
-	GaimBlistNode *sibling = node->prev;
+static void sort_method_none(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter parent_iter, GtkTreeIter *cur, GtkTreeIter *iter)
+{
+	PurpleBlistNode *sibling = node->prev;
 	GtkTreeIter sibling_iter;
 
 	if (cur != NULL) {
@@ -6016,16 +6016,16 @@
 
 #if GTK_CHECK_VERSION(2,2,1)
 
-static void sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
+static void sort_method_alphabetical(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
 {
 	GtkTreeIter more_z;
 
 	const char *my_name;
 
-	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		my_name = gaim_contact_get_alias((GaimContact*)node);
-	} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
-		my_name = gaim_chat_get_name((GaimChat*)node);
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+		my_name = purple_contact_get_alias((PurpleContact*)node);
+	} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
+		my_name = purple_chat_get_name((PurpleChat*)node);
 	} else {
 		sort_method_none(node, blist, groupiter, cur, iter);
 		return;
@@ -6039,7 +6039,7 @@
 
 	do {
 		GValue val;
-		GaimBlistNode *n;
+		PurpleBlistNode *n;
 		const char *this_name;
 		int cmp;
 
@@ -6047,15 +6047,15 @@
 		gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val);
 		n = g_value_get_pointer(&val);
 
-		if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
-			this_name = gaim_contact_get_alias((GaimContact*)n);
-		} else if(GAIM_BLIST_NODE_IS_CHAT(n)) {
-			this_name = gaim_chat_get_name((GaimChat*)n);
+		if(PURPLE_BLIST_NODE_IS_CONTACT(n)) {
+			this_name = purple_contact_get_alias((PurpleContact*)n);
+		} else if(PURPLE_BLIST_NODE_IS_CHAT(n)) {
+			this_name = purple_chat_get_name((PurpleChat*)n);
 		} else {
 			this_name = NULL;
 		}
 
-		cmp = gaim_utf8_strcasecmp(my_name, this_name);
+		cmp = purple_utf8_strcasecmp(my_name, this_name);
 
 		if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
 			if(cur) {
@@ -6081,15 +6081,15 @@
 	}
 }
 
-static void sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
+static void sort_method_status(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
 {
 	GtkTreeIter more_z;
 
-	GaimBuddy *my_buddy, *this_buddy;
-
-	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
-	} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
+	PurpleBuddy *my_buddy, *this_buddy;
+
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+		my_buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
+	} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
 		if (cur != NULL) {
 			*iter = *cur;
 			return;
@@ -6110,7 +6110,7 @@
 
 	do {
 		GValue val;
-		GaimBlistNode *n;
+		PurpleBlistNode *n;
 		gint name_cmp;
 		gint presence_cmp;
 
@@ -6118,21 +6118,21 @@
 		gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val);
 		n = g_value_get_pointer(&val);
 
-		if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
-			this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
+		if(PURPLE_BLIST_NODE_IS_CONTACT(n)) {
+			this_buddy = purple_contact_get_priority_buddy((PurpleContact*)n);
 		} else {
 			this_buddy = NULL;
 		}
 
-		name_cmp = gaim_utf8_strcasecmp(
-			gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy)),
+		name_cmp = purple_utf8_strcasecmp(
+			purple_contact_get_alias(purple_buddy_get_contact(my_buddy)),
 			(this_buddy
-			 ? gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
+			 ? purple_contact_get_alias(purple_buddy_get_contact(this_buddy))
 			 : NULL));
 
-		presence_cmp = gaim_presence_compare(
-			gaim_buddy_get_presence(my_buddy),
-			this_buddy ? gaim_buddy_get_presence(this_buddy) : NULL);
+		presence_cmp = purple_presence_compare(
+			purple_buddy_get_presence(my_buddy),
+			this_buddy ? purple_buddy_get_presence(this_buddy) : NULL);
 
 		if (this_buddy == NULL ||
 			(presence_cmp < 0 ||
@@ -6168,7 +6168,7 @@
 	}
 }
 
-static void sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
+static void sort_method_log(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
 {
 	GtkTreeIter more_z;
 
@@ -6180,12 +6180,12 @@
 		return;
 	}
 
-	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
-		GaimBlistNode *n;
+	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+		PurpleBlistNode *n;
 		for (n = node->child; n; n = n->next)
-			log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy*)(n))->name, ((GaimBuddy*)(n))->account);
-		buddy_name = gaim_contact_get_alias((GaimContact*)node);
-	} else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
+			log_size += purple_log_get_total_size(PURPLE_LOG_IM, ((PurpleBuddy*)(n))->name, ((PurpleBuddy*)(n))->account);
+		buddy_name = purple_contact_get_alias((PurpleContact*)node);
+	} else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
 		/* we don't have a reliable way of getting the log filename
 		 * from the chat info in the blist, yet */
 		if (cur != NULL) {
@@ -6208,8 +6208,8 @@
 
 	do {
 		GValue val;
-		GaimBlistNode *n;
-		GaimBlistNode *n2;
+		PurpleBlistNode *n;
+		PurpleBlistNode *n2;
 		int cmp;
 
 		val.g_type = 0;
@@ -6217,17 +6217,17 @@
 		n = g_value_get_pointer(&val);
 		this_log_size = 0;
 
-		if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
+		if(PURPLE_BLIST_NODE_IS_CONTACT(n)) {
 			for (n2 = n->child; n2; n2 = n2->next)
-				this_log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy*)(n2))->name, ((GaimBuddy*)(n2))->account);
-			this_buddy_name = gaim_contact_get_alias((GaimContact*)n);
+				this_log_size += purple_log_get_total_size(PURPLE_LOG_IM, ((PurpleBuddy*)(n2))->name, ((PurpleBuddy*)(n2))->account);
+			this_buddy_name = purple_contact_get_alias((PurpleContact*)n);
 		} else {
 			this_buddy_name = NULL;
 		}
 
-		cmp = gaim_utf8_strcasecmp(buddy_name, this_buddy_name);
-
-		if (!GAIM_BLIST_NODE_IS_CONTACT(n) || log_size > this_log_size ||
+		cmp = purple_utf8_strcasecmp(buddy_name, this_buddy_name);
+
+		if (!PURPLE_BLIST_NODE_IS_CONTACT(n) || log_size > this_log_size ||
 				((log_size == this_log_size) &&
 				 (cmp < 0 || (cmp == 0 && node < n)))) {
 			if (cur != NULL) {
@@ -6256,26 +6256,26 @@
 #endif
 
 static void
-plugin_act(GtkObject *obj, GaimPluginAction *pam)
+plugin_act(GtkObject *obj, PurplePluginAction *pam)
 {
 	if (pam && pam->callback)
 		pam->callback(pam);
 }
 
 static void
-build_plugin_actions(GtkWidget *menu, GaimPlugin *plugin)
+build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin)
 {
 	GtkWidget *menuitem;
-	GaimPluginAction *action = NULL;
+	PurplePluginAction *action = NULL;
 	GList *actions, *l;
 
-	actions = GAIM_PLUGIN_ACTIONS(plugin, NULL);
+	actions = PURPLE_PLUGIN_ACTIONS(plugin, NULL);
 
 	for (l = actions; l != NULL; l = l->next)
 	{
 		if (l->data)
 		{
-			action = (GaimPluginAction *) l->data;
+			action = (PurplePluginAction *) l->data;
 			action->plugin = plugin;
 			action->context = NULL;
 
@@ -6286,7 +6286,7 @@
 					G_CALLBACK(plugin_act), action);
 			g_object_set_data_full(G_OBJECT(menuitem), "plugin_action",
 								   action,
-								   (GDestroyNotify)gaim_plugin_action_free);
+								   (GDestroyNotify)purple_plugin_action_free);
 			gtk_widget_show(menuitem);
 		}
 		else
@@ -6305,21 +6305,21 @@
 static void
 enable_account_cb(GtkCheckMenuItem *widget, gpointer data)
 {
-	GaimAccount *account = data;
-	const GaimSavedStatus *saved_status;
-
-	saved_status = gaim_savedstatus_get_current();
-	gaim_savedstatus_activate_for_account(saved_status, account);
-
-	gaim_account_set_enabled(account, PIDGIN_UI, TRUE);
+	PurpleAccount *account = data;
+	const PurpleSavedStatus *saved_status;
+
+	saved_status = purple_savedstatus_get_current();
+	purple_savedstatus_activate_for_account(saved_status, account);
+
+	purple_account_set_enabled(account, PIDGIN_UI, TRUE);
 }
 
 static void
 disable_account_cb(GtkCheckMenuItem *widget, gpointer data)
 {
-	GaimAccount *account = data;
-
-	gaim_account_set_enabled(account, PIDGIN_UI, FALSE);
+	PurpleAccount *account = data;
+
+	purple_account_set_enabled(account, PIDGIN_UI, FALSE);
 }
 
 void
@@ -6341,27 +6341,27 @@
 			gtk_widget_destroy(menuitem);
 	}
 
-	for (accounts = gaim_accounts_get_all(); accounts; accounts = accounts->next) {
+	for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) {
 		char *buf = NULL;
 		char *accel_path_buf = NULL;
 		GtkWidget *image = NULL;
-		GaimConnection *gc = NULL;
-		GaimAccount *account = NULL;
+		PurpleConnection *gc = NULL;
+		PurpleAccount *account = NULL;
 		GdkPixbuf *pixbuf = NULL;
 
 		account = accounts->data;
 		accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu));
 
-		if(gaim_account_get_enabled(account, PIDGIN_UI)) {
-			buf = g_strconcat(gaim_account_get_username(account), " (",
-					gaim_account_get_protocol_name(account), ")", NULL);
+		if(purple_account_get_enabled(account, PIDGIN_UI)) {
+			buf = g_strconcat(purple_account_get_username(account), " (",
+					purple_account_get_protocol_name(account), ")", NULL);
 			menuitem = gtk_image_menu_item_new_with_label(buf);
-			accel_path_buf = g_strconcat(N_("<GaimMain>/Accounts/"), buf, NULL);
+			accel_path_buf = g_strconcat(N_("<PurpleMain>/Accounts/"), buf, NULL);
 			g_free(buf);
 			pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
 			if (pixbuf != NULL)
 			{
-				if (!gaim_account_is_connected(account))
+				if (!purple_account_is_connected(account))
 					gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf,
 							0.0, FALSE);
 				image = gtk_image_new_from_pixbuf(pixbuf);
@@ -6388,18 +6388,18 @@
 
 			pidgin_separator(submenu);
 
-			gc = gaim_account_get_connection(account);
-			if (gc && GAIM_CONNECTION_IS_CONNECTED(gc)) {
-				GaimPlugin *plugin = NULL;
+			gc = purple_account_get_connection(account);
+			if (gc && PURPLE_CONNECTION_IS_CONNECTED(gc)) {
+				PurplePlugin *plugin = NULL;
 
 				plugin = gc->prpl;
-				if (GAIM_PLUGIN_HAS_ACTIONS(plugin)) {
+				if (PURPLE_PLUGIN_HAS_ACTIONS(plugin)) {
 					GList *l, *ll = NULL;
-					GaimPluginAction *action = NULL;
-
-					for (l = ll = GAIM_PLUGIN_ACTIONS(plugin, gc); l; l = l->next) {
+					PurplePluginAction *action = NULL;
+
+					for (l = ll = PURPLE_PLUGIN_ACTIONS(plugin, gc); l; l = l->next) {
 						if (l->data) {
-							action = (GaimPluginAction *)l->data;
+							action = (PurplePluginAction *)l->data;
 							action->plugin = plugin;
 							action->context = gc;
 
@@ -6407,7 +6407,7 @@
 							gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
 							g_signal_connect(G_OBJECT(menuitem), "activate",
 									G_CALLBACK(plugin_act), action);
-							g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", action, (GDestroyNotify)gaim_plugin_action_free);
+							g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", action, (GDestroyNotify)purple_plugin_action_free);
 							gtk_widget_show(menuitem);
 						} else
 							pidgin_separator(submenu);
@@ -6445,30 +6445,30 @@
 
 		submenu = gtk_menu_new();
 		gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group);
-		gtk_menu_set_accel_path(GTK_MENU(submenu), N_("<GaimMain>/Accounts/Enable Account"));
+		gtk_menu_set_accel_path(GTK_MENU(submenu), N_("<PurpleMain>/Accounts/Enable Account"));
 		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
 		gtk_widget_show(submenu);
 
-		for (accounts = gaim_accounts_get_all(); accounts; accounts = accounts->next) {
+		for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) {
 			char *buf = NULL;
 			GtkWidget *image = NULL;
-			GaimAccount *account = NULL;
+			PurpleAccount *account = NULL;
 			GdkPixbuf *pixbuf = NULL;
 
 			account = accounts->data;
 
-			if(!gaim_account_get_enabled(account, PIDGIN_UI)) {
+			if(!purple_account_get_enabled(account, PIDGIN_UI)) {
 
 				disabled_accounts = TRUE;
 
-				buf = g_strconcat(gaim_account_get_username(account), " (",
-						gaim_account_get_protocol_name(account), ")", NULL);
+				buf = g_strconcat(purple_account_get_username(account), " (",
+						purple_account_get_protocol_name(account), ")", NULL);
 				menuitem = gtk_image_menu_item_new_with_label(buf);
 				g_free(buf);
 				pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
 				if (pixbuf != NULL)
 				{
-					if (!gaim_account_is_connected(account))
+					if (!purple_account_is_connected(account))
 						gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
 					image = gtk_image_new_from_pixbuf(pixbuf);
 					g_object_unref(G_OBJECT(pixbuf));
@@ -6490,7 +6490,7 @@
 pidgin_blist_update_plugin_actions(void)
 {
 	GtkWidget *menuitem, *submenu;
-	GaimPlugin *plugin = NULL;
+	PurplePlugin *plugin = NULL;
 	GList *l;
 	GtkAccelGroup *accel_group;
 
@@ -6507,15 +6507,15 @@
 	accel_group = gtk_menu_get_accel_group(GTK_MENU(pluginmenu));
 
 	/* Add a submenu for each plugin with custom actions */
-	for (l = gaim_plugins_get_loaded(); l; l = l->next) {
+	for (l = purple_plugins_get_loaded(); l; l = l->next) {
 		char *path;
 
-		plugin = (GaimPlugin *) l->data;
-
-		if (GAIM_IS_PROTOCOL_PLUGIN(plugin))
+		plugin = (PurplePlugin *) l->data;
+
+		if (PURPLE_IS_PROTOCOL_PLUGIN(plugin))
 			continue;
 
-		if (!GAIM_PLUGIN_HAS_ACTIONS(plugin))
+		if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin))
 			continue;
 
 		menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name));
@@ -6545,7 +6545,7 @@
 		pidgin_set_cursor(gtkblist->window, GDK_WATCH);
 		/* This is redundant. I think. */
 		/* pidgin_blist_sort_method_set(id); */
-		gaim_prefs_set_string("/gaim/gtk/blist/sort_type", id);
+		purple_prefs_set_string("/purple/gtk/blist/sort_type", id);
 
 		pidgin_clear_cursor(gtkblist->window);
 	}
@@ -6559,7 +6559,7 @@
 	GList *l;
 	GSList *sl = NULL;
 	GtkWidget *sortmenu;
-	const char *m = gaim_prefs_get_string("/gaim/gtk/blist/sort_type");
+	const char *m = purple_prefs_get_string("/purple/gtk/blist/sort_type");
 
 	if ((gtkblist == NULL) || (gtkblist->ift == NULL))
 		return;