diff libpurple/protocols/oscar/oscar.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 52a044731fbe
children abb1e1e0c96f
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Mon Mar 19 06:11:46 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Mon Mar 19 07:01:17 2007 +0000
@@ -1,5 +1,5 @@
 /*
- * gaim
+ * purple
  *
  * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
  * Some code copyright (C) 1999-2001, Eric Warmenhoven
@@ -60,11 +60,11 @@
 #define OSCAR_STATUS_ID_CUSTOM      "custom"
 #define OSCAR_STATUS_ID_MOBILE	    "mobile"
 
-#define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
+#define AIMHASHDATA "http://purple.sourceforge.net/aim_data.php3"
 
 #define OSCAR_CONNECT_STEPS 6
 
-static OscarCapability gaim_caps = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT;
+static OscarCapability purple_caps = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT;
 
 static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02};
 static guint8 features_icq[] = {0x01, 0x06};
@@ -106,7 +106,7 @@
 };
 
 struct name_data {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	gchar *name;
 	gchar *nick;
 };
@@ -140,69 +140,69 @@
 };
 static int msgerrreasonlen = 25;
 
-/* All the libfaim->gaim callback functions */
-static int gaim_parse_auth_resp  (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_login      (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_handle_redirect  (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_info_change      (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_account_confirm  (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_oncoming   (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_offgoing   (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_incoming_im(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_misses     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_clientauto (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_userinfo   (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_got_infoblock    (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_motd       (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_chatnav_info     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_conv_chat_join        (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_conv_chat_leave       (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_conv_chat_info_update (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_conv_chat_incoming_msg(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_email_parseupdate(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_icon_error       (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_icon_parseicon   (OscarData *, FlapConnection *, FlapFrame *, ...);
+/* All the libfaim->purple callback functions */
+static int purple_parse_auth_resp  (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_login      (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_handle_redirect  (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_info_change      (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_account_confirm  (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_oncoming   (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_offgoing   (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_incoming_im(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_misses     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_clientauto (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_userinfo   (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_got_infoblock    (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_motd       (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_chatnav_info     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_conv_chat_join        (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_conv_chat_leave       (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_conv_chat_info_update (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_conv_chat_incoming_msg(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_email_parseupdate(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_icon_error       (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_icon_parseicon   (OscarData *, FlapConnection *, FlapFrame *, ...);
 static int oscar_icon_req        (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_msgack     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_ratechange (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_evilnotify (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_searcherror(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_searchreply(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_bosrights        (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_connerr          (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_msgerr     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_mtn        (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_locaterights(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_buddyrights(OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_locerr     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_icbm_param_info  (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_parse_genericerr (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_memrequest       (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_selfinfo         (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_offlinemsg       (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_offlinemsgdone   (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_icqalias         (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_icqinfo          (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_popup            (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_parseerr     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_parserights  (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_parselist    (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_parseack     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_parseadd     (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_authgiven    (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_authrequest  (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_authreply    (OscarData *, FlapConnection *, FlapFrame *, ...);
-static int gaim_ssi_gotadded     (OscarData *, FlapConnection *, FlapFrame *, ...);
-
-static gboolean gaim_icon_timerfunc(gpointer data);
-
-static void recent_buddies_cb(const char *name, GaimPrefType type, gconstpointer value, gpointer data);
-void oscar_set_info(GaimConnection *gc, const char *info);
-static void oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, GaimStatus *status);
-static void oscar_set_extendedstatus(GaimConnection *gc);
-static void oscar_format_screenname(GaimConnection *gc, const char *nick); 
-static gboolean gaim_ssi_rerequestdata(gpointer data);
+static int purple_parse_msgack     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_ratechange (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_evilnotify (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_searcherror(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_searchreply(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_bosrights        (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_connerr          (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_msgerr     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_mtn        (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_locaterights(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_buddyrights(OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_locerr     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_icbm_param_info  (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_parse_genericerr (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_memrequest       (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_selfinfo         (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_offlinemsg       (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_offlinemsgdone   (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_icqalias         (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_icqinfo          (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_popup            (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_parseerr     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_parserights  (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_parselist    (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_parseack     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_parseadd     (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_authgiven    (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_authrequest  (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_authreply    (OscarData *, FlapConnection *, FlapFrame *, ...);
+static int purple_ssi_gotadded     (OscarData *, FlapConnection *, FlapFrame *, ...);
+
+static gboolean purple_icon_timerfunc(gpointer data);
+
+static void recent_buddies_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data);
+void oscar_set_info(PurpleConnection *gc, const char *info);
+static void oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, PurpleStatus *status);
+static void oscar_set_extendedstatus(PurpleConnection *gc);
+static void oscar_format_screenname(PurpleConnection *gc, const char *nick); 
+static gboolean purple_ssi_rerequestdata(gpointer data);
 
 static void oscar_free_name_data(struct name_data *data) {
 	g_free(data->name);
@@ -302,7 +302,7 @@
 	gchar *utf8 = NULL;
 
 	if ((encoding == NULL) || encoding[0] == '\0') {
-		gaim_debug_info("oscar", "Empty encoding, assuming UTF-8\n");
+		purple_debug_info("oscar", "Empty encoding, assuming UTF-8\n");
 	} else if (!strcasecmp(encoding, "iso-8859-1")) {
 		utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL);
 	} else if (!strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") ||
@@ -312,7 +312,7 @@
 	} else if (!strcasecmp(encoding, "unicode-2-0")) {
 		utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL);
 	} else if (strcasecmp(encoding, "utf-8")) {
-		gaim_debug_warning("oscar", "Unrecognized character encoding \"%s\", "
+		purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", "
 						   "attempting to convert to UTF-8 anyway\n", encoding);
 		utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL);
 	}
@@ -335,25 +335,25 @@
 }
 
 static gchar *
-oscar_utf8_try_convert(GaimAccount *account, const gchar *msg)
+oscar_utf8_try_convert(PurpleAccount *account, const gchar *msg)
 {
 	const char *charset = NULL;
 	char *ret = NULL;
 
-	if(aim_sn_is_icq(gaim_account_get_username(account)))
-		charset = gaim_account_get_string(account, "encoding", NULL);
+	if(aim_sn_is_icq(purple_account_get_username(account)))
+		charset = purple_account_get_string(account, "encoding", NULL);
 
 	if(charset && *charset)
 		ret = g_convert(msg, -1, "UTF-8", charset, NULL, NULL, NULL);
 
 	if(!ret)
-		ret = gaim_utf8_try_convert(msg);
+		ret = purple_utf8_try_convert(msg);
 
 	return ret;
 }
 
 static gchar *
-gaim_plugin_oscar_convert_to_utf8(const gchar *data, gsize datalen, const char *charsetstr, gboolean fallback)
+purple_plugin_oscar_convert_to_utf8(const gchar *data, gsize datalen, const char *charsetstr, gboolean fallback)
 {
 	gchar *ret = NULL;
 	GError *err = NULL;
@@ -367,7 +367,7 @@
 		else
 			ret = g_convert(data, datalen, "UTF-8", charsetstr, NULL, NULL, &err);
 		if (err != NULL) {
-			gaim_debug_warning("oscar", "Conversion from %s failed: %s.\n",
+			purple_debug_warning("oscar", "Conversion from %s failed: %s.\n",
 							   charsetstr, err->message);
 			g_error_free(err);
 		}
@@ -375,7 +375,7 @@
 		if (g_utf8_validate(data, datalen, NULL))
 			ret = g_strndup(data, datalen);
 		else
-			gaim_debug_warning("oscar", "String is not valid UTF-8.\n");
+			purple_debug_warning("oscar", "String is not valid UTF-8.\n");
 	}
 
 	return ret;
@@ -387,17 +387,17 @@
  * We try decoding using two different character sets.  The charset
  * specified in the IM determines the order in which we attempt to
  * decode.  We do this because there are lots of broken ICQ clients
- * that don't correctly send non-ASCII messages.  And if Gaim isn't
+ * that don't correctly send non-ASCII messages.  And if Purple isn't
  * able to deal with that crap, then people complain like banshees.
  * charsetstr1 is always set to what the correct encoding should be.
  */
 gchar *
-gaim_plugin_oscar_decode_im_part(GaimAccount *account, const char *sourcesn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen)
+purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcesn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen)
 {
 	gchar *ret = NULL;
 	const gchar *charsetstr1, *charsetstr2;
 
-	gaim_debug_info("oscar", "Parsing IM part, charset=0x%04hx, charsubset=0x%04hx, datalen=%hd\n", charset, charsubset, datalen);
+	purple_debug_info("oscar", "Parsing IM part, charset=0x%04hx, charsubset=0x%04hx, datalen=%hd\n", charset, charsubset, datalen);
 
 	if ((datalen == 0) || (data == NULL))
 		return NULL;
@@ -407,34 +407,34 @@
 		charsetstr2 = "UTF-8";
 	} else if (charset == AIM_CHARSET_CUSTOM) {
 		if ((sourcesn != NULL) && isdigit(sourcesn[0]))
-			charsetstr1 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
+			charsetstr1 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
 		else
 			charsetstr1 = "ISO-8859-1";
 		charsetstr2 = "UTF-8";
 	} else if (charset == AIM_CHARSET_ASCII) {
 		/* Should just be "ASCII" */
 		charsetstr1 = "ASCII";
-		charsetstr2 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
+		charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
 	} else if (charset == 0x000d) {
 		/* Mobile AIM client on a Nokia 3100 and an LG VX6000 */
 		charsetstr1 = "ISO-8859-1";
-		charsetstr2 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
+		charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
 	} else {
 		/* Unknown, hope for valid UTF-8... */
 		charsetstr1 = "UTF-8";
-		charsetstr2 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
-	}
-
-	ret = gaim_plugin_oscar_convert_to_utf8(data, datalen, charsetstr1, FALSE);
+		charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
+	}
+
+	ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr1, FALSE);
 	if (ret == NULL)
-		ret = gaim_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, TRUE);
+		ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, TRUE);
 	if (ret == NULL) {
 		char *str, *salvage, *tmp;
 
 		str = g_malloc(datalen + 1);
 		strncpy(str, data, datalen);
 		str[datalen] = '\0';
-		salvage = gaim_utf8_salvage(str);
+		salvage = purple_utf8_salvage(str);
 		tmp = g_strdup_printf(_("(There was an error receiving this message.  Either you and %s have different encodings selected, or %s has a buggy client.)"),
 					  sourcesn, sourcesn);
 		ret = g_strdup_printf("%s %s", salvage, tmp);
@@ -450,13 +450,13 @@
  * Figure out what encoding to use when sending a given outgoing message.
  */
 static void
-gaim_plugin_oscar_convert_to_best_encoding(GaimConnection *gc,
+purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc,
 				const char *destsn, const gchar *from,
 				gchar **msg, int *msglen_int,
 				guint16 *charset, guint16 *charsubset)
 {
 	OscarData *od = gc->proto_data;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	PurpleAccount *account = purple_connection_get_account(gc);
 	GError *err = NULL;
 	aim_userinfo_t *userinfo = NULL;
 	const gchar *charsetstr;
@@ -482,9 +482,9 @@
 
 	if ((userinfo != NULL) && (userinfo->capabilities & OSCAR_CAPABILITY_UNICODE))
 	{
-		GaimBuddy *b;
-		b = gaim_find_buddy(account, destsn);
-		if ((b != NULL) && (GAIM_BUDDY_IS_ONLINE(b)))
+		PurpleBuddy *b;
+		b = purple_find_buddy(account, destsn);
+		if ((b != NULL) && (PURPLE_BUDDY_IS_ONLINE(b)))
 		{
 			*msg = g_convert(from, strlen(from), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
 			if (*msg != NULL)
@@ -503,7 +503,7 @@
 	 */
 	charsetstr = "ISO-8859-1";
 	if ((destsn != NULL) && aim_sn_is_icq(destsn))
-		charsetstr = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
+		charsetstr = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
 
 	/*
 	 * XXX - We need a way to only attempt to convert if we KNOW "from"
@@ -528,10 +528,10 @@
 		return;
 	}
 
-	gaim_debug_error("oscar", "Error converting a Unicode message: %s\n", err->message);
+	purple_debug_error("oscar", "Error converting a Unicode message: %s\n", err->message);
 	g_error_free(err);
 
-	gaim_debug_error("oscar", "This should NEVER happen!  Sending UTF-8 text flagged as ASCII.\n");
+	purple_debug_error("oscar", "This should NEVER happen!  Sending UTF-8 text flagged as ASCII.\n");
 	*msg = g_strdup(from);
 	*msglen_int = strlen(*msg);
 	*charset = AIM_CHARSET_ASCII;
@@ -550,7 +550,7 @@
  *         expanded.  This should be g_free'd by the caller.
  */
 static gchar *
-gaim_str_sub_away_formatters(const char *str, const char *name)
+purple_str_sub_away_formatters(const char *str, const char *name)
 {
 	char *c;
 	GString *cpy;
@@ -579,12 +579,12 @@
 					break;
 				case 'd':
 					/* append date */
-					g_string_append(cpy, gaim_date_format_short(tme));
+					g_string_append(cpy, purple_date_format_short(tme));
 					c++;
 					break;
 				case 't':
 					/* append time */
-					g_string_append(cpy, gaim_time_format(tme));
+					g_string_append(cpy, purple_time_format(tme));
 					c++;
 					break;
 				default:
@@ -721,27 +721,27 @@
 }
 
 static void
-oscar_user_info_add_pair(GaimNotifyUserInfo *user_info, const char *name, const char *value)
+oscar_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *name, const char *value)
 {
 	if (value && value[0]) {
-		gaim_notify_user_info_add_pair(user_info, name, value);
+		purple_notify_user_info_add_pair(user_info, name, value);
 	}
 }
 
 static void
-oscar_user_info_convert_and_add_pair(GaimAccount *account, GaimNotifyUserInfo *user_info,
+oscar_user_info_convert_and_add_pair(PurpleAccount *account, PurpleNotifyUserInfo *user_info,
 									 const char *name, const char *value)
 {
 	gchar *utf8;
 	
 	if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) {
-		gaim_notify_user_info_add_pair(user_info, name, utf8);
+		purple_notify_user_info_add_pair(user_info, name, utf8);
 		g_free(utf8);
 	}
 }
 
 static void
-oscar_string_convert_and_append(GaimAccount *account, GString *str, const char *newline,
+oscar_string_convert_and_append(PurpleAccount *account, GString *str, const char *newline,
 					const char *name, const char *value)
 {
 	gchar *utf8;
@@ -753,29 +753,29 @@
 }
 
 static void
-oscar_user_info_convert_and_add(GaimAccount *account, GaimNotifyUserInfo *user_info,
+oscar_user_info_convert_and_add(PurpleAccount *account, PurpleNotifyUserInfo *user_info,
 								const char *name, const char *value)
 {
 	gchar *utf8;
 	
 	if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) {
-		gaim_notify_user_info_add_pair(user_info, name, value);
+		purple_notify_user_info_add_pair(user_info, name, value);
 		g_free(utf8);
 	}
 }
 
-static void oscar_string_append_info(GaimConnection *gc, GaimNotifyUserInfo *user_info, GaimBuddy *b, aim_userinfo_t *userinfo)
+static void oscar_string_append_info(PurpleConnection *gc, PurpleNotifyUserInfo *user_info, PurpleBuddy *b, aim_userinfo_t *userinfo)
 {
 	OscarData *od;
-	GaimAccount *account;
-	GaimPresence *presence = NULL;
-	GaimStatus *status = NULL;
-	GaimGroup *g = NULL;
+	PurpleAccount *account;
+	PurplePresence *presence = NULL;
+	PurpleStatus *status = NULL;
+	PurpleGroup *g = NULL;
 	struct buddyinfo *bi = NULL;
 	char *tmp;
 
 	od = gc->proto_data;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 
 	if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL)))
 		return;
@@ -784,22 +784,22 @@
 		userinfo = aim_locate_finduserinfo(od, b->name);
 
 	if (b == NULL)
-		b = gaim_find_buddy(account, userinfo->sn);
+		b = purple_find_buddy(account, userinfo->sn);
 
 	if (b != NULL) {
-		g = gaim_buddy_get_group(b);
-		presence = gaim_buddy_get_presence(b);
-		status = gaim_presence_get_active_status(presence);
+		g = purple_buddy_get_group(b);
+		presence = purple_buddy_get_presence(b);
+		status = purple_presence_get_active_status(presence);
 	}
 
 	if (userinfo != NULL)
-		bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn));
+		bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->sn));
 
 	if (b != NULL) {
-		if (gaim_presence_is_online(presence)) {
+		if (purple_presence_is_online(presence)) {
 			if (aim_sn_is_icq(b->name)) {
-				GaimStatus *status = gaim_presence_get_active_status(presence);
-				oscar_user_info_add_pair(user_info, _("Status"),	gaim_status_get_name(status));
+				PurpleStatus *status = purple_presence_get_active_status(presence);
+				oscar_user_info_add_pair(user_info, _("Status"),	purple_status_get_name(status));
 			}
 		} else {
 			tmp = aim_ssi_itemlist_findparentname(od->ssi.local, b->name);
@@ -873,7 +873,7 @@
 }
 
 static struct chat_connection *
-find_oscar_chat(GaimConnection *gc, int id)
+find_oscar_chat(PurpleConnection *gc, int id)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 	GSList *cur;
@@ -890,7 +890,7 @@
 }
 
 static struct chat_connection *
-find_oscar_chat_by_conn(GaimConnection *gc, FlapConnection *conn)
+find_oscar_chat_by_conn(PurpleConnection *gc, FlapConnection *conn)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 	GSList *cur;
@@ -907,7 +907,7 @@
 }
 
 static struct chat_connection *
-find_oscar_chat_by_conv(GaimConnection *gc, GaimConversation *conv)
+find_oscar_chat_by_conv(PurpleConnection *gc, PurpleConversation *conv)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 	GSList *cur;
@@ -932,12 +932,12 @@
 }
 
 static void
-oscar_chat_kill(GaimConnection *gc, struct chat_connection *cc)
+oscar_chat_kill(PurpleConnection *gc, struct chat_connection *cc)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	/* Notify the conversation window that we've left the chat */
-	serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(cc->conv)));
+	serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(cc->conv)));
 
 	/* Destroy the chat_connection */
 	od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
@@ -946,36 +946,36 @@
 }
 
 /**
- * This is the callback function anytime gaim_proxy_connect()
+ * This is the callback function anytime purple_proxy_connect()
  * establishes a new TCP connection with an oscar host.  Depending
  * on the type of host, we do a few different things here.
  */
 static void
 connection_established_cb(gpointer data, gint source, const gchar *error_message)
 {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	OscarData *od;
-	GaimAccount *account;
+	PurpleAccount *account;
 	FlapConnection *conn;
 
 	conn = data;
 	od = conn->od;
 	gc = od->gc;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 
 	conn->connect_data = NULL;
 	conn->fd = source;
 
 	if (source < 0)
 	{
-		gaim_debug_error("oscar", "unable to connect FLAP server "
+		purple_debug_error("oscar", "unable to connect FLAP server "
 				"of type 0x%04hx\n", conn->type);
 		if (conn->type == SNAC_FAMILY_AUTH)
 		{
 			gchar *msg;
 			msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"),
 					error_message);
-			gaim_connection_error(gc, msg);
+			purple_connection_error(gc, msg);
 			g_free(msg);
 		}
 		else if (conn->type == SNAC_FAMILY_LOCATE)
@@ -983,7 +983,7 @@
 			gchar *msg;
 			msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"),
 					error_message);
-			gaim_connection_error(gc, msg);
+			purple_connection_error(gc, msg);
 			g_free(msg);
 		}
 		else
@@ -995,13 +995,13 @@
 		return;
 	}
 
-	gaim_debug_info("oscar", "connected to FLAP server of type 0x%04hx\n",
+	purple_debug_info("oscar", "connected to FLAP server of type 0x%04hx\n",
 			conn->type);
-	conn->watcher_incoming = gaim_input_add(conn->fd,
-			GAIM_INPUT_READ, flap_connection_recv_cb, conn);
+	conn->watcher_incoming = purple_input_add(conn->fd,
+			PURPLE_INPUT_READ, flap_connection_recv_cb, conn);
 	if (conn->cookie == NULL)
 	{
-		if (!aim_sn_is_icq(gaim_account_get_username(account)))
+		if (!aim_sn_is_icq(purple_account_get_username(account)))
 			/*
 			 * We don't send this when authenticating an ICQ account
 			 * because for some reason ICQ is still using the
@@ -1019,14 +1019,14 @@
 
 	if (conn->type == SNAC_FAMILY_AUTH)
 	{
-		aim_request_login(od, conn, gaim_account_get_username(account));
-		gaim_debug_info("oscar", "Screen name sent, waiting for response\n");
-		gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS);
+		aim_request_login(od, conn, purple_account_get_username(account));
+		purple_debug_info("oscar", "Screen name sent, waiting for response\n");
+		purple_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS);
 		ck[1] = 0x65;
 	}
 	else if (conn->type == SNAC_FAMILY_LOCATE)
 	{
-		gaim_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS);
+		purple_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS);
 		ck[4] = 0x61;
 	}
 	else if (conn->type == SNAC_FAMILY_CHAT)
@@ -1039,33 +1039,33 @@
 static void
 flap_connection_established_bos(OscarData *od, FlapConnection *conn)
 {
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 
 	aim_srv_reqpersonalinfo(od, conn);
 
-	gaim_debug_info("oscar", "ssi: requesting rights and list\n");
+	purple_debug_info("oscar", "ssi: requesting rights and list\n");
 	aim_ssi_reqrights(od);
 	aim_ssi_reqdata(od);
 	if (od->getblisttimer > 0)
-		gaim_timeout_remove(od->getblisttimer);
-	od->getblisttimer = gaim_timeout_add(30000, gaim_ssi_rerequestdata, od);
+		purple_timeout_remove(od->getblisttimer);
+	od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od);
 
 	aim_locate_reqrights(od);
 	aim_buddylist_reqrights(od, conn);
 	aim_im_reqparams(od);
 	aim_bos_reqrights(od, conn); /* TODO: Don't call this with ssi */
 
-	gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS);
+	purple_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS);
 }
 
 static void
 flap_connection_established_admin(OscarData *od, FlapConnection *conn)
 {
 	aim_clientready(od, conn);
-	gaim_debug_info("oscar", "connected to admin\n");
+	purple_debug_info("oscar", "connected to admin\n");
 
 	if (od->chpass) {
-		gaim_debug_info("oscar", "changing password\n");
+		purple_debug_info("oscar", "changing password\n");
 		aim_admin_changepasswd(od, conn, od->newp, od->oldp);
 		g_free(od->oldp);
 		od->oldp = NULL;
@@ -1074,24 +1074,24 @@
 		od->chpass = FALSE;
 	}
 	if (od->setnick) {
-		gaim_debug_info("oscar", "formatting screen name\n");
+		purple_debug_info("oscar", "formatting screen name\n");
 		aim_admin_setnick(od, conn, od->newsn);
 		g_free(od->newsn);
 		od->newsn = NULL;
 		od->setnick = FALSE;
 	}
 	if (od->conf) {
-		gaim_debug_info("oscar", "confirming account\n");
+		purple_debug_info("oscar", "confirming account\n");
 		aim_admin_reqconfirm(od, conn);
 		od->conf = FALSE;
 	}
 	if (od->reqemail) {
-		gaim_debug_info("oscar", "requesting e-mail address\n");
+		purple_debug_info("oscar", "requesting e-mail address\n");
 		aim_admin_getinfo(od, conn, 0x0011);
 		od->reqemail = FALSE;
 	}
 	if (od->setemail) {
-		gaim_debug_info("oscar", "setting e-mail address\n");
+		purple_debug_info("oscar", "setting e-mail address\n");
 		aim_admin_setemail(od, conn, od->email);
 		g_free(od->email);
 		od->email = NULL;
@@ -1102,7 +1102,7 @@
 static void
 flap_connection_established_chat(OscarData *od, FlapConnection *conn)
 {
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 	struct chat_connection *chatcon;
 	static int id = 1;
 
@@ -1131,20 +1131,20 @@
 static void
 flap_connection_established_bart(OscarData *od, FlapConnection *conn)
 {
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 
 	aim_clientready(od, conn);
 
 	od->iconconnecting = FALSE;
 
 	if (od->icontimer == 0)
-		od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc);
+		od->icontimer = purple_timeout_add(100, purple_icon_timerfunc, gc);
 }
 
 static int
 flap_connection_established(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	gaim_debug_info("oscar", "FLAP connection of type 0x%04hx is "
+	purple_debug_info("oscar", "FLAP connection of type 0x%04hx is "
 			"now fully connected\n", conn->type);
 	if (conn->type == SNAC_FAMILY_LOCATE)
 		flap_connection_established_bos(od, conn);
@@ -1163,115 +1163,115 @@
 }
 
 void
-oscar_login(GaimAccount *account)
+oscar_login(PurpleAccount *account)
 {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	OscarData *od;
 	FlapConnection *newconn;
 
-	gc = gaim_account_get_connection(account);
+	gc = purple_account_get_connection(account);
 	od = gc->proto_data = oscar_data_new();
 	od->gc = gc;
 
-	oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
+	oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, purple_connerr, 0);
 	oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, flap_connection_established, 0);
 
-	oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0003, gaim_info_change, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0005, gaim_info_change, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0007, gaim_account_confirm, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, gaim_parse_genericerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, gaim_email_parseupdate, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, gaim_parse_auth_resp, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, gaim_parse_login, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, gaim_parse_auth_securid_request, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_ERROR, gaim_icon_error, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, gaim_icon_parseicon, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, gaim_parse_genericerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, gaim_bosrights, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, 0x0001, gaim_parse_genericerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_RIGHTSINFO, gaim_parse_buddyrights, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_ONCOMING, gaim_parse_oncoming, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_OFFGOING, gaim_parse_offgoing, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, 0x0001, gaim_parse_genericerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERJOIN, gaim_conv_chat_join, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERLEAVE, gaim_conv_chat_leave, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE, gaim_conv_chat_info_update, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, 0x0001, gaim_parse_genericerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, gaim_chatnav_info, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, gaim_ssi_parseerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, gaim_ssi_parserights, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, gaim_ssi_parselist, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, gaim_ssi_parseack, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, gaim_ssi_parseadd, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, gaim_ssi_authgiven, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, gaim_ssi_authrequest, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, gaim_ssi_authreply, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, gaim_ssi_gotadded, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, 0x0005, gaim_icbm_param_info, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_INCOMING, gaim_parse_incoming_im, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MISSEDCALL, gaim_parse_misses, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_CLIENTAUTORESP, gaim_parse_clientauto, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ERROR, gaim_parse_msgerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MTN, gaim_parse_mtn, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ACK, gaim_parse_msgack, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG, gaim_offlinemsg, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS, gaim_icqalias, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO, gaim_icqinfo, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_RIGHTSINFO, gaim_parse_locaterights, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_USERINFO, gaim_parse_userinfo, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_ERROR, gaim_parse_locerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_GOTINFOBLOCK, gaim_got_infoblock, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0001, gaim_parse_genericerr, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x000f, gaim_selfinfo, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x001f, gaim_memrequest, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0003, purple_info_change, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0005, purple_info_change, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0007, purple_account_confirm, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, purple_parse_genericerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, purple_email_parseupdate, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, purple_parse_auth_resp, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, purple_parse_login, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, purple_parse_auth_securid_request, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_ERROR, purple_icon_error, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, purple_icon_parseicon, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, purple_parse_genericerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, purple_bosrights, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, 0x0001, purple_parse_genericerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_RIGHTSINFO, purple_parse_buddyrights, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_ONCOMING, purple_parse_oncoming, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_OFFGOING, purple_parse_offgoing, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, 0x0001, purple_parse_genericerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERJOIN, purple_conv_chat_join, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERLEAVE, purple_conv_chat_leave, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE, purple_conv_chat_info_update, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_INCOMINGMSG, purple_conv_chat_incoming_msg, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, 0x0001, purple_parse_genericerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, purple_chatnav_info, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, purple_ssi_parseerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, purple_ssi_parserights, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, purple_ssi_parselist, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, purple_ssi_parseack, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, purple_ssi_parseadd, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, purple_ssi_authgiven, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, purple_ssi_authrequest, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, purple_ssi_authreply, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, purple_ssi_gotadded, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, 0x0005, purple_icbm_param_info, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_INCOMING, purple_parse_incoming_im, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MISSEDCALL, purple_parse_misses, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_CLIENTAUTORESP, purple_parse_clientauto, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ERROR, purple_parse_msgerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MTN, purple_parse_mtn, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ACK, purple_parse_msgack, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG, purple_offlinemsg, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE, purple_offlinemsgdone, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS, purple_icqalias, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO, purple_icqinfo, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_RIGHTSINFO, purple_parse_locaterights, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_USERINFO, purple_parse_userinfo, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_ERROR, purple_parse_locerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_GOTINFOBLOCK, purple_got_infoblock, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0001, purple_parse_genericerr, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x000f, purple_selfinfo, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x001f, purple_memrequest, 0);
 	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0021, oscar_icon_req,0);
-	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_RATECHANGE, gaim_parse_ratechange, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_REDIRECT, gaim_handle_redirect, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_MOTD, gaim_parse_motd, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_EVIL, gaim_parse_evilnotify, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, gaim_popup, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, gaim_parse_searcherror, 0);
-	oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, gaim_parse_searchreply, 0);
-
-	gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc);
-
-	if (!aim_snvalid(gaim_account_get_username(account))) {
+	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_RATECHANGE, purple_parse_ratechange, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_REDIRECT, purple_handle_redirect, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_MOTD, purple_parse_motd, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_EVIL, purple_parse_evilnotify, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, purple_popup, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, purple_parse_searcherror, 0);
+	oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0);
+
+	purple_debug_misc("oscar", "oscar_login: gc = %p\n", gc);
+
+	if (!aim_snvalid(purple_account_get_username(account))) {
 		gchar *buf;
-		buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid.  Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account));
+		buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid.  Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account));
 		gc->wants_to_die = TRUE;
-		gaim_connection_error(gc, buf);
+		purple_connection_error(gc, buf);
 		g_free(buf);
 	}
 
-	if (aim_sn_is_icq((gaim_account_get_username(account)))) {
+	if (aim_sn_is_icq((purple_account_get_username(account)))) {
 		od->icq = TRUE;
 	} else {
-		gc->flags |= GAIM_CONNECTION_HTML;
-		gc->flags |= GAIM_CONNECTION_AUTO_RESP;
-	}
-
-	/* Connect to core Gaim signals */
-	gaim_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc);
+		gc->flags |= PURPLE_CONNECTION_HTML;
+		gc->flags |= PURPLE_CONNECTION_AUTO_RESP;
+	}
+
+	/* Connect to core Purple signals */
+	purple_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc);
 
 	newconn = flap_connection_new(od, SNAC_FAMILY_AUTH);
-	newconn->connect_data = gaim_proxy_connect(NULL, account,
-			gaim_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER),
-			gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT),
+	newconn->connect_data = purple_proxy_connect(NULL, account,
+			purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER),
+			purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT),
 			connection_established_cb, newconn);
 	if (newconn->connect_data == NULL)
 	{
-		gaim_connection_error(gc, _("Couldn't connect to host"));
+		purple_connection_error(gc, _("Couldn't connect to host"));
 		return;
 	}
 
-	gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS);
+	purple_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS);
 	ck[0] = 0x5a;
 }
 
 void
-oscar_close(GaimConnection *gc)
+oscar_close(PurpleConnection *gc)
 {
 	OscarData *od;
 
@@ -1293,29 +1293,29 @@
 	oscar_data_destroy(od);
 	gc->proto_data = NULL;
 
-	gaim_prefs_disconnect_by_handle(gc);
-
-	gaim_debug_info("oscar", "Signed off.\n");
+	purple_prefs_disconnect_by_handle(gc);
+
+	purple_debug_info("oscar", "Signed off.\n");
 }
 
 static int
-gaim_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gc->account;
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = gc->account;
 	char *host; int port;
 	int i;
 	FlapConnection *newconn;
 	va_list ap;
 	struct aim_authresp_info *info;
 
-	port = gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
+	port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
 
 	va_start(ap, fr);
 	info = va_arg(ap, struct aim_authresp_info *);
 	va_end(ap);
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "inside auth_resp (Screen name: %s)\n", info->sn);
 
 	if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) {
@@ -1324,50 +1324,50 @@
 		case 0x01:
 			/* Unregistered screen name */
 			gc->wants_to_die = TRUE;
-			gaim_connection_error(gc, _("Invalid screen name."));
+			purple_connection_error(gc, _("Invalid screen name."));
 			break;
 		case 0x05:
 			/* Incorrect password */
 			gc->wants_to_die = TRUE;
-			if (!gaim_account_get_remember_password(account))
-				gaim_account_set_password(account, NULL);
-			gaim_connection_error(gc, _("Incorrect password."));
+			if (!purple_account_get_remember_password(account))
+				purple_account_set_password(account, NULL);
+			purple_connection_error(gc, _("Incorrect password."));
 			break;
 		case 0x11:
 			/* Suspended account */
 			gc->wants_to_die = TRUE;
-			gaim_connection_error(gc, _("Your account is currently suspended."));
+			purple_connection_error(gc, _("Your account is currently suspended."));
 			break;
 		case 0x14:
 			/* service temporarily unavailable */
-			gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable."));
+			purple_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable."));
 			break;
 		case 0x18:
 			/* connecting too frequently */
 			gc->wants_to_die = TRUE;
-			gaim_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
+			purple_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
 			break;
 		case 0x1c:
 			/* client too old */
 			gc->wants_to_die = TRUE;
-			g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), GAIM_WEBSITE);
-			gaim_connection_error(gc, buf);
+			g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE);
+			purple_connection_error(gc, buf);
 			break;
 		default:
-			gaim_connection_error(gc, _("Authentication failed"));
+			purple_connection_error(gc, _("Authentication failed"));
 			break;
 		}
-		gaim_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode);
-		gaim_debug_info("oscar", "Error URL: %s\n", info->errorurl);
+		purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode);
+		purple_debug_info("oscar", "Error URL: %s\n", info->errorurl);
 		od->killme = TRUE;
 		return 1;
 	}
 
-	gaim_debug_misc("oscar", "Reg status: %hu\n", info->regstatus);
-	gaim_debug_misc("oscar", "E-mail: %s\n",
+	purple_debug_misc("oscar", "Reg status: %hu\n", info->regstatus);
+	purple_debug_misc("oscar", "E-mail: %s\n",
 					(info->email != NULL) ? info->email : "null");
-	gaim_debug_misc("oscar", "BOSIP: %s\n", info->bosip);
-	gaim_debug_info("oscar", "Closing auth connection...\n");
+	purple_debug_misc("oscar", "BOSIP: %s\n", info->bosip);
+	purple_debug_info("oscar", "Closing auth connection...\n");
 	flap_connection_schedule_destroy(conn, OSCAR_DISCONNECT_DONE, NULL);
 
 	for (i = 0; i < strlen(info->bosip); i++) {
@@ -1380,67 +1380,67 @@
 	newconn = flap_connection_new(od, SNAC_FAMILY_LOCATE);
 	newconn->cookielen = info->cookielen;
 	newconn->cookie = g_memdup(info->cookie, info->cookielen);
-	newconn->connect_data = gaim_proxy_connect(NULL, account, host, port,
+	newconn->connect_data = purple_proxy_connect(NULL, account, host, port,
 			connection_established_cb, newconn);
 	g_free(host);
 	if (newconn->connect_data == NULL)
 	{
-		gaim_connection_error(gc, _("Could Not Connect"));
+		purple_connection_error(gc, _("Could Not Connect"));
 		od->killme = TRUE;
 		return 0;
 	}
 
-	gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS);
+	purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS);
 	ck[3] = 0x64;
 
 	return 1;
 }
 
 static void
-gaim_parse_auth_securid_request_yes_cb(gpointer user_data, const char *msg)
+purple_parse_auth_securid_request_yes_cb(gpointer user_data, const char *msg)
 {
-	GaimConnection *gc = user_data;
+	PurpleConnection *gc = user_data;
 	OscarData *od = gc->proto_data;
 
 	aim_auth_securid_send(od, msg);
 }
 
 static void
-gaim_parse_auth_securid_request_no_cb(gpointer user_data, const char *value)
+purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value)
 {
-	GaimConnection *gc = user_data;
+	PurpleConnection *gc = user_data;
 	OscarData *od = gc->proto_data;
 
 	/* Disconnect */
 	gc->wants_to_die = TRUE;
-	gaim_connection_error(gc, _("The SecurID key entered is invalid."));
+	purple_connection_error(gc, _("The SecurID key entered is invalid."));
 	od->killme = TRUE;
 }
 
 static int
-gaim_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	gchar *primary;
 
-	gaim_debug_info("oscar", "Got SecurID request\n");
-
-	primary = g_strdup_printf("Enter the SecurID key for %s.", gaim_account_get_username(account));
-	gaim_request_input(gc, NULL, _("Enter SecurID"), primary,
+	purple_debug_info("oscar", "Got SecurID request\n");
+
+	primary = g_strdup_printf("Enter the SecurID key for %s.", purple_account_get_username(account));
+	purple_request_input(gc, NULL, _("Enter SecurID"), primary,
 					   _("Enter the 6 digit number from the digital display."),
 					   FALSE, FALSE, NULL,
-					   _("_OK"), G_CALLBACK(gaim_parse_auth_securid_request_yes_cb),
-					   _("_Cancel"), G_CALLBACK(gaim_parse_auth_securid_request_no_cb),
+					   _("_OK"), G_CALLBACK(purple_parse_auth_securid_request_yes_cb),
+					   _("_Cancel"), G_CALLBACK(purple_parse_auth_securid_request_no_cb),
 					   gc);
 	g_free(primary);
 
 	return 1;
 }
 
-/* XXX - Should use gaim_util_fetch_url for the below stuff */
+/* XXX - Should use purple_util_fetch_url for the below stuff */
 struct pieceofcrap {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	unsigned long offset;
 	unsigned long len;
 	char *modname;
@@ -1449,7 +1449,7 @@
 	unsigned int inpa;
 };
 
-static void damn_you(gpointer data, gint source, GaimInputCondition c)
+static void damn_you(gpointer data, gint source, PurpleInputCondition c)
 {
 	struct pieceofcrap *pos = data;
 	OscarData *od = pos->gc->proto_data;
@@ -1469,27 +1469,27 @@
 	if (in != '\n') {
 		char buf[256];
 		g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly.  You may want to use TOC until "
-			"this is fixed.  Check %s for updates."), GAIM_WEBSITE);
-		gaim_notify_warning(pos->gc, NULL,
+			"this is fixed.  Check %s for updates."), PURPLE_WEBSITE);
+		purple_notify_warning(pos->gc, NULL,
 							_("Unable to get a valid AIM login hash."),
 							buf);
-		gaim_input_remove(pos->inpa);
+		purple_input_remove(pos->inpa);
 		close(pos->fd);
 		g_free(pos);
 		return;
 	}
 	if (read(pos->fd, m, 16) != 16)
 	{
-		gaim_debug_warning("oscar", "Could not read full AIM login hash "
+		purple_debug_warning("oscar", "Could not read full AIM login hash "
 				"from " AIMHASHDATA "--that's bad.\n");
 	}
 	m[16] = '\0';
-	gaim_debug_misc("oscar", "Sending hash: ");
+	purple_debug_misc("oscar", "Sending hash: ");
 	for (x = 0; x < 16; x++)
-		gaim_debug_misc(NULL, "%02hhx ", (unsigned char)m[x]);
-
-	gaim_debug_misc(NULL, "\n");
-	gaim_input_remove(pos->inpa);
+		purple_debug_misc(NULL, "%02hhx ", (unsigned char)m[x]);
+
+	purple_debug_misc(NULL, "\n");
+	purple_input_remove(pos->inpa);
 	close(pos->fd);
 	aim_sendmemblock(od, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
 	g_free(pos);
@@ -1501,7 +1501,7 @@
 	struct pieceofcrap *pos = data;
 	gchar *buf;
 
-	if (!GAIM_CONNECTION_IS_VALID(pos->gc))
+	if (!PURPLE_CONNECTION_IS_VALID(pos->gc))
 	{
 		g_free(pos->modname);
 		g_free(pos);
@@ -1512,8 +1512,8 @@
 
 	if (source < 0) {
 		buf = g_strdup_printf(_("You may be disconnected shortly.  You may want to use TOC until "
-			"this is fixed.  Check %s for updates."), GAIM_WEBSITE);
-		gaim_notify_warning(pos->gc, NULL,
+			"this is fixed.  Check %s for updates."), PURPLE_WEBSITE);
+		purple_notify_warning(pos->gc, NULL,
 							_("Unable to get a valid AIM login hash."),
 							buf);
 		g_free(buf);
@@ -1527,14 +1527,14 @@
 	write(pos->fd, buf, strlen(buf));
 	g_free(buf);
 	g_free(pos->modname);
-	pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
+	pos->inpa = purple_input_add(pos->fd, PURPLE_INPUT_READ, damn_you, pos);
 	return;
 }
 
 /* size of icbmui.ocm, the largest module in AIM 3.5 */
 #define AIM_MAX_FILE_SIZE 98304
 
-int gaim_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+int purple_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	struct pieceofcrap *pos;
 	guint32 offset, len;
@@ -1546,11 +1546,11 @@
 	modname = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_misc("oscar", "offset: %u, len: %u, file: %s\n",
+	purple_debug_misc("oscar", "offset: %u, len: %u, file: %s\n",
 					offset, len, (modname ? modname : "aim.exe"));
 
 	if (len == 0) {
-		gaim_debug_misc("oscar", "len is 0, hashing NULL\n");
+		purple_debug_misc("oscar", "len is 0, hashing NULL\n");
 		aim_sendmemblock(od, conn, offset, len, NULL,
 				AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
 		return 1;
@@ -1576,7 +1576,7 @@
 		buf[i++] = (len >> 8) & 0xff;
 		buf[i++] = (len >> 16) & 0xff;
 		buf[i++] = (len >> 24) & 0xff;
-		gaim_debug_misc("oscar", "len + offset is invalid, "
+		purple_debug_misc("oscar", "len + offset is invalid, "
 		           "hashing request\n");
 		aim_sendmemblock(od, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
 		g_free(buf);
@@ -1593,7 +1593,7 @@
 	pos->modname = g_strdup(modname);
 
 	/* TODO: Keep track of this return value. */
-	if (gaim_proxy_connect(NULL, pos->gc->account, "gaim.sourceforge.net", 80,
+	if (purple_proxy_connect(NULL, pos->gc->account, "purple.sourceforge.net", 80,
 			straight_to_hell, pos) == NULL)
 	{
 		char buf[256];
@@ -1601,8 +1601,8 @@
 			g_free(pos->modname);
 		g_free(pos);
 		g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly.  "
-			"Check %s for updates."), GAIM_WEBSITE);
-		gaim_notify_warning(pos->gc, NULL,
+			"Check %s for updates."), PURPLE_WEBSITE);
+		purple_notify_warning(pos->gc, NULL,
 							_("Unable to get a valid login hash."),
 							buf);
 	}
@@ -1611,35 +1611,35 @@
 }
 
 static int
-gaim_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+purple_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc;
-	GaimAccount *account;
-	ClientInfo info = CLIENTINFO_GAIM;
+	PurpleConnection *gc;
+	PurpleAccount *account;
+	ClientInfo info = CLIENTINFO_PURPLE;
 	va_list ap;
 	char *key;
 
 	gc = od->gc;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
 	key = va_arg(ap, char *);
 	va_end(ap);
 
-	aim_send_login(od, conn, gaim_account_get_username(account),
-				   gaim_connection_get_password(gc), &info, key);
-
-	gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS);
+	aim_send_login(od, conn, purple_account_get_username(account),
+				   purple_connection_get_password(gc), &info, key);
+
+	purple_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS);
 	ck[2] = 0x6c;
 
 	return 1;
 }
 
 static int
-gaim_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+purple_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	char *host, *separator;
 	int port;
 	FlapConnection *newconn;
@@ -1650,7 +1650,7 @@
 	redir = va_arg(ap, struct aim_redirect_data *);
 	va_end(ap);
 
-	port = gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
+	port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
 	separator = strchr(redir->ip, ':');
 	if (separator != NULL)
 	{
@@ -1660,7 +1660,7 @@
 	else
 		host = g_strdup(redir->ip);
 
-	gaim_debug_info("oscar", "Connecting to FLAP server %s:%d of type 0x%04hx\n",
+	purple_debug_info("oscar", "Connecting to FLAP server %s:%d of type 0x%04hx\n",
 					host, port, redir->group);
 	newconn = flap_connection_new(od, redir->group);
 	newconn->cookielen = redir->cookielen;
@@ -1676,17 +1676,17 @@
 		cc->instance = redir->chat.instance;
 		cc->show = extract_name(redir->chat.room);
 		newconn->new_conn_data = cc;
-		gaim_debug_info("oscar", "Connecting to chat room %s exchange %hu\n", cc->name, cc->exchange);
-	}
-
-	newconn->connect_data = gaim_proxy_connect(NULL, account, host, port,
+		purple_debug_info("oscar", "Connecting to chat room %s exchange %hu\n", cc->name, cc->exchange);
+	}
+
+	newconn->connect_data = purple_proxy_connect(NULL, account, host, port,
 			connection_established_cb, newconn);
 	if (newconn->connect_data == NULL)
 	{
 		flap_connection_schedule_destroy(newconn,
 				OSCAR_DISCONNECT_COULD_NOT_CONNECT,
 				_("Unable to initialize connection"));
-		gaim_debug_error("oscar", "Unable to connect to FLAP server "
+		purple_debug_error("oscar", "Unable to connect to FLAP server "
 				"of type 0x%04hx\n", redir->group);
 	}
 	g_free(host);
@@ -1694,11 +1694,11 @@
 	return 1;
 }
 
-static int gaim_parse_oncoming(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_parse_oncoming(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc;
-	GaimAccount *account;
-	GaimPresence *presence;
+	PurpleConnection *gc;
+	PurpleAccount *account;
+	PurplePresence *presence;
 	struct buddyinfo *bi;
 	time_t time_idle = 0, signon = 0;
 	int type = 0;
@@ -1710,8 +1710,8 @@
 	aim_userinfo_t *info;
 
 	gc = od->gc;
-	account = gaim_connection_get_account(gc);
-	presence = gaim_account_get_presence(account);
+	account = purple_connection_get_account(gc);
+	presence = purple_account_get_presence(account);
 
 	va_start(ap, fr);
 	info = va_arg(ap, aim_userinfo_t *);
@@ -1771,28 +1771,28 @@
 
 	if (info->flags & AIM_FLAG_WIRELESS || info->capabilities & OSCAR_CAPABILITY_HIPTOP)
 	{
-		gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_MOBILE, NULL);
+		purple_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_MOBILE, NULL);
 	} else {
-		gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
+		purple_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
 	}
 
 	if (have_status_message)
 	{
-		gaim_prpl_got_user_status(account, info->sn, status_id,
+		purple_prpl_got_user_status(account, info->sn, status_id,
 								  "message", message, NULL);
 		g_free(message);
 	}
 	else
 	{
-		GaimBuddy *b = gaim_find_buddy(account, info->sn);
-		GaimStatus *status;
+		PurpleBuddy *b = purple_find_buddy(account, info->sn);
+		PurpleStatus *status;
 		const char *active_status_id;
 
-		status = gaim_presence_get_active_status(gaim_buddy_get_presence(b));
-		active_status_id = gaim_status_get_id(status);
+		status = purple_presence_get_active_status(purple_buddy_get_presence(b));
+		active_status_id = purple_status_get_id(status);
 
 		if (!active_status_id || strcmp(active_status_id, status_id))
-			gaim_prpl_got_user_status(account, info->sn, status_id, NULL);
+			purple_prpl_got_user_status(account, info->sn, status_id, NULL);
 	}
 
 	/* Login time stuff */
@@ -1800,11 +1800,11 @@
 		signon = info->onlinesince;
 	else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
 		signon = time(NULL) - info->sessionlen;
-	if (!aim_sncmp(gaim_account_get_username(account), info->sn)) {
-		gaim_connection_set_display_name(gc, info->sn);
-		od->timeoffset = signon - gaim_presence_get_login_time(presence);
-	}
-	gaim_prpl_got_user_login_time(account, info->sn, signon - od->timeoffset);
+	if (!aim_sncmp(purple_account_get_username(account), info->sn)) {
+		purple_connection_set_display_name(gc, info->sn);
+		od->timeoffset = signon - purple_presence_get_login_time(presence);
+	}
+	purple_prpl_got_user_login_time(account, info->sn, signon - od->timeoffset);
 
 	/* Idle time stuff */
 	/* info->idletime is the number of minutes that this user has been idle */
@@ -1812,15 +1812,15 @@
 		time_idle = time(NULL) - info->idletime * 60;
 
 	if (time_idle > 0)
-		gaim_prpl_got_user_idle(account, info->sn, TRUE, time_idle);
+		purple_prpl_got_user_idle(account, info->sn, TRUE, time_idle);
 	else
-		gaim_prpl_got_user_idle(account, info->sn, FALSE, 0);
+		purple_prpl_got_user_idle(account, info->sn, FALSE, 0);
 
 	/* Server stored icon stuff */
-	bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, info->sn));
+	bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, info->sn));
 	if (!bi) {
 		bi = g_new0(struct buddyinfo, 1);
-		g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, info->sn)), bi);
+		g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, info->sn)), bi);
 	}
 	bi->typingnot = FALSE;
 	bi->ico_informed = FALSE;
@@ -1829,27 +1829,27 @@
 	if (info->iconcsumlen) {
 		const char *filename, *saved_b16 = NULL;
 		char *b16 = NULL, *filepath = NULL;
-		GaimBuddy *b = NULL;
-
-		b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen);
-		b = gaim_find_buddy(account, info->sn);
+		PurpleBuddy *b = NULL;
+
+		b16 = purple_base16_encode(info->iconcsum, info->iconcsumlen);
+		b = purple_find_buddy(account, info->sn);
 		/*
 		 * If for some reason the checksum is valid, but cached file is not..
 		 * we want to know.
 		 */
 		if (b != NULL)
-			filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon");
+			filename = purple_blist_node_get_string((PurpleBlistNode*)b, "buddy_icon");
 		else
 			filename = NULL;
 		if (filename != NULL) {
 			if (g_file_test(filename, G_FILE_TEST_EXISTS))
-				saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b,
+				saved_b16 = purple_blist_node_get_string((PurpleBlistNode*)b,
 						"icon_checksum");
 			else {
-				filepath = g_build_filename(gaim_buddy_icons_get_cache_dir(),
+				filepath = g_build_filename(purple_buddy_icons_get_cache_dir(),
 											filename, NULL);
 				if (g_file_test(filepath, G_FILE_TEST_EXISTS))
-					saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b,
+					saved_b16 = purple_blist_node_get_string((PurpleBlistNode*)b,
 															"icon_checksum");
 				g_free(filepath);
 			}
@@ -1861,9 +1861,9 @@
 			while (cur && aim_sncmp((char *)cur->data, info->sn))
 				cur = cur->next;
 			if (!cur) {
-				od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(account, info->sn)));
+				od->requesticon = g_slist_append(od->requesticon, g_strdup(purple_normalize(account, info->sn)));
 				if (od->icontimer == 0)
-					od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc);
+					od->icontimer = purple_timeout_add(500, purple_icon_timerfunc, gc);
 			}
 		}
 		g_free(b16);
@@ -1872,16 +1872,16 @@
 	return 1;
 }
 
-static void gaim_check_comment(OscarData *od, const char *str) {
+static void purple_check_comment(OscarData *od, const char *str) {
 	if ((str == NULL) || strcmp(str, (const char *)ck))
-		aim_locate_setcaps(od, gaim_caps);
+		aim_locate_setcaps(od, purple_caps);
 	else
-		aim_locate_setcaps(od, gaim_caps | OSCAR_CAPABILITY_SECUREIM);
-}
-
-static int gaim_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
+		aim_locate_setcaps(od, purple_caps | OSCAR_CAPABILITY_SECUREIM);
+}
+
+static int purple_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	va_list ap;
 	aim_userinfo_t *info;
 
@@ -1889,17 +1889,17 @@
 	info = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
 
-	gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL);
-	gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
-	g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn));
+	purple_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL);
+	purple_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
+	g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->sn));
 
 	return 1;
 }
 
 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
-	GaimMessageFlags flags = 0;
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
+	PurpleMessageFlags flags = 0;
 	struct buddyinfo *bi;
 	char *iconfile;
 	GString *message;
@@ -1908,20 +1908,20 @@
 	const char *start, *end;
 	GData *attribs;
 
-	gaim_debug_misc("oscar", "Received IM from %s with %d parts\n",
+	purple_debug_misc("oscar", "Received IM from %s with %d parts\n",
 					userinfo->sn, args->mpmsg.numparts);
 
 	if (args->mpmsg.numparts == 0)
 		return 1;
 
-	bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn));
+	bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->sn));
 	if (!bi) {
 		bi = g_new0(struct buddyinfo, 1);
-		g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, userinfo->sn)), bi);
+		g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, userinfo->sn)), bi);
 	}
 
 	if (args->icbmflags & AIM_IMFLAGS_AWAY)
-		flags |= GAIM_MESSAGE_AUTO_RESP;
+		flags |= PURPLE_MESSAGE_AUTO_RESP;
 
 	if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT)
 		bi->typingnot = TRUE;
@@ -1929,7 +1929,7 @@
 		bi->typingnot = FALSE;
 
 	if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) {
-		gaim_debug_misc("oscar", "%s has an icon\n", userinfo->sn);
+		purple_debug_misc("oscar", "%s has an icon\n", userinfo->sn);
 		if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) {
 			bi->ico_need = TRUE;
 			bi->ico_len = args->iconlen;
@@ -1938,7 +1938,7 @@
 		}
 	}
 
-	iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(account));
+	iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account));
 	if ((iconfile != NULL) &&
 	    (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) {
 		FILE *file;
@@ -1951,7 +1951,7 @@
 				/* XXX - Use g_file_get_contents() */
 				/* g_file_get_contents(iconfile, &data, &len, NULL); */
 				int len = fread(buf, 1, st.st_size, file);
-				gaim_debug_info("oscar",
+				purple_debug_info("oscar",
 						   "Sending buddy icon to %s (%d bytes, "
 						   "%lu reported)\n",
 						   userinfo->sn, len, st.st_size);
@@ -1959,17 +1959,17 @@
 					st.st_mtime, aimutil_iconsum(buf, st.st_size));
 				fclose(file);
 			} else
-				gaim_debug_error("oscar", "Can't open buddy icon file!\n");
+				purple_debug_error("oscar", "Can't open buddy icon file!\n");
 			g_free(buf);
 		} else
-			gaim_debug_error("oscar", "Can't stat buddy icon file!\n");
+			purple_debug_error("oscar", "Can't stat buddy icon file!\n");
 	}
 	g_free(iconfile);
 
 	message = g_string_new("");
 	curpart = args->mpmsg.parts;
 	while (curpart != NULL) {
-		tmp = gaim_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset,
+		tmp = purple_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset,
 				curpart->charsubset, curpart->data, curpart->datalen);
 		if (tmp != NULL) {
 			g_string_append(message, tmp);
@@ -1989,12 +1989,12 @@
 	 * Note: There *may* be some clients which send messages as HTML formatted -
 	 *       they need to be special-cased somehow.
 	 */
-	if (aim_sn_is_icq(gaim_account_get_username(account)) && aim_sn_is_icq(userinfo->sn)) {
+	if (aim_sn_is_icq(purple_account_get_username(account)) && aim_sn_is_icq(userinfo->sn)) {
 		/* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */
 		gchar *tmp2 = g_markup_escape_text(tmp, -1);
 		g_free(tmp);
 		tmp = tmp2;
-		tmp2 = gaim_strreplace(tmp, "\r\n", "<br>");
+		tmp2 = purple_strreplace(tmp, "\r\n", "<br>");
 		g_free(tmp);
 		tmp = tmp2;
 	}
@@ -2002,7 +2002,7 @@
 	/*
 	 * Convert iChat color tags to normal font tags.
 	 */
-	if (gaim_markup_find_tag("body", tmp, &start, &end, &attribs))
+	if (purple_markup_find_tag("body", tmp, &start, &end, &attribs))
 	{
 		const char *ichattextcolor, *ichatballooncolor;
 
@@ -2036,21 +2036,21 @@
 static int
 incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, IcbmArgsCh2 *args)
 {
-	GaimConnection *gc;
-	GaimAccount *account;
+	PurpleConnection *gc;
+	PurpleAccount *account;
 	char *message = NULL;
 
 	g_return_val_if_fail(od != NULL, 0);
 	g_return_val_if_fail(od->gc != NULL, 0);
 
 	gc = od->gc;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 	od = gc->proto_data;
 
 	if (args == NULL)
 		return 0;
 
-	gaim_debug_misc("oscar", "Incoming rendezvous message of type %u, "
+	purple_debug_misc("oscar", "Incoming rendezvous message of type %u, "
 			"user %s, status %hu\n", args->type, userinfo->sn, args->status);
 
 	if (args->msg != NULL)
@@ -2144,8 +2144,8 @@
 					 * continue the peer negotiation by
 					 * accepting connections on our listener port.
 					 */
-					conn->watcher_incoming = gaim_input_add(conn->listenerfd,
-							GAIM_INPUT_READ, peer_connection_listen_cb, conn);
+					conn->watcher_incoming = purple_input_add(conn->listenerfd,
+							PURPLE_INPUT_READ, peer_connection_listen_cb, conn);
 				}
 			}
 		}
@@ -2161,20 +2161,20 @@
 
 	else if (args->type & OSCAR_CAPABILITY_BUDDYICON)
 	{
-		gaim_buddy_icons_set_for_user(account, userinfo->sn,
+		purple_buddy_icons_set_for_user(account, userinfo->sn,
 									  args->info.icon.icon,
 									  args->info.icon.length);
 	}
 
 	else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY)
 	{
-		gaim_debug_error("oscar", "Got an ICQ Server Relay message of "
+		purple_debug_error("oscar", "Got an ICQ Server Relay message of "
 				"type %d\n", args->info.rtfmsg.msgtype);
 	}
 
 	else
 	{
-		gaim_debug_error("oscar", "Unknown request class %hu\n",
+		purple_debug_error("oscar", "Unknown request class %hu\n",
 				args->type);
 	}
 
@@ -2190,46 +2190,46 @@
  */
 /* When you ask other people for authorization */
 static void
-gaim_auth_request(struct name_data *data, char *msg)
+purple_auth_request(struct name_data *data, char *msg)
 {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	OscarData *od;
-	GaimBuddy *buddy;
-	GaimGroup *group;
+	PurpleBuddy *buddy;
+	PurpleGroup *group;
 
 	gc = data->gc;
 	od = gc->proto_data;
-	buddy = gaim_find_buddy(gaim_connection_get_account(gc), data->name);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), data->name);
 	if (buddy != NULL)
-		group = gaim_buddy_get_group(buddy);
+		group = purple_buddy_get_group(buddy);
 	else
 		group = NULL;
 
 	if (group != NULL)
 	{
-		gaim_debug_info("oscar", "ssi: adding buddy %s to group %s\n",
+		purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n",
 				   buddy->name, group->name);
 		aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
 		if (!aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))
-			aim_ssi_addbuddy(od, buddy->name, group->name, gaim_buddy_get_alias_only(buddy), NULL, NULL, 1);
+			aim_ssi_addbuddy(od, buddy->name, group->name, purple_buddy_get_alias_only(buddy), NULL, NULL, 1);
 	}
 }
 
 static void
-gaim_auth_dontrequest(struct name_data *data)
+purple_auth_dontrequest(struct name_data *data)
 {
-	GaimConnection *gc = data->gc;
-	GaimBuddy *b = gaim_find_buddy(gaim_connection_get_account(gc), data->name);
+	PurpleConnection *gc = data->gc;
+	PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), data->name);
 
 	/* Remove from local list */
-	gaim_blist_remove_buddy(b);
+	purple_blist_remove_buddy(b);
 
 	oscar_free_name_data(data);
 }
 
 
 static void
-gaim_auth_sendrequest(GaimConnection *gc, const char *name)
+purple_auth_sendrequest(PurpleConnection *gc, const char *name)
 {
 	struct name_data *data;
 
@@ -2237,32 +2237,32 @@
 	data->gc = gc;
 	data->name = g_strdup(name);
 
-	gaim_request_input(data->gc, NULL, _("Authorization Request Message:"),
+	purple_request_input(data->gc, NULL, _("Authorization Request Message:"),
 					   NULL, _("Please authorize me!"), TRUE, FALSE, NULL,
-					   _("_OK"), G_CALLBACK(gaim_auth_request),
-					   _("_Cancel"), G_CALLBACK(gaim_auth_dontrequest),
+					   _("_OK"), G_CALLBACK(purple_auth_request),
+					   _("_Cancel"), G_CALLBACK(purple_auth_dontrequest),
 					   data);
 }
 
 
 static void
-gaim_auth_sendrequest_menu(GaimBlistNode *node, gpointer ignored)
+purple_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored)
 {
-	GaimBuddy *buddy;
-	GaimConnection *gc;
-
-	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
-
-	buddy = (GaimBuddy *) node;
-	gc = gaim_account_get_connection(buddy->account);
-	gaim_auth_sendrequest(gc, buddy->name);
+	PurpleBuddy *buddy;
+	PurpleConnection *gc;
+
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
+
+	buddy = (PurpleBuddy *) node;
+	gc = purple_account_get_connection(buddy->account);
+	purple_auth_sendrequest(gc, buddy->name);
 }
 
 /* When other people ask you for authorization */
 static void
-gaim_auth_grant(struct name_data *data)
+purple_auth_grant(struct name_data *data)
 {
-	GaimConnection *gc = data->gc;
+	PurpleConnection *gc = data->gc;
 	OscarData *od = gc->proto_data;
 
 	aim_ssi_sendauthreply(od, data->name, 0x01, NULL);
@@ -2272,31 +2272,31 @@
 
 /* When other people ask you for authorization */
 static void
-gaim_auth_dontgrant(struct name_data *data, char *msg)
+purple_auth_dontgrant(struct name_data *data, char *msg)
 {
-	GaimConnection *gc = data->gc;
+	PurpleConnection *gc = data->gc;
 	OscarData *od = gc->proto_data;
 
 	aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given."));
 }
 
 static void
-gaim_auth_dontgrant_msgprompt(struct name_data *data)
+purple_auth_dontgrant_msgprompt(struct name_data *data)
 {
-	gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"),
+	purple_request_input(data->gc, NULL, _("Authorization Denied Message:"),
 					   NULL, _("No reason given."), TRUE, FALSE, NULL,
-					   _("_OK"), G_CALLBACK(gaim_auth_dontgrant),
+					   _("_OK"), G_CALLBACK(purple_auth_dontgrant),
 					   _("_Cancel"), G_CALLBACK(oscar_free_name_data),
 					   data);
 }
 
 /* When someone sends you buddies */
 static void
-gaim_icq_buddyadd(struct name_data *data)
+purple_icq_buddyadd(struct name_data *data)
 {
-	GaimConnection *gc = data->gc;
-
-	gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick);
+	PurpleConnection *gc = data->gc;
+
+	purple_blist_request_add_buddy(purple_connection_get_account(gc), data->name, NULL, data->nick);
 
 	oscar_free_name_data(data);
 }
@@ -2304,15 +2304,15 @@
 static int
 incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t)
 {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	gchar **msg1, **msg2;
 	int i, numtoks;
 
 	if (!args->type || !args->msg || !args->uin)
 		return 1;
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 					"Received a channel 4 message of type 0x%02hx.\n",
 					args->type);
 
@@ -2331,9 +2331,9 @@
 	for (i=0; msg1[i]; i++) {
 		gchar *uin = g_strdup_printf("%u", args->uin);
 
-		gaim_str_strip_char(msg1[i], '\r');
+		purple_str_strip_char(msg1[i], '\r');
 		/* TODO: Should use an encoding other than ASCII? */
-		msg2[i] = gaim_plugin_oscar_decode_im_part(account, uin, AIM_CHARSET_ASCII, 0x0000, msg1[i], strlen(msg1[i]));
+		msg2[i] = purple_plugin_oscar_decode_im_part(account, uin, AIM_CHARSET_ASCII, 0x0000, msg1[i], strlen(msg1[i]));
 		g_free(uin);
 	}
 	msg2[i] = NULL;
@@ -2391,19 +2391,19 @@
 				gchar *reason = NULL;
 
 				if (msg2[5] != NULL)
-					reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5]));
-
-				gaim_debug_info("oscar",
+					reason = purple_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5]));
+
+				purple_debug_info("oscar",
 						   "Received an authorization request from UIN %u\n",
 						   args->uin);
 				data->gc = gc;
 				data->name = sn;
 				data->nick = NULL;
 
-				gaim_account_request_authorization(account, sn, NULL, NULL,
-						reason, gaim_find_buddy(account, sn) != NULL,
-						G_CALLBACK(gaim_auth_grant),
-						G_CALLBACK(gaim_auth_dontgrant_msgprompt), data);
+				purple_account_request_authorization(account, sn, NULL, NULL,
+						reason, purple_find_buddy(account, sn) != NULL,
+						G_CALLBACK(purple_auth_grant),
+						G_CALLBACK(purple_auth_dontgrant_msgprompt), data);
 				g_free(reason);
 			}
 		} break;
@@ -2411,7 +2411,7 @@
 		case 0x07: { /* Someone has denied you authorization */
 			if (i >= 1) {
 				gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given."));
-				gaim_notify_info(gc, NULL, _("ICQ authorization denied."),
+				purple_notify_info(gc, NULL, _("ICQ authorization denied."),
 								 dialog_msg);
 				g_free(dialog_msg);
 			}
@@ -2419,7 +2419,7 @@
 
 		case 0x08: { /* Someone has granted you authorization */
 			gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin);
-			gaim_notify_info(gc, NULL, "ICQ authorization accepted.",
+			purple_notify_info(gc, NULL, "ICQ authorization accepted.",
 							 dialog_msg);
 			g_free(dialog_msg);
 		} break;
@@ -2427,7 +2427,7 @@
 		case 0x09: { /* Message from the Godly ICQ server itself, I think */
 			if (i >= 5) {
 				gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]);
-				gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg);
+				purple_notify_info(gc, NULL, "ICQ Server Message", dialog_msg);
 				g_free(dialog_msg);
 			}
 		} break;
@@ -2435,7 +2435,7 @@
 		case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */
 			if (i >= 6) {
 				gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]);
-				gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg);
+				purple_notify_info(gc, NULL, "ICQ Page", dialog_msg);
 				g_free(dialog_msg);
 			}
 		} break;
@@ -2443,7 +2443,7 @@
 		case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */
 			if (i >= 6) {
 				gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ e-mail from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]);
-				gaim_notify_info(gc, NULL, "ICQ E-Mail", dialog_msg);
+				purple_notify_info(gc, NULL, "ICQ E-Mail", dialog_msg);
 				g_free(dialog_msg);
 			}
 		} break;
@@ -2468,11 +2468,11 @@
 					data->name = g_strdup(text[i*2+1]);
 					data->nick = g_strdup(text[i*2+2]);
 
-					gaim_request_action(gc, NULL, message,
+					purple_request_action(gc, NULL, message,
 										_("Do you want to add this buddy "
 										  "to your buddy list?"),
-										GAIM_DEFAULT_ACTION_NONE, data, 2,
-										_("_Add"), G_CALLBACK(gaim_icq_buddyadd),
+										PURPLE_DEFAULT_ACTION_NONE, data, 2,
+										_("_Add"), G_CALLBACK(purple_icq_buddyadd),
 										_("_Decline"), G_CALLBACK(oscar_free_name_data));
 					g_free(message);
 				}
@@ -2485,7 +2485,7 @@
 		} break;
 
 		default: {
-			gaim_debug_info("oscar",
+			purple_debug_info("oscar",
 					   "Received a channel 4 message of unknown type "
 					   "(type 0x%02hhx).\n", args->type);
 		} break;
@@ -2497,7 +2497,7 @@
 	return 1;
 }
 
-static int gaim_parse_incoming_im(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_incoming_im(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	guint16 channel;
 	int ret = 0;
 	aim_userinfo_t *userinfo;
@@ -2527,7 +2527,7 @@
 		} break;
 
 		default: {
-			gaim_debug_warning("oscar",
+			purple_debug_warning("oscar",
 					   "ICBM received on unsupported channel (channel "
 					   "0x%04hx).", channel);
 		} break;
@@ -2538,9 +2538,9 @@
 	return ret;
 }
 
-static int gaim_parse_misses(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
+static int purple_parse_misses(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	char *buf;
 	va_list ap;
 	guint16 chan, nummissed, reason;
@@ -2610,15 +2610,15 @@
 			break;
 	}
 
-	if (!gaim_conv_present_error(userinfo->sn, account, buf))
-		gaim_notify_error(od->gc, NULL, buf, NULL);
+	if (!purple_conv_present_error(userinfo->sn, account, buf))
+		purple_notify_error(od->gc, NULL, buf, NULL);
 	g_free(buf);
 
 	return 1;
 }
 
 static int
-gaim_parse_clientauto_ch2(OscarData *od, const char *who, guint16 reason, const guchar *cookie)
+purple_parse_clientauto_ch2(OscarData *od, const char *who, guint16 reason, const guchar *cookie)
 {
 	if (reason == 0x0003)
 	{
@@ -2629,7 +2629,7 @@
 
 		if (conn == NULL)
 		{
-			gaim_debug_info("oscar", "Received a rendezvous cancel message "
+			purple_debug_info("oscar", "Received a rendezvous cancel message "
 					"for a nonexistant connection from %s.\n", who);
 		}
 		else
@@ -2639,42 +2639,42 @@
 	}
 	else
 	{
-		gaim_debug_warning("oscar", "Received an unknown rendezvous "
+		purple_debug_warning("oscar", "Received an unknown rendezvous "
 				"message from %s.  Type 0x%04hx\n", who, reason);
 	}
 
 	return 0;
 }
 
-static int gaim_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) {
-	GaimConnection *gc = od->gc;
+static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) {
+	PurpleConnection *gc = od->gc;
 
 	switch(reason) {
 		case 0x0003: { /* Reply from an ICQ status message request */
 			char *statusmsg, **splitmsg;
-			GaimNotifyUserInfo *user_info;
+			PurpleNotifyUserInfo *user_info;
 
 			/* Split at (carriage return/newline)'s, then rejoin later with BRs between. */
 			statusmsg = oscar_icqstatus(state);
 			splitmsg = g_strsplit(msg, "\r\n", 0);
 			
-			user_info = gaim_notify_user_info_new();
+			user_info = purple_notify_user_info_new();
 				
-			gaim_notify_user_info_add_pair(user_info, _("UIN"), who);
-			gaim_notify_user_info_add_pair(user_info, _("Status"), statusmsg);
-			gaim_notify_user_info_add_section_break(user_info);
-			gaim_notify_user_info_add_pair(user_info, NULL, g_strjoinv("<BR>", splitmsg));
+			purple_notify_user_info_add_pair(user_info, _("UIN"), who);
+			purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg);
+			purple_notify_user_info_add_section_break(user_info);
+			purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("<BR>", splitmsg));
 
 			g_free(statusmsg);
 			g_strfreev(splitmsg);
 
-			gaim_notify_userinfo(gc, who, user_info, NULL, NULL);
-			gaim_notify_user_info_destroy(user_info);
+			purple_notify_userinfo(gc, who, user_info, NULL, NULL);
+			purple_notify_user_info_destroy(user_info);
 
 		} break;
 
 		default: {
-			gaim_debug_warning("oscar",
+			purple_debug_warning("oscar",
 					   "Received an unknown client auto-response from %s.  "
 					   "Type 0x%04hx\n", who, reason);
 		} break;
@@ -2683,7 +2683,7 @@
 	return 0;
 }
 
-static int gaim_parse_clientauto(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_clientauto(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	guint16 chan, reason;
 	char *who;
@@ -2695,7 +2695,7 @@
 
 	if (chan == 0x0002) { /* File transfer declined */
 		guchar *cookie = va_arg(ap, guchar *);
-		return gaim_parse_clientauto_ch2(od, who, reason, cookie);
+		return purple_parse_clientauto_ch2(od, who, reason, cookie);
 	} else if (chan == 0x0004) { /* ICQ message */
 		guint32 state = 0;
 		char *msg = NULL;
@@ -2703,7 +2703,7 @@
 			state = va_arg(ap, guint32);
 			msg = va_arg(ap, char *);
 		}
-		return gaim_parse_clientauto_ch4(od, who, reason, state, msg);
+		return purple_parse_clientauto_ch4(od, who, reason, state, msg);
 	}
 
 	va_end(ap);
@@ -2711,7 +2711,7 @@
 	return 1;
 }
 
-static int gaim_parse_genericerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_genericerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	guint16 reason;
 
@@ -2719,17 +2719,17 @@
 	reason = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
-	gaim_debug_error("oscar",
+	purple_debug_error("oscar",
 			   "snac threw error (reason 0x%04hx: %s)\n", reason,
 			   (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
 	return 1;
 }
 
-static int gaim_parse_msgerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_parse_msgerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 #ifdef TODOFT
 	OscarData *od = gc->proto_data;
-	GaimXfer *xfer;
+	PurpleXfer *xfer;
 #endif
 	va_list ap;
 	guint16 reason;
@@ -2740,7 +2740,7 @@
 	data = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_error("oscar",
+	purple_debug_error("oscar",
 			   "Message error with data %s and reason %hu\n",
 				(data != NULL ? data : ""), reason);
 
@@ -2751,17 +2751,17 @@
 #ifdef TODOFT
 	/* If this was a file transfer request, data is a cookie */
 	if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) {
-		gaim_xfer_cancel_remote(xfer);
+		purple_xfer_cancel_remote(xfer);
 		return 1;
 	}
 #endif
 
 	/* Data is assumed to be the destination sn */
 	buf = g_strdup_printf(_("Unable to send message: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
-	if (!gaim_conv_present_error(data, gaim_connection_get_account(gc), buf)) {
+	if (!purple_conv_present_error(data, purple_connection_get_account(gc), buf)) {
 		g_free(buf);
 		buf = g_strdup_printf(_("Unable to send message to %s:"), data ? data : "(unknown)");
-		gaim_notify_error(od->gc, NULL, buf,
+		purple_notify_error(od->gc, NULL, buf,
 				  (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
 	}
 	g_free(buf);
@@ -2769,8 +2769,8 @@
 	return 1;
 }
 
-static int gaim_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	guint16 type1, type2;
 	char *sn;
@@ -2787,11 +2787,11 @@
 		} break;
 
 		case 0x0001: { /* Paused typing */
-			serv_got_typing(gc, sn, 0, GAIM_TYPED);
+			serv_got_typing(gc, sn, 0, PURPLE_TYPED);
 		} break;
 
 		case 0x0002: { /* Typing */
-			serv_got_typing(gc, sn, 0, GAIM_TYPING);
+			serv_got_typing(gc, sn, 0, PURPLE_TYPING);
 		} break;
 
 		default: {
@@ -2799,7 +2799,7 @@
 			 * It looks like iChat sometimes sends typing notification
 			 * with type1=0x0001 and type2=0x000f.  Not sure why.
 			 */
-			gaim_debug_info("oscar", "Received unknown typing notification message from %s.  Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2);
+			purple_debug_info("oscar", "Received unknown typing notification message from %s.  Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2);
 		} break;
 	}
 
@@ -2810,7 +2810,7 @@
  * We get this error when there was an error in the locate family.  This
  * happens when you request info of someone who is offline.
  */
-static int gaim_parse_locerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_locerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	gchar *buf;
 	va_list ap;
 	guint16 reason;
@@ -2825,20 +2825,20 @@
 		return 1;
 
 	buf = g_strdup_printf(_("User information not available: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
-	if (!gaim_conv_present_error(destn, gaim_connection_get_account((GaimConnection*)od->gc), buf)) {
+	if (!purple_conv_present_error(destn, purple_connection_get_account((PurpleConnection*)od->gc), buf)) {
 		g_free(buf);
 		buf = g_strdup_printf(_("User information for %s unavailable:"), destn);
-		gaim_notify_error(od->gc, NULL, buf, (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
+		purple_notify_error(od->gc, NULL, buf, (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
 	}
 	g_free(buf);
 
 	return 1;
 }
 
-static int gaim_parse_userinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
-	GaimNotifyUserInfo *user_info;
+static int purple_parse_userinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
+	PurpleNotifyUserInfo *user_info;
 	gchar *tmp = NULL, *info_utf8 = NULL, *away_utf8 = NULL;
 	va_list ap;
 	aim_userinfo_t *userinfo;
@@ -2847,21 +2847,21 @@
 	userinfo = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
 
-	user_info = gaim_notify_user_info_new();
-	gaim_notify_user_info_add_pair(user_info, _("Screen Name"), userinfo->sn);
+	user_info = purple_notify_user_info_new();
+	purple_notify_user_info_add_pair(user_info, _("Screen Name"), userinfo->sn);
 
 	tmp = g_strdup_printf("%d", (int)((userinfo->warnlevel/10.0) + 0.5));
-	gaim_notify_user_info_add_pair(user_info, _("Warning Level"), tmp);
+	purple_notify_user_info_add_pair(user_info, _("Warning Level"), tmp);
 	g_free(tmp);
 
 	if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) {
 		time_t t = userinfo->onlinesince - od->timeoffset;
-		oscar_user_info_add_pair(user_info, _("Online Since"), gaim_date_format_full(localtime(&t)));
+		oscar_user_info_add_pair(user_info, _("Online Since"), purple_date_format_full(localtime(&t)));
 	}
 
 	if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) {
 		time_t t = userinfo->membersince - od->timeoffset;
-		oscar_user_info_add_pair(user_info, _("Member Since"), gaim_date_format_full(localtime(&t)));
+		oscar_user_info_add_pair(user_info, _("Member Since"), purple_date_format_full(localtime(&t)));
 	}
 
 	if (userinfo->capabilities != 0) {
@@ -2871,7 +2871,7 @@
 	}
 
 	if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) {
-		tmp = gaim_str_seconds_to_string(userinfo->idletime*60);
+		tmp = purple_str_seconds_to_string(userinfo->idletime*60);
 		oscar_user_info_add_pair(user_info, _("Idle"), tmp);
 		g_free(tmp);
 	}
@@ -2894,8 +2894,8 @@
 		away_utf8 = oscar_encoding_to_utf8(tmp, userinfo->away, userinfo->away_len);
 		g_free(tmp);
 		if (away_utf8 != NULL) {
-			tmp = gaim_str_sub_away_formatters(away_utf8, gaim_account_get_username(account));
-			gaim_notify_user_info_add_section_break(user_info);
+			tmp = purple_str_sub_away_formatters(away_utf8, purple_account_get_username(account));
+			purple_notify_user_info_add_section_break(user_info);
 			oscar_user_info_add_pair(user_info, NULL, tmp);
 			g_free(tmp);
 			g_free(away_utf8);
@@ -2908,26 +2908,26 @@
 		info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len);
 		g_free(tmp);
 		if (info_utf8 != NULL) {
-			tmp = gaim_str_sub_away_formatters(info_utf8, gaim_account_get_username(account));
-			gaim_notify_user_info_add_section_break(user_info);
+			tmp = purple_str_sub_away_formatters(info_utf8, purple_account_get_username(account));
+			purple_notify_user_info_add_section_break(user_info);
 			oscar_user_info_add_pair(user_info, _("Profile"), tmp);
 			g_free(tmp);
 			g_free(info_utf8);
 		}
 	}
 
-	gaim_notify_userinfo(gc, userinfo->sn, user_info, NULL, NULL);
-	gaim_notify_user_info_destroy(user_info);
+	purple_notify_userinfo(gc, userinfo->sn, user_info, NULL, NULL);
+	purple_notify_user_info_destroy(user_info);
 
 	return 1;
 }
 
-static int gaim_got_infoblock(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_got_infoblock(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
-	GaimBuddy *b;
-	GaimPresence *presence;
-	GaimStatus *status;
+	PurpleConnection *gc = od->gc;
+	PurpleBuddy *b;
+	PurplePresence *presence;
+	PurpleStatus *status;
 	gchar *message = NULL;
 
 	va_list ap;
@@ -2937,42 +2937,42 @@
 	userinfo = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
 
-	b = gaim_find_buddy(gaim_connection_get_account(gc), userinfo->sn);
+	b = purple_find_buddy(purple_connection_get_account(gc), userinfo->sn);
 	if (b == NULL)
 		return 1;
 
 	if (!aim_sn_is_icq(userinfo->sn))
 	{
-		if (strcmp(gaim_buddy_get_name(b), userinfo->sn))
-			serv_got_alias(gc, gaim_buddy_get_name(b), userinfo->sn);
+		if (strcmp(purple_buddy_get_name(b), userinfo->sn))
+			serv_got_alias(gc, purple_buddy_get_name(b), userinfo->sn);
 		else
-			serv_got_alias(gc, gaim_buddy_get_name(b), NULL);
-	}
-
-	presence = gaim_buddy_get_presence(b);
-	status = gaim_presence_get_active_status(presence);
-
-	if (!gaim_status_is_available(status) && gaim_status_is_online(status))
+			serv_got_alias(gc, purple_buddy_get_name(b), NULL);
+	}
+
+	presence = purple_buddy_get_presence(b);
+	status = purple_presence_get_active_status(presence);
+
+	if (!purple_status_is_available(status) && purple_status_is_online(status))
 	{
 		if ((userinfo->flags & AIM_FLAG_AWAY) &&
 			(userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) {
 			gchar *charset = oscar_encoding_extract(userinfo->away_encoding);
 			message = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len);
 			g_free(charset);
-			gaim_status_set_attr_string(status, "message", message);
+			purple_status_set_attr_string(status, "message", message);
 			g_free(message);
 		}
 		else
 			/* Set an empty message so that we know not to show "pending" */
-			gaim_status_set_attr_string(status, "message", "");
-
-		gaim_blist_update_buddy_status(b, status);
+			purple_status_set_attr_string(status, "message", "");
+
+		purple_blist_update_buddy_status(b, status);
 	}
 
 	return 1;
 }
 
-static int gaim_parse_motd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_parse_motd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
 	char *msg;
 	guint16 id;
@@ -2983,16 +2983,16 @@
 	msg = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_misc("oscar",
+	purple_debug_misc("oscar",
 			   "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id);
 	if (id < 4)
-		gaim_notify_warning(od->gc, NULL,
+		purple_notify_warning(od->gc, NULL,
 							_("Your AIM connection may be lost."), NULL);
 
 	return 1;
 }
 
-static int gaim_chatnav_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_chatnav_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	guint16 type;
 
@@ -3009,18 +3009,18 @@
 			exchangecount = va_arg(ap, int);
 			exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
 
-			gaim_debug_misc("oscar", "chat info: Chat Rights:\n");
-			gaim_debug_misc("oscar",
+			purple_debug_misc("oscar", "chat info: Chat Rights:\n");
+			purple_debug_misc("oscar",
 					   "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms);
-			gaim_debug_misc("oscar",
+			purple_debug_misc("oscar",
 					   "chat info: \tExchange List: (%d total)\n", exchangecount);
 			for (i = 0; i < exchangecount; i++)
-				gaim_debug_misc("oscar",
+				purple_debug_misc("oscar",
 						   "chat info: \t\t%hu    %s\n",
 						   exchanges[i].number, exchanges[i].name ? exchanges[i].name : "");
 			while (od->create_rooms) {
 				struct create_room *cr = od->create_rooms->data;
-				gaim_debug_info("oscar",
+				purple_debug_info("oscar",
 						   "creating room %s\n", cr->name);
 				aim_chatnav_createroom(od, conn, cr->name, cr->exchange);
 				g_free(cr->name);
@@ -3047,7 +3047,7 @@
 			name = va_arg(ap, char *);
 			ck = va_arg(ap, char *);
 
-			gaim_debug_misc("oscar",
+			purple_debug_misc("oscar",
 					"created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n",
 					fqcn, exchange, instance, flags, createtime,
 					maxmsglen, maxoccupancy, createperms, unknown,
@@ -3056,7 +3056,7 @@
 			}
 			break;
 		default:
-			gaim_debug_warning("oscar",
+			purple_debug_warning("oscar",
 					   "chatnav info: unknown type (%04hx)\n", type);
 			break;
 	}
@@ -3066,11 +3066,11 @@
 	return 1;
 }
 
-static int gaim_conv_chat_join(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_conv_chat_join(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	int count, i;
 	aim_userinfo_t *info;
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 
 	struct chat_connection *c = NULL;
 
@@ -3084,16 +3084,16 @@
 		return 1;
 
 	for (i = 0; i < count; i++)
-		gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL, GAIM_CBFLAGS_NONE, TRUE);
+		purple_conv_chat_add_user(PURPLE_CONV_CHAT(c->conv), info[i].sn, NULL, PURPLE_CBFLAGS_NONE, TRUE);
 
 	return 1;
 }
 
-static int gaim_conv_chat_leave(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_conv_chat_leave(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	int count, i;
 	aim_userinfo_t *info;
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 
 	struct chat_connection *c = NULL;
 
@@ -3107,12 +3107,12 @@
 		return 1;
 
 	for (i = 0; i < count; i++)
-		gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL);
+		purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c->conv), info[i].sn, NULL);
 
 	return 1;
 }
 
-static int gaim_conv_chat_info_update(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_conv_chat_info_update(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	aim_userinfo_t *userinfo;
 	struct aim_chat_roominfo *roominfo;
@@ -3121,7 +3121,7 @@
 	char *roomdesc;
 	guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
 	guint32 creationtime;
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn);
 
 	if (!ccon)
@@ -3141,7 +3141,7 @@
 	maxvisiblemsglen = (guint16)va_arg(ap, unsigned int);
 	va_end(ap);
 
-	gaim_debug_misc("oscar",
+	purple_debug_misc("oscar",
 			   "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n",
 			   maxmsglen, maxvisiblemsglen);
 
@@ -3151,8 +3151,8 @@
 	return 1;
 }
 
-static int gaim_conv_chat_incoming_msg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_conv_chat_incoming_msg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn);
 	gchar *utf8;
 	va_list ap;
@@ -3181,9 +3181,9 @@
 	return 1;
 }
 
-static int gaim_email_parseupdate(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_email_parseupdate(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 	struct aim_emailinfo *emailinfo;
 	int havenewmail;
 	char *alertitle, *alerturl;
@@ -3195,38 +3195,38 @@
 	alerturl  = va_arg(ap, char *);
 	va_end(ap);
 
-	if ((emailinfo != NULL) && gaim_account_get_check_mail(gc->account)) {
-		gchar *to = g_strdup_printf("%s%s%s", gaim_account_get_username(gaim_connection_get_account(gc)),
+	if ((emailinfo != NULL) && purple_account_get_check_mail(gc->account)) {
+		gchar *to = g_strdup_printf("%s%s%s", purple_account_get_username(purple_connection_get_account(gc)),
 									emailinfo->domain ? "@" : "",
 									emailinfo->domain ? emailinfo->domain : "");
 		if (emailinfo->unread && havenewmail)
-			gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL);
+			purple_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL);
 		g_free(to);
 	}
 
 	if (alertitle)
-		gaim_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : "");
+		purple_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : "");
 
 	return 1;
 }
 
-static int gaim_icon_error(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_icon_error(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	char *sn;
 
 	sn = od->requesticon->data;
-	gaim_debug_misc("oscar", "removing %s from hash table\n", sn);
+	purple_debug_misc("oscar", "removing %s from hash table\n", sn);
 	od->requesticon = g_slist_remove(od->requesticon, sn);
 	g_free(sn);
 
 	if (od->icontimer == 0)
-		od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc);
+		od->icontimer = purple_timeout_add(500, purple_icon_timerfunc, gc);
 
 	return 1;
 }
 
-static int gaim_icon_parseicon(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_icon_parseicon(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	GSList *cur;
 	va_list ap;
 	char *sn;
@@ -3248,13 +3248,13 @@
 	 */
 	if ((iconlen > 0) && (iconlen != 90)) {
 		char *b16;
-		GaimBuddy *b;
-		gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc),
+		PurpleBuddy *b;
+		purple_buddy_icons_set_for_user(purple_connection_get_account(gc),
 									  sn, icon, iconlen);
-		b16 = gaim_base16_encode(iconcsum, iconcsumlen);
-		b = gaim_find_buddy(gc->account, sn);
+		b16 = purple_base16_encode(iconcsum, iconcsumlen);
+		b = purple_find_buddy(gc->account, sn);
 		if ((b16 != NULL) && (b != NULL)) {
-			gaim_blist_node_set_string((GaimBlistNode*)b, "icon_checksum", b16);
+			purple_blist_node_set_string((PurpleBlistNode*)b, "icon_checksum", b16);
 			g_free(b16);
 		}
 	}
@@ -3271,13 +3271,13 @@
 	}
 
 	if (od->icontimer == 0)
-		od->icontimer = gaim_timeout_add(250, gaim_icon_timerfunc, gc);
+		od->icontimer = purple_timeout_add(250, purple_icon_timerfunc, gc);
 
 	return 1;
 }
 
-static gboolean gaim_icon_timerfunc(gpointer data) {
-	GaimConnection *gc = data;
+static gboolean purple_icon_timerfunc(gpointer data) {
+	PurpleConnection *gc = data;
 	OscarData *od = gc->proto_data;
 	aim_userinfo_t *userinfo;
 	FlapConnection *conn;
@@ -3295,7 +3295,7 @@
 
 	if (od->set_icon) {
 		struct stat st;
-		char *iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(gaim_connection_get_account(gc)));
+		char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc)));
 		if (iconfile == NULL) {
 			aim_ssi_delicon(od);
 		} else if (!g_stat(iconfile, &st)) {
@@ -3305,15 +3305,15 @@
 				/* XXX - Use g_file_get_contents()? */
 				fread(buf, 1, st.st_size, file);
 				fclose(file);
-				gaim_debug_info("oscar",
+				purple_debug_info("oscar",
 					   "Uploading icon to icon server\n");
 				aim_bart_upload(od, buf, st.st_size);
 			} else
-				gaim_debug_error("oscar",
+				purple_debug_error("oscar",
 					   "Can't open buddy icon file!\n");
 			g_free(buf);
 		} else {
-			gaim_debug_error("oscar",
+			purple_debug_error("oscar",
 				   "Can't stat buddy icon file!\n");
 		}
 		g_free(iconfile);
@@ -3321,7 +3321,7 @@
 	}
 
 	if (!od->requesticon) {
-		gaim_debug_misc("oscar",
+		purple_debug_misc("oscar",
 				   "no more icons to request\n");
 		return FALSE;
 	}
@@ -3336,7 +3336,7 @@
 		g_free(sn);
 	}
 
-	od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc);
+	od->icontimer = purple_timeout_add(100, purple_icon_timerfunc, gc);
 
 	return FALSE;
 }
@@ -3344,7 +3344,7 @@
 /*
  * Received in response to an IM sent with the AIM_IMFLAGS_ACK option.
  */
-static int gaim_parse_msgack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_msgack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	guint16 type;
 	char *sn;
@@ -3354,12 +3354,12 @@
 	sn = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_info("oscar", "Sent message to %s.\n", sn);
+	purple_debug_info("oscar", "Sent message to %s.\n", sn);
 
 	return 1;
 }
 
-static int gaim_parse_ratechange(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_ratechange(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	static const char *codes[5] = {
 		"invalid",
 		"change",
@@ -3383,7 +3383,7 @@
 	maxavg = va_arg(ap, guint32);
 	va_end(ap);
 
-	gaim_debug_misc("oscar",
+	purple_debug_misc("oscar",
 			   "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, "
 		     "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n",
 		     (code < 5) ? codes[code] : codes[0],
@@ -3395,7 +3395,7 @@
 
 	if (code == AIM_RATE_CODE_LIMIT)
 	{
-		gaim_notify_error(od->gc, NULL, _("Rate limiting error."),
+		purple_notify_error(od->gc, NULL, _("Rate limiting error."),
 						  _("The last action you attempted could not be "
 							"performed because you are over the rate limit. "
 							"Please wait 10 seconds and try again."));
@@ -3404,7 +3404,7 @@
 	return 1;
 }
 
-static int gaim_parse_evilnotify(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_evilnotify(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 #ifdef CRAZY_WARNING
 	va_list ap;
 	guint16 newevil;
@@ -3415,13 +3415,13 @@
 	userinfo = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
 
-	gaim_prpl_got_account_warning_level(account, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5);
+	purple_prpl_got_account_warning_level(account, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5);
 #endif
 
 	return 1;
 }
 
-static int gaim_selfinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_selfinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	int warning_level;
 	va_list ap;
 	aim_userinfo_t *info;
@@ -3440,14 +3440,14 @@
 	warning_level = info->warnlevel/10.0 + 0.5;
 
 #ifdef CRAZY_WARNING
-	gaim_presence_set_warning_level(presence, warning_level);
+	purple_presence_set_warning_level(presence, warning_level);
 #endif
 
 	return 1;
 }
 
-static int gaim_connerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_connerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	guint16 code;
 	char *msg;
@@ -3457,7 +3457,7 @@
 	msg = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_info("oscar", "Disconnected.  Code is 0x%04x and msg is %s\n",
+	purple_debug_info("oscar", "Disconnected.  Code is 0x%04x and msg is %s\n",
 					code, (msg != NULL ? msg : ""));
 
 	g_return_val_if_fail(fr       != NULL, 1);
@@ -3466,24 +3466,24 @@
 	if (conn->type == SNAC_FAMILY_LOCATE) {
 		if (code == 0x0001) {
 			gc->wants_to_die = TRUE;
-			gaim_connection_error(gc, _("You have signed on from another location."));
+			purple_connection_error(gc, _("You have signed on from another location."));
 		} else {
-			gaim_connection_error(gc, _("You have been signed off for an unknown reason."));
+			purple_connection_error(gc, _("You have been signed off for an unknown reason."));
 		}
 		od->killme = TRUE;
 	} else if (conn->type == SNAC_FAMILY_CHAT) {
 		struct chat_connection *cc;
-		GaimConversation *conv;
+		PurpleConversation *conv;
 
 		cc = find_oscar_chat_by_conn(gc, conn);
-		conv = gaim_find_chat(gc, cc->id);
+		conv = purple_find_chat(gc, cc->id);
 
 		if (conv != NULL)
 		{
 			gchar *buf;
 			buf = g_strdup_printf(_("You have been disconnected from chat "
 									"room %s."), cc->name);
-			gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL));
+			purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL));
 			g_free(buf);
 		}
 		oscar_chat_kill(gc, cc);
@@ -3492,7 +3492,7 @@
 	return 1;
 }
 
-static int gaim_icbm_param_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_icbm_param_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	struct aim_icbmparameters *params;
 	va_list ap;
 
@@ -3501,7 +3501,7 @@
 	va_end(ap);
 
 	/* XXX - evidently this crashes on solaris. i have no clue why
-	gaim_debug_misc("oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, "
+	purple_debug_misc("oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, "
 			"max sender evil = %f, max receiver evil = %f, min msg interval = %u\n",
 			params->maxchan, params->flags, params->maxmsglen,
 			((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0,
@@ -3518,10 +3518,10 @@
 	return 1;
 }
 
-static int gaim_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	va_list ap;
 	guint16 maxsiglen;
 
@@ -3529,19 +3529,19 @@
 	maxsiglen = (guint16) va_arg(ap, int);
 	va_end(ap);
 
-	gaim_debug_misc("oscar",
+	purple_debug_misc("oscar",
 			   "locate rights: max sig len = %d\n", maxsiglen);
 
 	od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen;
 
-	aim_locate_setcaps(od, gaim_caps);
+	aim_locate_setcaps(od, purple_caps);
 	oscar_set_info_and_status(account, TRUE, account->user_info, TRUE,
-							  gaim_account_get_active_status(account));
+							  purple_account_get_active_status(account));
 
 	return 1;
 }
 
-static int gaim_parse_buddyrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_buddyrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	guint16 maxbuddies, maxwatchers;
 
@@ -3550,7 +3550,7 @@
 	maxwatchers = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
-	gaim_debug_misc("oscar",
+	purple_debug_misc("oscar",
 			   "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers);
 
 	od->rights.maxbuddies = (guint)maxbuddies;
@@ -3559,10 +3559,10 @@
 	return 1;
 }
 
-static int gaim_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc;
-	GaimAccount *account;
-	GaimStatus *status;
+static int purple_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc;
+	PurpleAccount *account;
+	PurpleStatus *status;
 	const char *message, *itmsurl;
 	char *tmp;
 	va_list ap;
@@ -3570,39 +3570,39 @@
 
 	gc = od->gc;
 	od = (OscarData *)gc->proto_data;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
 	maxpermits = (guint16) va_arg(ap, unsigned int);
 	maxdenies = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
-	gaim_debug_misc("oscar",
+	purple_debug_misc("oscar",
 			   "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies);
 
 	od->rights.maxpermits = (guint)maxpermits;
 	od->rights.maxdenies = (guint)maxdenies;
 
-	gaim_connection_set_state(gc, GAIM_CONNECTED);
-
-	gaim_debug_info("oscar", "buddy list loaded\n");
+	purple_connection_set_state(gc, PURPLE_CONNECTED);
+
+	purple_debug_info("oscar", "buddy list loaded\n");
 
 	aim_clientready(od, conn);
 
-	if (gaim_account_get_user_info(account) != NULL)
-		serv_set_info(gc, gaim_account_get_user_info(account));
+	if (purple_account_get_user_info(account) != NULL)
+		serv_set_info(gc, purple_account_get_user_info(account));
 
 	if (!od->icq)
 		oscar_format_screenname(gc, account->username);
 
 	/* Set our available message based on the current status */
-	status = gaim_account_get_active_status(account);
-	if (gaim_status_is_available(status))
-		message = gaim_status_get_attr_string(status, "message");
+	status = purple_account_get_active_status(account);
+	if (purple_status_is_available(status))
+		message = purple_status_get_attr_string(status, "message");
 	else
 		message = NULL;
-	tmp = gaim_markup_strip_html(message);
-	itmsurl = gaim_status_get_attr_string(status, "itmsurl");
+	tmp = purple_markup_strip_html(message);
+	itmsurl = purple_status_get_attr_string(status, "itmsurl");
 	aim_srv_setextrainfo(od, FALSE, 0, TRUE, tmp, itmsurl);
 	g_free(tmp);
 
@@ -3612,8 +3612,8 @@
 		aim_icq_reqofflinemsgs(od);
 		oscar_set_extendedstatus(gc);
 		aim_icq_setsecurity(od,
-			gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION),
-			gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE));
+			purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION),
+			purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE));
 	}
 
 	aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV);
@@ -3633,7 +3633,7 @@
 	return 1;
 }
 
-static int gaim_offlinemsg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_offlinemsg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	struct aim_icq_offlinemsg *msg;
 	struct aim_incomingim_ch4_args args;
@@ -3643,33 +3643,33 @@
 	msg = va_arg(ap, struct aim_icq_offlinemsg *);
 	va_end(ap);
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "Received offline message.  Converting to channel 4 ICBM...\n");
 	args.uin = msg->sender;
 	args.type = msg->type;
 	args.flags = msg->flags;
 	args.msglen = msg->msglen;
 	args.msg = msg->msg;
-	t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
+	t = purple_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
 	incomingim_chan4(od, conn, NULL, &args, t);
 
 	return 1;
 }
 
-static int gaim_offlinemsgdone(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_offlinemsgdone(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
 	aim_icq_ackofflinemsgs(od);
 	return 1;
 }
 
-static int gaim_icqinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_icqinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc;
-	GaimAccount *account;
-	GaimBuddy *buddy;
+	PurpleConnection *gc;
+	PurpleAccount *account;
+	PurpleBuddy *buddy;
 	struct buddyinfo *bi;
 	gchar who[16];
-	GaimNotifyUserInfo *user_info;
+	PurpleNotifyUserInfo *user_info;
 	GString *tmp;
 	gchar *utf8;
 	gchar *buf;
@@ -3678,7 +3678,7 @@
 	struct aim_icq_info *info;
 
 	gc = od->gc;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
 	info = va_arg(ap, struct aim_icq_info *);
@@ -3687,16 +3687,16 @@
 	if (!info->uin)
 		return 0;
 
-	user_info = gaim_notify_user_info_new();
+	user_info = purple_notify_user_info_new();
 		
 	g_snprintf(who, sizeof(who), "%u", info->uin);
-	buddy = gaim_find_buddy(gaim_connection_get_account(gc), who);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), who);
 	if (buddy != NULL)
-		bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(buddy->account, buddy->name));
+		bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(buddy->account, buddy->name));
 	else
 		bi = NULL;
 
-	gaim_notify_user_info_add_pair(user_info, _("UIN"), who);
+	purple_notify_user_info_add_pair(user_info, _("UIN"), who);
 	oscar_user_info_convert_and_add(account, user_info, _("Nick"), info->nick);
 	if ((bi != NULL) && (bi->ipaddr != 0)) {
 		char *tstr =  g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
@@ -3704,14 +3704,14 @@
 						(bi->ipaddr & 0x00ff0000) >> 16,
 						(bi->ipaddr & 0x0000ff00) >> 8,
 						(bi->ipaddr & 0x000000ff));
-		gaim_notify_user_info_add_pair(user_info, _("IP Address"), tstr);
+		purple_notify_user_info_add_pair(user_info, _("IP Address"), tstr);
 		g_free(tstr);
 	}
 	oscar_user_info_convert_and_add(account, user_info, _("First Name"), info->first);
 	oscar_user_info_convert_and_add(account, user_info, _("Last Name"), info->last);
 	if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email))) {
 		buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8);
-		gaim_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
+		purple_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
 		g_free(buf);
 		g_free(utf8);
 	}
@@ -3720,7 +3720,7 @@
 		for (i = 0; i < info->numaddresses; i++) {
 			if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email2[i]))) {
 				buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8);
-				gaim_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
+				purple_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
 				g_free(buf);
 				g_free(utf8);
 			}
@@ -3729,7 +3729,7 @@
 	oscar_user_info_convert_and_add(account, user_info, _("Mobile Phone"), info->mobile);
 
 	if (info->gender != 0)
-		gaim_notify_user_info_add_pair(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male")));
+		purple_notify_user_info_add_pair(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male")));
 
 	if ((info->birthyear > 1900) && (info->birthmonth > 0) && (info->birthday > 0)) {
 		/* Initialize the struct properly or strftime() will crash
@@ -3746,23 +3746,23 @@
 		 * feel free to remove it.  --rlaager */
 		mktime(tm);
 
-		oscar_user_info_convert_and_add(account, user_info, _("Birthday"), gaim_date_format_short(tm));
+		oscar_user_info_convert_and_add(account, user_info, _("Birthday"), purple_date_format_short(tm));
 	}
 	if ((info->age > 0) && (info->age < 255)) {
 		char age[5];
 		snprintf(age, sizeof(age), "%hhd", info->age);
-		gaim_notify_user_info_add_pair(user_info,
+		purple_notify_user_info_add_pair(user_info,
 													_("Age"), age);
 	}
 	if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->personalwebpage))) {
 		buf = g_strdup_printf("<a href=\"%s\">%s</a>", utf8, utf8);
-		gaim_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf);
+		purple_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf);
 		g_free(buf);
 		g_free(utf8);
 	}
 	
 	oscar_user_info_convert_and_add(account, user_info, _("Additional Information"), info->info);
-	gaim_notify_user_info_add_section_break(user_info);
+	purple_notify_user_info_add_section_break(user_info);
 
 	if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
 		tmp = g_string_sized_new(100);
@@ -3771,8 +3771,8 @@
 		oscar_string_convert_and_append(account, tmp, "\n<br>", _("State"), info->homestate);
 		oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->homezip);
 		
-		gaim_notify_user_info_add_pair(user_info, _("Home Address"), tmp->str);
-		gaim_notify_user_info_add_section_break(user_info);
+		purple_notify_user_info_add_pair(user_info, _("Home Address"), tmp->str);
+		purple_notify_user_info_add_section_break(user_info);
 
 		g_string_free(tmp, TRUE);
 	}
@@ -3784,8 +3784,8 @@
 		oscar_string_convert_and_append(account, tmp, "\n<br>", _("State"), info->workstate);
 		oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->workzip);
 
-		gaim_notify_user_info_add_pair(user_info, _("Work Address"), tmp->str);
-		gaim_notify_user_info_add_section_break(user_info);
+		purple_notify_user_info_add_pair(user_info, _("Work Address"), tmp->str);
+		purple_notify_user_info_add_section_break(user_info);
 
 		g_string_free(tmp, TRUE);
 	}
@@ -3799,26 +3799,26 @@
 			g_string_append_printf(tmp, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Web Page"), utf8, utf8);
 			g_free(utf8);
 		}
-		gaim_notify_user_info_add_pair(user_info, _("Work Information"), tmp->str);
+		purple_notify_user_info_add_pair(user_info, _("Work Information"), tmp->str);
 		g_string_free(tmp, TRUE);
 	}
 
 	if (buddy != NULL)
-		alias = gaim_buddy_get_alias(buddy);
+		alias = purple_buddy_get_alias(buddy);
 	else
 		alias = who;
-	gaim_notify_userinfo(gc, who, user_info, NULL, NULL);
-	gaim_notify_user_info_destroy(user_info);
+	purple_notify_userinfo(gc, who, user_info, NULL, NULL);
+	purple_notify_user_info_destroy(user_info);
 
 	return 1;
 }
 
-static int gaim_icqalias(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_icqalias(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	PurpleConnection *gc = od->gc;
+	PurpleAccount *account = purple_connection_get_account(gc);
 	gchar who[16], *utf8;
-	GaimBuddy *b;
+	PurpleBuddy *b;
 	va_list ap;
 	struct aim_icq_info *info;
 
@@ -3829,8 +3829,8 @@
 	if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, info->nick))) {
 		g_snprintf(who, sizeof(who), "%u", info->uin);
 		serv_got_alias(gc, who, utf8);
-		if ((b = gaim_find_buddy(gc->account, who))) {
-			gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", utf8);
+		if ((b = purple_find_buddy(gc->account, who))) {
+			purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8);
 		}
 		g_free(utf8);
 	}
@@ -3838,9 +3838,9 @@
 	return 1;
 }
 
-static int gaim_popup(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_popup(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 	gchar *text;
 	va_list ap;
 	char *msg, *url;
@@ -3855,23 +3855,23 @@
 	va_end(ap);
 
 	text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url);
-	gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL);
+	purple_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL);
 	g_free(text);
 
 	return 1;
 }
 
-static void oscar_searchresults_add_buddy_cb(GaimConnection *gc, GList *row, void *user_data)
+static void oscar_searchresults_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data)
 {
-	gaim_blist_request_add_buddy(gaim_connection_get_account(gc),
+	purple_blist_request_add_buddy(purple_connection_get_account(gc),
 								 g_list_nth_data(row, 0), NULL, NULL);
 }
 
-static int gaim_parse_searchreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_parse_searchreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc = od->gc;
-	GaimNotifySearchResults *results;
-	GaimNotifySearchColumn *column;
+	PurpleConnection *gc = od->gc;
+	PurpleNotifySearchResults *results;
+	PurpleNotifySearchColumn *column;
 	gchar *secondary;
 	int i, num;
 	va_list ap;
@@ -3883,12 +3883,12 @@
 	SNs = va_arg(ap, char *);
 	va_end(ap);
 
-	results = gaim_notify_searchresults_new();
+	results = purple_notify_searchresults_new();
 
 	if (results == NULL) {
-		gaim_debug_error("oscar", "gaim_parse_searchreply: "
+		purple_debug_error("oscar", "purple_parse_searchreply: "
 						 "Unable to display the search results.\n");
-		gaim_notify_error(gc, NULL,
+		purple_notify_error(gc, NULL,
 						  _("Unable to display the search results."),
 						  NULL);
 		return 1;
@@ -3900,24 +3900,24 @@
 						 num),
 					email);
 
-	column = gaim_notify_searchresults_column_new(_("Screen name"));
-	gaim_notify_searchresults_column_add(results, column);
+	column = purple_notify_searchresults_column_new(_("Screen name"));
+	purple_notify_searchresults_column_add(results, column);
 
 	for (i = 0; i < num; i++) {
 		GList *row = NULL;
 		row = g_list_append(row, g_strdup(&SNs[i * (MAXSNLEN + 1)]));
-		gaim_notify_searchresults_row_add(results, row);
-	}
-	gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_ADD,
+		purple_notify_searchresults_row_add(results, row);
+	}
+	purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD,
 										 oscar_searchresults_add_buddy_cb);
-	gaim_notify_searchresults(gc, NULL, NULL, secondary, results, NULL, NULL);
+	purple_notify_searchresults(gc, NULL, NULL, secondary, results, NULL, NULL);
 
 	g_free(secondary);
 
 	return 1;
 }
 
-static int gaim_parse_searcherror(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_parse_searcherror(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
 	char *email;
 	char *buf;
@@ -3927,14 +3927,14 @@
 	va_end(ap);
 
 	buf = g_strdup_printf(_("No results found for e-mail address %s"), email);
-	gaim_notify_error(od->gc, NULL, buf, NULL);
+	purple_notify_error(od->gc, NULL, buf, NULL);
 	g_free(buf);
 
 	return 1;
 }
 
-static int gaim_account_confirm(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_account_confirm(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	guint16 status;
 	va_list ap;
 	char msg[256];
@@ -3943,20 +3943,20 @@
 	status = (guint16) va_arg(ap, unsigned int); /* status code of confirmation request */
 	va_end(ap);
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "account confirmation returned status 0x%04x (%s)\n", status,
 			status ? "unknown" : "e-mail sent");
 	if (!status) {
 		g_snprintf(msg, sizeof(msg), _("You should receive an e-mail asking to confirm %s."),
-				gaim_account_get_username(gaim_connection_get_account(gc)));
-		gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg);
+				purple_account_get_username(purple_connection_get_account(gc)));
+		purple_notify_info(gc, NULL, _("Account Confirmation Requested"), msg);
 	}
 
 	return 1;
 }
 
-static int gaim_info_change(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_info_change(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	guint16 perms, err;
 	char *url, *sn, *email;
@@ -3971,7 +3971,7 @@
 	email = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_misc("oscar",
+	purple_debug_misc("oscar",
 					"account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n",
 					change ? "change" : "request", perms, err,
 					(url != NULL) ? url : "(null)",
@@ -4004,7 +4004,7 @@
 				dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err);
 			} break;
 		}
-		gaim_notify_error(gc, NULL, dialog_top, dialog_msg);
+		purple_notify_error(gc, NULL, dialog_top, dialog_msg);
 		g_free(dialog_top);
 		g_free(dialog_msg);
 		return 1;
@@ -4012,8 +4012,8 @@
 
 	if (email != NULL) {
 		char *dialog_msg = g_strdup_printf(_("The e-mail address for %s is %s"),
-						   gaim_account_get_username(gaim_connection_get_account(gc)), email);
-		gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg);
+						   purple_account_get_username(purple_connection_get_account(gc)), email);
+		purple_notify_info(gc, NULL, _("Account Info"), dialog_msg);
 		g_free(dialog_msg);
 	}
 
@@ -4021,7 +4021,7 @@
 }
 
 void
-oscar_keepalive(GaimConnection *gc)
+oscar_keepalive(PurpleConnection *gc)
 {
 	OscarData *od;
 	FlapConnection *conn;
@@ -4033,7 +4033,7 @@
 }
 
 unsigned int
-oscar_send_typing(GaimConnection *gc, const char *name, GaimTypingState state)
+oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state)
 {
 	OscarData *od;
 	PeerConnection *conn;
@@ -4050,11 +4050,11 @@
 		GSList *list;
 		for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next);
 		if (!list) {
-			struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name));
+			struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name));
 			if (bi && bi->typingnot) {
-				if (state == GAIM_TYPING)
+				if (state == PURPLE_TYPING)
 					aim_im_sendmtn(od, 0x0001, name, 0x0002);
-				else if (state == GAIM_TYPED)
+				else if (state == PURPLE_TYPED)
 					aim_im_sendmtn(od, 0x0001, name, 0x0001);
 				else
 					aim_im_sendmtn(od, 0x0001, name, 0x0000);
@@ -4066,7 +4066,7 @@
 
 /* TODO: Move this into odc.c! */
 static void
-gaim_odc_send_im(PeerConnection *conn, const char *message, GaimMessageFlags imflags)
+purple_odc_send_im(PeerConnection *conn, const char *message, PurpleMessageFlags imflags)
 {
 	GString *msg;
 	GString *data;
@@ -4082,9 +4082,9 @@
 	last = message;
 
 	/* for each valid IMG tag... */
-	while (last && *last && gaim_markup_find_tag("img", last, &start, &end, &attribs))
+	while (last && *last && purple_markup_find_tag("img", last, &start, &end, &attribs))
 	{
-		GaimStoredImage *image = NULL;
+		PurpleStoredImage *image = NULL;
 		const char *id;
 
 		if (start - last) {
@@ -4093,12 +4093,12 @@
 
 		id = g_datalist_get_data(&attribs, "id");
 
-		/* ... if it refers to a valid gaim image ... */
-		if (id && (image = gaim_imgstore_get(atoi(id)))) {
+		/* ... if it refers to a valid purple image ... */
+		if (id && (image = purple_imgstore_get(atoi(id)))) {
 			/* ... append the message from start to the tag ... */
-			unsigned long size = gaim_imgstore_get_size(image);
-			const char *filename = gaim_imgstore_get_filename(image);
-			gpointer imgdata = gaim_imgstore_get_data(image);
+			unsigned long size = purple_imgstore_get_size(image);
+			const char *filename = purple_imgstore_get_filename(image);
+			gpointer imgdata = purple_imgstore_get_data(image);
 
 			oscar_id++;
 
@@ -4133,7 +4133,7 @@
 	g_string_append(msg, "</BODY></HTML>");
 
 	/* Convert the message to a good encoding */
-	gaim_plugin_oscar_convert_to_best_encoding(conn->od->gc,
+	purple_plugin_oscar_convert_to_best_encoding(conn->od->gc,
 			conn->sn, msg->str, &tmp, &tmplen, &charset, &charsubset);
 	g_string_free(msg, TRUE);
 	msg = g_string_new_len(tmp, tmplen);
@@ -4146,27 +4146,27 @@
 	g_string_free(data, TRUE);
 
 	peer_odc_send_im(conn, msg->str, msg->len, charset,
-			imflags & GAIM_MESSAGE_AUTO_RESP);
+			imflags & PURPLE_MESSAGE_AUTO_RESP);
 	g_string_free(msg, TRUE);
 }
 
 int
-oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimMessageFlags imflags)
+oscar_send_im(PurpleConnection *gc, const char *name, const char *message, PurpleMessageFlags imflags)
 {
 	OscarData *od;
-	GaimAccount *account;
+	PurpleAccount *account;
 	PeerConnection *conn;
 	int ret;
 	char *iconfile;
 	char *tmp1, *tmp2;
 
 	od = (OscarData *)gc->proto_data;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 	ret = 0;
-	iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(account));
-
-	if (imflags & GAIM_MESSAGE_AUTO_RESP)
-		tmp1 = gaim_str_sub_away_formatters(message, name);
+	iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account));
+
+	if (imflags & PURPLE_MESSAGE_AUTO_RESP)
+		tmp1 = purple_str_sub_away_formatters(message, name);
 	else
 		tmp1 = g_strdup(message);
 
@@ -4174,26 +4174,26 @@
 	if ((conn != NULL) && (conn->ready))
 	{
 		/* If we're directly connected, send a direct IM */
-		gaim_odc_send_im(conn, tmp1, imflags);
+		purple_odc_send_im(conn, tmp1, imflags);
 	} else {
 		struct buddyinfo *bi;
 		struct aim_sendimext_args args;
 		struct stat st;
 		gsize len;
-		GaimConversation *conv;
-
-		conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account);
+		PurpleConversation *conv;
+
+		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account);
 
 		if (strstr(tmp1, "<IMG "))
-			gaim_conversation_write(conv, "",
+			purple_conversation_write(conv, "",
 			                        _("Your IM Image was not sent. "
 			                        "You must be Direct Connected to send IM Images."),
-			                        GAIM_MESSAGE_ERROR, time(NULL));
-
-		bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, name));
+			                        PURPLE_MESSAGE_ERROR, time(NULL));
+
+		bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, name));
 		if (!bi) {
 			bi = g_new0(struct buddyinfo, 1);
-			g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, name)), bi);
+			g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, name)), bi);
 		}
 
 		args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES;
@@ -4205,8 +4205,8 @@
 			   encoded" (and instead, assumes them to be UTF-8).
 			   For more details, see SF issue 1179452.
 			*/
-			GaimBuddy *buddy = gaim_find_buddy(gc->account, name);
-			if (buddy && GAIM_BUDDY_IS_ONLINE(buddy)) {
+			PurpleBuddy *buddy = purple_find_buddy(gc->account, name);
+			if (buddy && PURPLE_BUDDY_IS_ONLINE(buddy)) {
 				args.features = features_icq;
 				args.featureslen = sizeof(features_icq);
 			} else {
@@ -4218,12 +4218,12 @@
 			args.features = features_aim;
 			args.featureslen = sizeof(features_aim);
 
-			if (imflags & GAIM_MESSAGE_AUTO_RESP)
+			if (imflags & PURPLE_MESSAGE_AUTO_RESP)
 				args.flags |= AIM_IMFLAGS_AWAY;
 		}
 
 		if (bi->ico_need) {
-			gaim_debug_info("oscar",
+			purple_debug_info("oscar",
 					   "Sending buddy icon request with message\n");
 			args.flags |= AIM_IMFLAGS_BUDDYREQ;
 			bi->ico_need = FALSE;
@@ -4254,7 +4254,7 @@
 				 * the icon.  We should fix that.
 				 */
 				if (!bi->ico_informed) {
-					gaim_debug_info("oscar",
+					purple_debug_info("oscar",
 							   "Claiming to have a buddy icon\n");
 					args.flags |= AIM_IMFLAGS_HASICON;
 					bi->ico_me_len = args.iconlen;
@@ -4275,11 +4275,11 @@
 		 */
 		if (aim_sn_is_sms(name)) {
 			/* Messaging an SMS (mobile) user */
-			tmp2 = gaim_unescape_html(tmp1);
-		} else if (aim_sn_is_icq(gaim_account_get_username(account))) {
+			tmp2 = purple_unescape_html(tmp1);
+		} else if (aim_sn_is_icq(purple_account_get_username(account))) {
 			if (aim_sn_is_icq(name))
 				/* From ICQ to ICQ */
-				tmp2 = gaim_unescape_html(tmp1);
+				tmp2 = purple_unescape_html(tmp1);
 			else
 				/* From ICQ to AIM */
 				tmp2 = g_strdup(tmp1);
@@ -4291,8 +4291,8 @@
 		tmp1 = tmp2;
 		len = strlen(tmp1);
 
-		gaim_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset);
-		gaim_debug_info("oscar", "Sending IM, charset=0x%04hx, charsubset=0x%04hx, length=%d\n",
+		purple_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset);
+		purple_debug_info("oscar", "Sending IM, charset=0x%04hx, charsubset=0x%04hx, length=%d\n",
 						args.charset, args.charsubset, args.msglen);
 		ret = aim_im_sendch1_ext(od, &args);
 		g_free((char *)args.msg);
@@ -4311,7 +4311,7 @@
  * everyone, and can request ICQ info from ICQ users, and
  * AIM users can only request AIM info.
  */
-void oscar_get_info(GaimConnection *gc, const char *name) {
+void oscar_get_info(PurpleConnection *gc, const char *name) {
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	if (od->icq && aim_sn_is_icq(name))
@@ -4321,7 +4321,7 @@
 }
 
 #if 0
-static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last,
+static void oscar_set_dir(PurpleConnection *gc, const char *first, const char *middle, const char *last,
 			  const char *maiden, const char *city, const char *state, const char *country, int web) {
 	/* XXX - some of these things are wrong, but i'm lazy */
 	OscarData *od = (OscarData *)gc->proto_data;
@@ -4330,13 +4330,13 @@
 }
 #endif
 
-void oscar_set_idle(GaimConnection *gc, int time) {
+void oscar_set_idle(PurpleConnection *gc, int time) {
 	OscarData *od = (OscarData *)gc->proto_data;
 	aim_srv_setidle(od, time);
 }
 
 static
-gchar *gaim_prpl_oscar_convert_to_infotext(const gchar *str, gsize *ret_len, char **encoding)
+gchar *purple_prpl_oscar_convert_to_infotext(const gchar *str, gsize *ret_len, char **encoding)
 {
 	int charset = 0;
 	char *encoded = NULL;
@@ -4358,32 +4358,32 @@
 }
 
 void
-oscar_set_info(GaimConnection *gc, const char *rawinfo)
+oscar_set_info(PurpleConnection *gc, const char *rawinfo)
 {
-	GaimAccount *account;
-	GaimStatus *status;
-
-	account = gaim_connection_get_account(gc);
-	status = gaim_account_get_active_status(account);
+	PurpleAccount *account;
+	PurpleStatus *status;
+
+	account = purple_connection_get_account(gc);
+	status = purple_account_get_active_status(account);
 	oscar_set_info_and_status(account, TRUE, rawinfo, FALSE, status);
 }
 
 static void
-oscar_set_extendedstatus(GaimConnection *gc)
+oscar_set_extendedstatus(PurpleConnection *gc)
 {
 	OscarData *od;
-	GaimAccount *account;
-	GaimStatus *status;
+	PurpleAccount *account;
+	PurpleStatus *status;
 	const gchar *status_id;
 	guint32 data = 0x00000000;
 
 	od = gc->proto_data;
-	account = gaim_connection_get_account(gc);
-	status = gaim_account_get_active_status(account);
-	status_id = gaim_status_get_id(status);
+	account = purple_connection_get_account(gc);
+	status = purple_account_get_active_status(account);
+	status_id = purple_status_get_id(status);
 
 	data |= AIM_ICQ_STATE_HIDEIP;
-	if (gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE))
+	if (purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE))
 		data |= AIM_ICQ_STATE_WEBAWARE;
 
 	if (!strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) || !strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE))
@@ -4407,14 +4407,14 @@
 }
 
 static void
-oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo,
-						  gboolean setstatus, GaimStatus *status)
+oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo,
+						  gboolean setstatus, PurpleStatus *status)
 {
-	GaimConnection *gc = gaim_account_get_connection(account);
+	PurpleConnection *gc = purple_account_get_connection(account);
 	OscarData *od = gc->proto_data;
-	GaimPresence *presence;
-	GaimStatusType *status_type;
-	GaimStatusPrimitive primitive;
+	PurplePresence *presence;
+	PurpleStatusType *status_type;
+	PurpleStatusPrimitive primitive;
 	gboolean invisible;
 
 	char *htmlinfo;
@@ -4427,10 +4427,10 @@
 	char *away = NULL;
 	gsize awaylen = 0;
 
-	status_type = gaim_status_get_type(status);
-	primitive = gaim_status_type_get_primitive(status_type);
-	presence = gaim_account_get_presence(account);
-	invisible = gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_INVISIBLE);
+	status_type = purple_status_get_type(status);
+	primitive = purple_status_type_get_primitive(status_type);
+	presence = purple_account_get_presence(account);
+	invisible = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE);
 
 	if (!setinfo)
 	{
@@ -4438,7 +4438,7 @@
 	}
 	else if (od->rights.maxsiglen == 0)
 	{
-		gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."),
+		purple_notify_warning(gc, NULL, _("Unable to set AIM profile."),
 							_("You have probably requested to set your "
 							  "profile before the login procedure completed.  "
 							  "Your profile remains unset; try setting it "
@@ -4446,8 +4446,8 @@
 	}
 	else if (rawinfo != NULL)
 	{
-		htmlinfo = gaim_strdup_withhtml(rawinfo);
-		info = gaim_prpl_oscar_convert_to_infotext(htmlinfo, &infolen, &info_encoding);
+		htmlinfo = purple_strdup_withhtml(rawinfo);
+		info = purple_prpl_oscar_convert_to_infotext(htmlinfo, &infolen, &info_encoding);
 		g_free(htmlinfo);
 
 		if (infolen > od->rights.maxsiglen)
@@ -4458,7 +4458,7 @@
 									 "The maximum profile length of %d bytes "
 									 "has been exceeded.  It has been truncated it for you.",
 									 od->rights.maxsiglen), od->rights.maxsiglen);
-			gaim_notify_warning(gc, NULL, _("Profile too long."), errstr);
+			purple_notify_warning(gc, NULL, _("Profile too long."), errstr);
 			g_free(errstr);
 		}
 	}
@@ -4467,15 +4467,15 @@
 	{
 		/* Do nothing! */
 	}
-	else if (primitive == GAIM_STATUS_AVAILABLE)
+	else if (primitive == PURPLE_STATUS_AVAILABLE)
 	{
 		const char *status_html, *itmsurl;
 		char *status_text = NULL;
 
-		status_html = gaim_status_get_attr_string(status, "message");
+		status_html = purple_status_get_attr_string(status, "message");
 		if (status_html != NULL)
 		{
-			status_text = gaim_markup_strip_html(status_html);
+			status_text = purple_markup_strip_html(status_html);
 			/* If the status_text is longer than 60 character then truncate it */
 			if (strlen(status_text) > 60)
 			{
@@ -4483,7 +4483,7 @@
 				strcpy(tmp, "...");
 			}
 		}
-		itmsurl = gaim_status_get_attr_string(status, "itmsurl");
+		itmsurl = purple_status_get_attr_string(status, "itmsurl");
 
 		aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl);
 		g_free(status_text);
@@ -4491,13 +4491,13 @@
 		/* This is needed for us to un-set any previous away message. */
 		away = g_strdup("");
 	}
-	else if ((primitive == GAIM_STATUS_AWAY) ||
-			 (primitive == GAIM_STATUS_EXTENDED_AWAY))
+	else if ((primitive == PURPLE_STATUS_AWAY) ||
+			 (primitive == PURPLE_STATUS_EXTENDED_AWAY))
 	{
-		htmlaway = gaim_status_get_attr_string(status, "message");
+		htmlaway = purple_status_get_attr_string(status, "message");
 		if ((htmlaway == NULL) || (*htmlaway == '\0'))
 			htmlaway = _("Away");
-		away = gaim_prpl_oscar_convert_to_infotext(htmlaway, &awaylen, &away_encoding);
+		away = purple_prpl_oscar_convert_to_infotext(htmlaway, &awaylen, &away_encoding);
 
 		if (awaylen > od->rights.maxawaymsglen)
 		{
@@ -4508,7 +4508,7 @@
 									 "The maximum away message length of %d bytes "
 									 "has been exceeded.  It has been truncated for you.",
 									 od->rights.maxawaymsglen), od->rights.maxawaymsglen);
-			gaim_notify_warning(gc, NULL, _("Away message too long."), errstr);
+			purple_notify_warning(gc, NULL, _("Away message too long."), errstr);
 			g_free(errstr);
 		}
 	}
@@ -4523,9 +4523,9 @@
 }
 
 static void
-oscar_set_status_icq(GaimAccount *account, GaimStatus *status)
+oscar_set_status_icq(PurpleAccount *account, PurpleStatus *status)
 {
-	GaimConnection *gc = gaim_account_get_connection(account);
+	PurpleConnection *gc = purple_account_get_connection(account);
 	OscarData *od = NULL;
 
 	if (gc)
@@ -4533,10 +4533,10 @@
 	if (!od)
 		return;
 
-	if (gaim_status_type_get_primitive(gaim_status_get_type(status)) == GAIM_STATUS_INVISIBLE)
-		account->perm_deny = GAIM_PRIVACY_ALLOW_USERS;
+	if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_INVISIBLE)
+		account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
 	else
-		account->perm_deny = GAIM_PRIVACY_DENY_USERS;
+		account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
 
 	if ((od->ssi.received_data) && (aim_ssi_getpermdeny(od->ssi.local) != account->perm_deny))
 		aim_ssi_setpermdeny(od, account->perm_deny, 0xffffffff);
@@ -4545,53 +4545,53 @@
 }
 
 void
-oscar_set_status(GaimAccount *account, GaimStatus *status)
+oscar_set_status(PurpleAccount *account, PurpleStatus *status)
 {
-	gaim_debug_info("oscar", "Set status to %s\n", gaim_status_get_name(status));
-
-	if (!gaim_status_is_active(status))
+	purple_debug_info("oscar", "Set status to %s\n", purple_status_get_name(status));
+
+	if (!purple_status_is_active(status))
 		return;
 
-	if (!gaim_account_is_connected(account))
+	if (!purple_account_is_connected(account))
 		return;
 
 	/* Set the AIM-style away message for both AIM and ICQ accounts */
 	oscar_set_info_and_status(account, FALSE, NULL, TRUE, status);
 
 	/* Set the ICQ status for ICQ accounts only */
-	if (aim_sn_is_icq(gaim_account_get_username(account)))
+	if (aim_sn_is_icq(purple_account_get_username(account)))
 		oscar_set_status_icq(account, status);
 }
 
 #ifdef CRAZY_WARN
 void
-oscar_warn(GaimConnection *gc, const char *name, gboolean anonymous) {
+oscar_warn(PurpleConnection *gc, const char *name, gboolean anonymous) {
 	OscarData *od = (OscarData *)gc->proto_data;
 	aim_im_warn(od, od->conn, name, anonymous ? AIM_WARN_ANON : 0);
 }
 #endif
 
 void
-oscar_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {
+oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	if (!aim_snvalid(buddy->name)) {
 		gchar *buf;
 		buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid.  Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name);
-		if (!gaim_conv_present_error(buddy->name, gaim_connection_get_account(gc), buf))
-			gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
+		if (!purple_conv_present_error(buddy->name, purple_connection_get_account(gc), buf))
+			purple_notify_error(gc, NULL, _("Unable To Add"), buf);
 		g_free(buf);
 
 		/* Remove from local list */
-		gaim_blist_remove_buddy(buddy);
+		purple_blist_remove_buddy(buddy);
 
 		return;
 	}
 
 	if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) {
-		gaim_debug_info("oscar",
+		purple_debug_info("oscar",
 				   "ssi: adding buddy %s to group %s\n", buddy->name, group->name);
-		aim_ssi_addbuddy(od, buddy->name, group->name, gaim_buddy_get_alias_only(buddy), NULL, NULL, 0);
+		aim_ssi_addbuddy(od, buddy->name, group->name, purple_buddy_get_alias_only(buddy), NULL, NULL, 0);
 	}
 
 	/* XXX - Should this be done from AIM accounts, as well? */
@@ -4599,31 +4599,31 @@
 		aim_icq_getalias(od, buddy->name);
 }
 
-void oscar_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {
+void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	if (od->ssi.received_data) {
-		gaim_debug_info("oscar",
+		purple_debug_info("oscar",
 				   "ssi: deleting buddy %s from group %s\n", buddy->name, group->name);
 		aim_ssi_delbuddy(od, buddy->name, group->name);
 	}
 }
 
-void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) {
+void oscar_move_buddy(PurpleConnection *gc, const char *name, const char *old_group, const char *new_group) {
 	OscarData *od = (OscarData *)gc->proto_data;
 	if (od->ssi.received_data && strcmp(old_group, new_group)) {
-		gaim_debug_info("oscar",
+		purple_debug_info("oscar",
 				   "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group);
 		aim_ssi_movebuddy(od, old_group, new_group, name);
 	}
 }
 
-void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) {
+void oscar_alias_buddy(PurpleConnection *gc, const char *name, const char *alias) {
 	OscarData *od = (OscarData *)gc->proto_data;
 	if (od->ssi.received_data) {
 		char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name);
 		if (gname) {
-			gaim_debug_info("oscar",
+			purple_debug_info("oscar",
 					   "ssi: changing the alias for buddy %s to %s\n", name, alias ? alias : "(none)");
 			aim_ssi_aliasbuddy(od, gname, name, alias);
 		}
@@ -4633,37 +4633,37 @@
 /*
  * FYI, the OSCAR SSI code removes empty groups automatically.
  */
-void oscar_rename_group(GaimConnection *gc, const char *old_name, GaimGroup *group, GList *moved_buddies) {
+void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) {
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	if (od->ssi.received_data) {
 		if (aim_ssi_itemlist_finditem(od->ssi.local, group->name, NULL, AIM_SSI_TYPE_GROUP)) {
 			GList *cur, *groups = NULL;
-			GaimAccount *account = gaim_connection_get_account(gc);
+			PurpleAccount *account = purple_connection_get_account(gc);
 
 			/* Make a list of what the groups each buddy is in */
 			for (cur = moved_buddies; cur != NULL; cur = cur->next) {
-				GaimBlistNode *node = cur->data;
-				/* node is GaimBuddy, parent is a GaimContact.
+				PurpleBlistNode *node = cur->data;
+				/* node is PurpleBuddy, parent is a PurpleContact.
 				 * We must go two levels up to get the Group */
 				groups = g_list_append(groups,
 						node->parent->parent);
 			}
 
-			gaim_account_remove_buddies(account, moved_buddies, groups);
-			gaim_account_add_buddies(account, moved_buddies);
+			purple_account_remove_buddies(account, moved_buddies, groups);
+			purple_account_add_buddies(account, moved_buddies);
 			g_list_free(groups);
-			gaim_debug_info("oscar",
+			purple_debug_info("oscar",
 					   "ssi: moved all buddies from group %s to %s\n", old_name, group->name);
 		} else {
 			aim_ssi_rename_group(od, old_name, group->name);
-			gaim_debug_info("oscar",
+			purple_debug_info("oscar",
 					   "ssi: renamed group %s to %s\n", old_name, group->name);
 		}
 	}
 }
 
-static gboolean gaim_ssi_rerequestdata(gpointer data) {
+static gboolean purple_ssi_rerequestdata(gpointer data) {
 	OscarData *od = data;
 
 	aim_ssi_reqdata(od);
@@ -4671,8 +4671,8 @@
 	return TRUE;
 }
 
-static int gaim_ssi_parseerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_ssi_parseerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	guint16 reason;
 
@@ -4680,14 +4680,14 @@
 	reason = (guint16)va_arg(ap, unsigned int);
 	va_end(ap);
 
-	gaim_debug_error("oscar", "ssi: SNAC error %hu\n", reason);
+	purple_debug_error("oscar", "ssi: SNAC error %hu\n", reason);
 
 	if (reason == 0x0005) {
-		gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"),
+		purple_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"),
 						  _("The AIM servers were temporarily unable to send your buddy list.  Your buddy list is not lost, and will probably become available in a few hours."));
 		if (od->getblisttimer > 0)
-			gaim_timeout_remove(od->getblisttimer);
-		od->getblisttimer = gaim_timeout_add(30000, gaim_ssi_rerequestdata, od);
+			purple_timeout_remove(od->getblisttimer);
+		od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od);
 	}
 
 	oscar_set_extendedstatus(gc);
@@ -4695,13 +4695,13 @@
 	/* Activate SSI */
 	/* Sending the enable causes other people to be able to see you, and you to see them */
 	/* Make sure your privacy setting/invisibility is set how you want it before this! */
-	gaim_debug_info("oscar", "ssi: activating server-stored buddy list\n");
+	purple_debug_info("oscar", "ssi: activating server-stored buddy list\n");
 	aim_ssi_enable(od);
 
 	return 1;
 }
 
-static int gaim_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	int i;
 	va_list ap;
 	int numtypes;
@@ -4712,13 +4712,13 @@
 	maxitems = va_arg(ap, guint16 *);
 	va_end(ap);
 
-	gaim_debug_misc("oscar", "ssi rights:");
+	purple_debug_misc("oscar", "ssi rights:");
 
 	for (i=0; i<numtypes; i++)
-		gaim_debug_misc(NULL, " max type 0x%04x=%hd,",
+		purple_debug_misc(NULL, " max type 0x%04x=%hd,",
 				   i, maxitems[i]);
 
-	gaim_debug_misc(NULL, "\n");
+	purple_debug_misc(NULL, "\n");
 
 	if (numtypes >= 0)
 		od->rights.maxbuddies = maxitems[0];
@@ -4732,12 +4732,12 @@
 	return 1;
 }
 
-static int gaim_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
 {
-	GaimConnection *gc;
-	GaimAccount *account;
-	GaimGroup *g;
-	GaimBuddy *b;
+	PurpleConnection *gc;
+	PurpleAccount *account;
+	PurpleGroup *g;
+	PurpleBuddy *b;
 	struct aim_ssi_item *curitem;
 	guint32 tmp;
 	const char *icon_path, *cached_icon_path;
@@ -4747,7 +4747,7 @@
 
 	gc = od->gc;
 	od = gc->proto_data;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 
 	va_start(ap, fr);
 	fmtver = (guint16)va_arg(ap, int);
@@ -4757,14 +4757,14 @@
 
 	/* Don't attempt to re-request our buddy list later */
 	if (od->getblisttimer != 0)
-		gaim_timeout_remove(od->getblisttimer);
+		purple_timeout_remove(od->getblisttimer);
 	od->getblisttimer = 0;
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "ssi: syncing local list and server list\n");
 
 	if ((timestamp == 0) || (numitems == 0)) {
-		gaim_debug_info("oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing.  This probably means your buddy list is empty.", NULL);
+		purple_debug_info("oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing.  This probably means your buddy list is empty.", NULL);
 		return 1;
 	}
 
@@ -4772,28 +4772,28 @@
 	aim_ssi_cleanlist(od);
 
 	{ /* If not in server list then prune from local list */
-		GaimBlistNode *gnode, *cnode, *bnode;
-		GaimBuddyList *blist;
+		PurpleBlistNode *gnode, *cnode, *bnode;
+		PurpleBuddyList *blist;
 		GSList *cur, *next;
 
 		/* Buddies */
 		cur = NULL;
-		if ((blist = gaim_get_blist()) != NULL) {
+		if ((blist = purple_get_blist()) != NULL) {
 			for (gnode = blist->root; gnode; gnode = gnode->next) {
-				if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
+				if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
 					continue;
-				g = (GaimGroup *)gnode;
+				g = (PurpleGroup *)gnode;
 				for (cnode = gnode->child; cnode; cnode = cnode->next) {
-					if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
+					if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
 						continue;
 					for (bnode = cnode->child; bnode; bnode = bnode->next) {
-						if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
+						if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 							continue;
-						b = (GaimBuddy *)bnode;
+						b = (PurpleBuddy *)bnode;
 						if (b->account == gc->account) {
 							if (aim_ssi_itemlist_exists(od->ssi.local, b->name)) {
 								/* If the buddy is an ICQ user then load his nickname */
-								const char *servernick = gaim_blist_node_get_string((GaimBlistNode*)b, "servernick");
+								const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick");
 								char *alias;
 								if (servernick)
 									serv_got_alias(gc, b->name, servernick);
@@ -4804,7 +4804,7 @@
 									aim_ssi_aliasbuddy(od, g->name, b->name, b->alias);
 								g_free(alias);
 							} else {
-								gaim_debug_info("oscar",
+								purple_debug_info("oscar",
 										"ssi: removing buddy %s from local list\n", b->name);
 								/* We can't actually remove now because it will screw up our looping */
 								cur = g_slist_prepend(cur, b);
@@ -4818,7 +4818,7 @@
 		while (cur != NULL) {
 			b = cur->data;
 			cur = g_slist_remove(cur, b);
-			gaim_blist_remove_buddy(b);
+			purple_blist_remove_buddy(b);
 		}
 
 		/* Permit list */
@@ -4828,9 +4828,9 @@
 				cur = next;
 				next = next->next;
 				if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) {
-					gaim_debug_info("oscar",
+					purple_debug_info("oscar",
 							"ssi: removing permit %s from local list\n", (const char *)cur->data);
-					gaim_privacy_permit_remove(account, cur->data, TRUE);
+					purple_privacy_permit_remove(account, cur->data, TRUE);
 				}
 			}
 		}
@@ -4842,9 +4842,9 @@
 				cur = next;
 				next = next->next;
 				if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) {
-					gaim_debug_info("oscar",
+					purple_debug_info("oscar",
 							"ssi: removing deny %s from local list\n", (const char *)cur->data);
-					gaim_privacy_deny_remove(account, cur->data, TRUE);
+					purple_privacy_deny_remove(account, cur->data, TRUE);
 				}
 			}
 		}
@@ -4875,7 +4875,7 @@
 					else
 						alias_utf8 = NULL;
 
-					b = gaim_find_buddy(gc->account, curitem->name);
+					b = purple_find_buddy(gc->account, curitem->name);
 					/* Should gname be freed here? -- elb */
 					/* Not with the current code, but that might be cleaner -- med */
 					g_free(alias);
@@ -4886,22 +4886,22 @@
 							b->alias = g_strdup(alias_utf8);
 						}
 					} else {
-						b = gaim_buddy_new(gc->account, curitem->name, alias_utf8);
-
-						if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
-							g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
-							gaim_blist_add_group(g, NULL);
+						b = purple_buddy_new(gc->account, curitem->name, alias_utf8);
+
+						if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
+							g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
+							purple_blist_add_group(g, NULL);
 						}
 
-						gaim_debug_info("oscar",
+						purple_debug_info("oscar",
 								   "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans"));
-						gaim_blist_add_buddy(b, NULL, g, NULL);
+						purple_blist_add_buddy(b, NULL, g, NULL);
 					}
 					if (!aim_sncmp(curitem->name, account->username)) {
 						char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name);
 						if (comment != NULL)
 						{
-							gaim_check_comment(od, comment);
+							purple_check_comment(od, comment);
 							g_free(comment);
 						}
 					}
@@ -4920,9 +4920,9 @@
 					GSList *list;
 					for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
 					if (!list) {
-						gaim_debug_info("oscar",
+						purple_debug_info("oscar",
 								   "ssi: adding permit buddy %s to local list\n", curitem->name);
-						gaim_privacy_permit_add(account, curitem->name, TRUE);
+						purple_privacy_permit_add(account, curitem->name, TRUE);
 					}
 				}
 			} break;
@@ -4932,9 +4932,9 @@
 					GSList *list;
 					for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
 					if (!list) {
-						gaim_debug_info("oscar",
+						purple_debug_info("oscar",
 								   "ssi: adding deny buddy %s to local list\n", curitem->name);
-						gaim_privacy_deny_add(account, curitem->name, TRUE);
+						purple_privacy_deny_add(account, curitem->name, TRUE);
 					}
 				}
 			} break;
@@ -4943,18 +4943,18 @@
 				if (curitem->data) {
 					guint8 permdeny;
 					if ((permdeny = aim_ssi_getpermdeny(od->ssi.local)) && (permdeny != account->perm_deny)) {
-						gaim_debug_info("oscar",
+						purple_debug_info("oscar",
 								   "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny);
 						account->perm_deny = permdeny;
-						if (od->icq && account->perm_deny == GAIM_PRIVACY_ALLOW_USERS) {
-							gaim_presence_set_status_active(account->presence, OSCAR_STATUS_ID_INVISIBLE, TRUE);
+						if (od->icq && account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) {
+							purple_presence_set_status_active(account->presence, OSCAR_STATUS_ID_INVISIBLE, TRUE);
 						}
 					}
 				}
 			} break;
 
 			case 0x0005: { /* Presence setting */
-				/* We don't want to change Gaim's setting because it applies to all accounts */
+				/* We don't want to change Purple's setting because it applies to all accounts */
 			} break;
 		} /* End of switch on curitem->type */
 	} /* End of for loop */
@@ -4964,7 +4964,7 @@
 	/* Activate SSI */
 	/* Sending the enable causes other people to be able to see you, and you to see them */
 	/* Make sure your privacy setting/invisibility is set how you want it before this! */
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "ssi: activating server-stored buddy list\n");
 	aim_ssi_enable(od);
 
@@ -4973,15 +4973,15 @@
 	 * the event that the local user set a new icon while this
 	 * account was offline.
 	 */
-	icon_path = gaim_account_get_buddy_icon(account);
-	cached_icon_path = gaim_buddy_icons_get_full_path(icon_path);
+	icon_path = purple_account_get_buddy_icon(account);
+	cached_icon_path = purple_buddy_icons_get_full_path(icon_path);
 	oscar_set_icon(gc, cached_icon_path);
 
 	return 1;
 }
 
-static int gaim_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	struct aim_ssi_tmp *retval;
 
@@ -4990,7 +4990,7 @@
 	va_end(ap);
 
 	while (retval) {
-		gaim_debug_misc("oscar",
+		purple_debug_misc("oscar",
 				   "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack,  retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item");
 
 		if (retval->ack != 0xffff)
@@ -5001,22 +5001,22 @@
 			case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */
 				gchar *buf;
 				buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list.  Please remove one and try again."), (retval->name ? retval->name : _("(no name)")));
-				if ((retval->name != NULL) && !gaim_conv_present_error(retval->name, gaim_connection_get_account(gc), buf))
-					gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
+				if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf))
+					purple_notify_error(gc, NULL, _("Unable To Add"), buf);
 				g_free(buf);
 			}
 
 			case 0x000e: { /* buddy requires authorization */
 				if ((retval->action == SNAC_SUBTYPE_FEEDBAG_ADD) && (retval->name))
-					gaim_auth_sendrequest(gc, retval->name);
+					purple_auth_sendrequest(gc, retval->name);
 			} break;
 
 			default: { /* La la la */
 				gchar *buf;
-				gaim_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
+				purple_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
 				buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason.  The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)")));
-				if ((retval->name != NULL) && !gaim_conv_present_error(retval->name, gaim_connection_get_account(gc), buf))
-					gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
+				if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf))
+					purple_notify_error(gc, NULL, _("Unable To Add"), buf);
 				g_free(buf);
 			} break;
 		}
@@ -5027,11 +5027,11 @@
 	return 1;
 }
 
-static int gaim_ssi_parseadd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_ssi_parseadd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	char *gname, *gname_utf8, *alias, *alias_utf8;
-	GaimBuddy *b;
-	GaimGroup *g;
+	PurpleBuddy *b;
+	PurpleGroup *g;
 	va_list ap;
 	guint16 type;
 	const char *name;
@@ -5053,12 +5053,12 @@
 		if (g_utf8_validate(alias, -1, NULL))
 			alias_utf8 = g_strdup(alias);
 		else
-			alias_utf8 = oscar_utf8_try_convert(gaim_connection_get_account(gc), alias);
+			alias_utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), alias);
 	}
 	else
 		alias_utf8 = NULL;
 
-	b = gaim_find_buddy(gc->account, name);
+	b = purple_find_buddy(gc->account, name);
 	g_free(alias);
 
 	if (b) {
@@ -5068,16 +5068,16 @@
 			b->alias = g_strdup(alias_utf8);
 		}
 	} else {
-		b = gaim_buddy_new(gc->account, name, alias_utf8);
-
-		if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
-			g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
-			gaim_blist_add_group(g, NULL);
+		b = purple_buddy_new(gc->account, name, alias_utf8);
+
+		if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
+			g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
+			purple_blist_add_group(g, NULL);
 		}
 
-		gaim_debug_info("oscar",
+		purple_debug_info("oscar",
 				   "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans"));
-		gaim_blist_add_buddy(b, NULL, g, NULL);
+		purple_blist_add_buddy(b, NULL, g, NULL);
 	}
 	g_free(gname_utf8);
 	g_free(alias_utf8);
@@ -5085,25 +5085,25 @@
 	return 1;
 }
 
-static int gaim_ssi_authgiven(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_ssi_authgiven(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	char *sn, *msg;
 	gchar *dialog_msg, *nombre;
 	struct name_data *data;
-	GaimBuddy *buddy;
+	PurpleBuddy *buddy;
 
 	va_start(ap, fr);
 	sn = va_arg(ap, char *);
 	msg = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "ssi: %s has given you permission to add him to your buddy list\n", sn);
 
-	buddy = gaim_find_buddy(gc->account, sn);
-	if (buddy && (gaim_buddy_get_alias_only(buddy)))
-		nombre = g_strdup_printf("%s (%s)", sn, gaim_buddy_get_alias_only(buddy));
+	buddy = purple_find_buddy(gc->account, sn);
+	if (buddy && (purple_buddy_get_alias_only(buddy)))
+		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
 	else
 		nombre = g_strdup(sn);
 
@@ -5113,9 +5113,9 @@
 	data->name = g_strdup(sn);
 	data->nick = NULL;
 
-	gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg,
-						GAIM_DEFAULT_ACTION_NONE, data,
-						G_CALLBACK(gaim_icq_buddyadd),
+	purple_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg,
+						PURPLE_DEFAULT_ACTION_NONE, data,
+						G_CALLBACK(purple_icq_buddyadd),
 						G_CALLBACK(oscar_free_name_data));
 
 	g_free(dialog_msg);
@@ -5124,55 +5124,55 @@
 	return 1;
 }
 
-static int gaim_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	char *sn;
 	char *msg;
-	GaimAccount *account = gaim_connection_get_account(gc);
+	PurpleAccount *account = purple_connection_get_account(gc);
 	gchar *nombre;
 	gchar *reason = NULL;
 	struct name_data *data;
-	GaimBuddy *buddy;
+	PurpleBuddy *buddy;
 
 	va_start(ap, fr);
 	sn = va_arg(ap, char *);
 	msg = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "ssi: received authorization request from %s\n", sn);
 
-	buddy = gaim_find_buddy(account, sn);
-	if (buddy && (gaim_buddy_get_alias_only(buddy)))
-		nombre = g_strdup_printf("%s (%s)", sn, gaim_buddy_get_alias_only(buddy));
+	buddy = purple_find_buddy(account, sn);
+	if (buddy && (purple_buddy_get_alias_only(buddy)))
+		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
 	else
 		nombre = g_strdup(sn);
 
 	if (msg != NULL)
-		reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg));
+		reason = purple_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg));
 
 	data = g_new(struct name_data, 1);
 	data->gc = gc;
 	data->name = g_strdup(sn);
 	data->nick = NULL;
 
-	gaim_account_request_authorization(account, nombre, NULL, NULL,
-			reason, buddy != NULL, G_CALLBACK(gaim_auth_grant),
-			G_CALLBACK(gaim_auth_dontgrant_msgprompt), data);
+	purple_account_request_authorization(account, nombre, NULL, NULL,
+			reason, buddy != NULL, G_CALLBACK(purple_auth_grant),
+			G_CALLBACK(purple_auth_dontgrant_msgprompt), data);
 	g_free(nombre);
 	g_free(reason);
 
 	return 1;
 }
 
-static int gaim_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	char *sn, *msg;
 	gchar *dialog_msg, *nombre;
 	guint8 reply;
-	GaimBuddy *buddy;
+	PurpleBuddy *buddy;
 
 	va_start(ap, fr);
 	sn = va_arg(ap, char *);
@@ -5180,23 +5180,23 @@
 	msg = va_arg(ap, char *);
 	va_end(ap);
 
-	gaim_debug_info("oscar",
+	purple_debug_info("oscar",
 			   "ssi: received authorization reply from %s.  Reply is 0x%04hhx\n", sn, reply);
 
-	buddy = gaim_find_buddy(gc->account, sn);
-	if (buddy && (gaim_buddy_get_alias_only(buddy)))
-		nombre = g_strdup_printf("%s (%s)", sn, gaim_buddy_get_alias_only(buddy));
+	buddy = purple_find_buddy(gc->account, sn);
+	if (buddy && (purple_buddy_get_alias_only(buddy)))
+		nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
 	else
 		nombre = g_strdup(sn);
 
 	if (reply) {
 		/* Granted */
 		dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre);
-		gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg);
+		purple_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg);
 	} else {
 		/* Denied */
 		dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));
-		gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg);
+		purple_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg);
 	}
 	g_free(dialog_msg);
 	g_free(nombre);
@@ -5204,24 +5204,24 @@
 	return 1;
 }
 
-static int gaim_ssi_gotadded(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+static int purple_ssi_gotadded(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	char *sn;
-	GaimBuddy *buddy;
+	PurpleBuddy *buddy;
 
 	va_start(ap, fr);
 	sn = va_arg(ap, char *);
 	va_end(ap);
 
-	buddy = gaim_find_buddy(gc->account, sn);
-	gaim_debug_info("oscar", "ssi: %s added you to their buddy list\n", sn);
-	gaim_account_notify_added(gc->account, sn, NULL, (buddy ? gaim_buddy_get_alias_only(buddy) : NULL), NULL);
+	buddy = purple_find_buddy(gc->account, sn);
+	purple_debug_info("oscar", "ssi: %s added you to their buddy list\n", sn);
+	purple_account_notify_added(gc->account, sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL);
 
 	return 1;
 }
 
-GList *oscar_chat_info(GaimConnection *gc) {
+GList *oscar_chat_info(PurpleConnection *gc) {
 	GList *m = NULL;
 	struct proto_chat_entry *pce;
 
@@ -5243,7 +5243,7 @@
 	return m;
 }
 
-GHashTable *oscar_chat_info_defaults(GaimConnection *gc, const char *chat_name)
+GHashTable *oscar_chat_info_defaults(PurpleConnection *gc, const char *chat_name)
 {
 	GHashTable *defaults;
 
@@ -5262,7 +5262,7 @@
 }
 
 void
-oscar_join_chat(GaimConnection *gc, GHashTable *data)
+oscar_join_chat(PurpleConnection *gc, GHashTable *data)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 	FlapConnection *conn;
@@ -5272,20 +5272,20 @@
 	exchange = g_hash_table_lookup(data, "exchange");
 
 	if ((name == NULL) || (*name == '\0')) {
-		gaim_notify_error(gc, NULL, _("Invalid chat name specified."), NULL);
+		purple_notify_error(gc, NULL, _("Invalid chat name specified."), NULL);
 		return;
 	}
 
-	gaim_debug_info("oscar", "Attempting to join chat room %s.\n", name);
+	purple_debug_info("oscar", "Attempting to join chat room %s.\n", name);
 
 	if ((conn = flap_connection_getbytype(od, SNAC_FAMILY_CHATNAV)))
 	{
-		gaim_debug_info("oscar", "chatnav exists, creating room\n");
+		purple_debug_info("oscar", "chatnav exists, creating room\n");
 		aim_chatnav_createroom(od, conn, name, atoi(exchange));
 	} else {
 		/* this gets tricky */
 		struct create_room *cr = g_new0(struct create_room, 1);
-		gaim_debug_info("oscar", "chatnav does not exist, opening chatnav\n");
+		purple_debug_info("oscar", "chatnav does not exist, opening chatnav\n");
 		cr->exchange = atoi(exchange);
 		cr->name = g_strdup(name);
 		od->create_rooms = g_slist_prepend(od->create_rooms, cr);
@@ -5294,7 +5294,7 @@
 }
 
 void
-oscar_chat_invite(GaimConnection *gc, int id, const char *message, const char *name)
+oscar_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 	struct chat_connection *ccon = find_oscar_chat(gc, id);
@@ -5307,46 +5307,46 @@
 }
 
 void
-oscar_chat_leave(GaimConnection *gc, int id)
+oscar_chat_leave(PurpleConnection *gc, int id)
 {
-	GaimConversation *conv;
+	PurpleConversation *conv;
 	struct chat_connection *cc;
 
-	conv = gaim_find_chat(gc, id);
+	conv = purple_find_chat(gc, id);
 
 	g_return_if_fail(conv != NULL);
 
-	gaim_debug_info("oscar", "Leaving chat room %s\n", conv->name);
-
-	cc = find_oscar_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
+	purple_debug_info("oscar", "Leaving chat room %s\n", conv->name);
+
+	cc = find_oscar_chat(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)));
 	oscar_chat_kill(gc, cc);
 }
 
-int oscar_send_chat(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) {
+int oscar_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) {
 	OscarData *od = (OscarData *)gc->proto_data;
-	GaimConversation *conv = NULL;
+	PurpleConversation *conv = NULL;
 	struct chat_connection *c = NULL;
 	char *buf, *buf2;
 	guint16 charset, charsubset;
 	char *charsetstr = NULL;
 	int len;
 
-	if (!(conv = gaim_find_chat(gc, id)))
+	if (!(conv = purple_find_chat(gc, id)))
 		return -EINVAL;
 
 	if (!(c = find_oscar_chat_by_conv(gc, conv)))
 		return -EINVAL;
 
-	buf = gaim_strdup_withhtml(message);
+	buf = purple_strdup_withhtml(message);
 	len = strlen(buf);
 
 	if (strstr(buf, "<IMG "))
-		gaim_conversation_write(conv, "",
+		purple_conversation_write(conv, "",
 			_("Your IM Image was not sent. "
 			  "You cannot send IM Images in AIM chats."),
-			GAIM_MESSAGE_ERROR, time(NULL));
-
-	gaim_plugin_oscar_convert_to_best_encoding(gc, NULL, buf, &buf2, &len, &charset, &charsubset);
+			PURPLE_MESSAGE_ERROR, time(NULL));
+
+	purple_plugin_oscar_convert_to_best_encoding(gc, NULL, buf, &buf2, &len, &charset, &charsubset);
 	/*
 	 * Evan S. suggested that maxvis really does mean "number of
 	 * visible characters" and not "number of bytes"
@@ -5368,11 +5368,11 @@
 	return 0;
 }
 
-const char *oscar_list_icon_icq(GaimAccount *a, GaimBuddy *b)
+const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b)
 {
 	if ((b == NULL) || (b->name == NULL) || aim_sn_is_sms(b->name))
 	{
-		if (a == NULL || aim_sn_is_icq(gaim_account_get_username(a)))
+		if (a == NULL || aim_sn_is_icq(purple_account_get_username(a)))
 			return "icq";
 		else
 			return "aim";
@@ -5383,11 +5383,11 @@
 	return "aim";
 }
 
-const char *oscar_list_icon_aim(GaimAccount *a, GaimBuddy *b)
+const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b)
 {
 	if ((b == NULL) || (b->name == NULL) || aim_sn_is_sms(b->name))
 	{
-		if (a != NULL && aim_sn_is_icq(gaim_account_get_username(a)))
+		if (a != NULL && aim_sn_is_icq(purple_account_get_username(a)))
 			return "icq";
 		else
 			return "aim";
@@ -5398,13 +5398,13 @@
 	return "aim";
 }
 
-const char* oscar_list_emblem(GaimBuddy *b)
+const char* oscar_list_emblem(PurpleBuddy *b)
 {
-	GaimConnection *gc = NULL;
+	PurpleConnection *gc = NULL;
 	OscarData *od = NULL;
-	GaimAccount *account = NULL;
-	GaimPresence *presence;
-	GaimStatus *status;
+	PurpleAccount *account = NULL;
+	PurplePresence *presence;
+	PurpleStatus *status;
 	const char *status_id;
 	aim_userinfo_t *userinfo = NULL;
 
@@ -5416,11 +5416,11 @@
 	if (od != NULL)
 		userinfo = aim_locate_finduserinfo(od, b->name);
 
-	presence = gaim_buddy_get_presence(b);
-	status = gaim_presence_get_active_status(presence);
-	status_id = gaim_status_get_id(status);
-
-	if (gaim_presence_is_online(presence) == FALSE) {
+	presence = purple_buddy_get_presence(b);
+	status = purple_presence_get_active_status(presence);
+	status_id = purple_status_get_id(status);
+
+	if (purple_presence_is_online(presence) == FALSE) {
 		char *gname;
 		if ((b->name) && (od) && (od->ssi.received_data) &&
 			(gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name)) &&
@@ -5442,31 +5442,31 @@
 	return NULL;
 }
 
-void oscar_tooltip_text(GaimBuddy *b, GaimNotifyUserInfo *user_info, gboolean full) {
-	GaimConnection *gc = b->account->gc;
+void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) {
+	PurpleConnection *gc = b->account->gc;
 	OscarData *od = gc->proto_data;
 	aim_userinfo_t *userinfo = aim_locate_finduserinfo(od, b->name);
 
-	if (GAIM_BUDDY_IS_ONLINE(b)) {
-		GaimPresence *presence;
-		GaimStatus *status;
+	if (PURPLE_BUDDY_IS_ONLINE(b)) {
+		PurplePresence *presence;
+		PurpleStatus *status;
 		const char *message;
 
 		if (full)
 			oscar_string_append_info(gc, user_info, b, userinfo);
 
-		presence = gaim_buddy_get_presence(b);
-		status = gaim_presence_get_active_status(presence);
-		message = gaim_status_get_attr_string(status, "message");
-
-		if (gaim_status_is_available(status))
+		presence = purple_buddy_get_presence(b);
+		status = purple_presence_get_active_status(presence);
+		message = purple_status_get_attr_string(status, "message");
+
+		if (purple_status_is_available(status))
 		{
 			if (message != NULL)
 			{
 				/* Available status messages are plain text */
 				gchar *tmp;
 				tmp = g_markup_escape_text(message, -1);
-				gaim_notify_user_info_add_pair(user_info, _("Message"), tmp);
+				purple_notify_user_info_add_pair(user_info, _("Message"), tmp);
 				g_free(tmp);
 			}
 		}
@@ -5476,41 +5476,41 @@
 			{
 				/* Away messages are HTML */
 				gchar *tmp1, *tmp2;
-				tmp2 = gaim_markup_strip_html(message);
+				tmp2 = purple_markup_strip_html(message);
 				tmp1 = g_markup_escape_text(tmp2, -1);
 				g_free(tmp2);
-				tmp2 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc)));
+				tmp2 = purple_str_sub_away_formatters(tmp1, purple_account_get_username(purple_connection_get_account(gc)));
 				g_free(tmp1);
-				gaim_notify_user_info_add_pair(user_info, _("Away Message"), tmp2);
+				purple_notify_user_info_add_pair(user_info, _("Away Message"), tmp2);
 				g_free(tmp2);
 			}
 			else
 			{
-				gaim_notify_user_info_add_pair(user_info, _("Away Message"), _("<i>(retrieving)</i>"));
+				purple_notify_user_info_add_pair(user_info, _("Away Message"), _("<i>(retrieving)</i>"));
 			}
 		}
 	}
 }
 
-char *oscar_status_text(GaimBuddy *b)
+char *oscar_status_text(PurpleBuddy *b)
 {
-	GaimConnection *gc;
-	GaimAccount *account;
+	PurpleConnection *gc;
+	PurpleAccount *account;
 	OscarData *od;
-	const GaimPresence *presence;
-	const GaimStatus *status;
+	const PurplePresence *presence;
+	const PurpleStatus *status;
 	const char *id;
 	const char *message;
 	gchar *ret = NULL;
 
-	gc = gaim_account_get_connection(gaim_buddy_get_account(b));
-	account = gaim_connection_get_account(gc);
+	gc = purple_account_get_connection(purple_buddy_get_account(b));
+	account = purple_connection_get_account(gc);
 	od = gc->proto_data;
-	presence = gaim_buddy_get_presence(b);
-	status = gaim_presence_get_active_status(presence);
-	id = gaim_status_get_id(status);
-
-	if (!gaim_presence_is_online(presence))
+	presence = purple_buddy_get_presence(b);
+	status = purple_presence_get_active_status(presence);
+	id = purple_status_get_id(status);
+
+	if (!purple_presence_is_online(presence))
 	{
 		char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name);
 		if (aim_ssi_waitingforauth(od->ssi.local, gname, b->name))
@@ -5518,27 +5518,27 @@
 		else
 			ret = g_strdup(_("Offline"));
 	}
-	else if (gaim_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AVAILABLE))
+	else if (purple_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AVAILABLE))
 	{
 		/* Available */
-		message = gaim_status_get_attr_string(status, "message");
+		message = purple_status_get_attr_string(status, "message");
 		if (message != NULL)
 		{
 			ret = g_markup_escape_text(message, -1);
-			gaim_util_chrreplace(ret, '\n', ' ');
+			purple_util_chrreplace(ret, '\n', ' ');
 		}
 	}
-	else if (!gaim_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AWAY))
+	else if (!purple_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AWAY))
 	{
 		/* Away */
-		message = gaim_status_get_attr_string(status, "message");
+		message = purple_status_get_attr_string(status, "message");
 		if (message != NULL)
 		{
 			gchar *tmp1, *tmp2;
-			tmp1 = gaim_markup_strip_html(message);
-			gaim_util_chrreplace(tmp1, '\n', ' ');
+			tmp1 = purple_markup_strip_html(message);
+			purple_util_chrreplace(tmp1, '\n', ' ');
 			tmp2 = g_markup_escape_text(tmp1, -1);
-			ret = gaim_str_sub_away_formatters(tmp2, gaim_account_get_username(account));
+			ret = purple_str_sub_away_formatters(tmp2, purple_account_get_username(account));
 			g_free(tmp1);
 			g_free(tmp2);
 		}
@@ -5548,14 +5548,14 @@
 		}
 	}
 	else
-		ret = g_strdup(gaim_status_get_name(status));
+		ret = g_strdup(purple_status_get_name(status));
 
 	return ret;
 }
 
 
 static int oscar_icon_req(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	GaimConnection *gc = od->gc;
+	PurpleConnection *gc = od->gc;
 	va_list ap;
 	guint16 type;
 	guint8 flags = 0, length = 0;
@@ -5578,7 +5578,7 @@
 					aim_srv_requestnew(od, SNAC_FAMILY_BART);
 				} else {
 					struct stat st;
-					char *iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(gaim_connection_get_account(gc)));
+					char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc)));
 					if (iconfile == NULL) {
 						aim_ssi_delicon(od);
 					} else if (!g_stat(iconfile, &st)) {
@@ -5588,21 +5588,21 @@
 							/* XXX - Use g_file_get_contents()? */
 							fread(buf, 1, st.st_size, file);
 							fclose(file);
-							gaim_debug_info("oscar",
+							purple_debug_info("oscar",
 											"Uploading icon to icon server\n");
 							aim_bart_upload(od, buf, st.st_size);
 						} else
-							gaim_debug_error("oscar",
+							purple_debug_error("oscar",
 											 "Can't open buddy icon file!\n");
 						g_free(buf);
 					} else {
-						gaim_debug_error("oscar",
+						purple_debug_error("oscar",
 										 "Can't stat buddy icon file!\n");
 					}
 					g_free(iconfile);
 				}
 			} else if (flags == 0x81) {
-				char *iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(gaim_connection_get_account(gc)));
+				char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc)));
 				if (iconfile == NULL)
 					aim_ssi_delicon(od);
 				else {
@@ -5621,25 +5621,25 @@
 	return 0;
 }
 
-void oscar_set_permit_deny(GaimConnection *gc) {
-	GaimAccount *account = gaim_connection_get_account(gc);
+void oscar_set_permit_deny(PurpleConnection *gc) {
+	PurpleAccount *account = purple_connection_get_account(gc);
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	if (od->ssi.received_data) {
 		switch (account->perm_deny) {
-			case GAIM_PRIVACY_ALLOW_ALL:
+			case PURPLE_PRIVACY_ALLOW_ALL:
 				aim_ssi_setpermdeny(od, 0x01, 0xffffffff);
 				break;
-			case GAIM_PRIVACY_ALLOW_BUDDYLIST:
+			case PURPLE_PRIVACY_ALLOW_BUDDYLIST:
 				aim_ssi_setpermdeny(od, 0x05, 0xffffffff);
 				break;
-			case GAIM_PRIVACY_ALLOW_USERS:
+			case PURPLE_PRIVACY_ALLOW_USERS:
 				aim_ssi_setpermdeny(od, 0x03, 0xffffffff);
 				break;
-			case GAIM_PRIVACY_DENY_ALL:
+			case PURPLE_PRIVACY_DENY_ALL:
 				aim_ssi_setpermdeny(od, 0x02, 0xffffffff);
 				break;
-			case GAIM_PRIVACY_DENY_USERS:
+			case PURPLE_PRIVACY_DENY_USERS:
 				aim_ssi_setpermdeny(od, 0x04, 0xffffffff);
 				break;
 			default:
@@ -5649,100 +5649,100 @@
 	}
 }
 
-void oscar_add_permit(GaimConnection *gc, const char *who) {
+void oscar_add_permit(PurpleConnection *gc, const char *who) {
 	OscarData *od = (OscarData *)gc->proto_data;
-	gaim_debug_info("oscar", "ssi: About to add a permit\n");
+	purple_debug_info("oscar", "ssi: About to add a permit\n");
 	if (od->ssi.received_data)
 		aim_ssi_addpermit(od, who);
 }
 
-void oscar_add_deny(GaimConnection *gc, const char *who) {
+void oscar_add_deny(PurpleConnection *gc, const char *who) {
 	OscarData *od = (OscarData *)gc->proto_data;
-	gaim_debug_info("oscar", "ssi: About to add a deny\n");
+	purple_debug_info("oscar", "ssi: About to add a deny\n");
 	if (od->ssi.received_data)
 		aim_ssi_adddeny(od, who);
 }
 
-void oscar_rem_permit(GaimConnection *gc, const char *who) {
+void oscar_rem_permit(PurpleConnection *gc, const char *who) {
 	OscarData *od = (OscarData *)gc->proto_data;
-	gaim_debug_info("oscar", "ssi: About to delete a permit\n");
+	purple_debug_info("oscar", "ssi: About to delete a permit\n");
 	if (od->ssi.received_data)
 		aim_ssi_delpermit(od, who);
 }
 
-void oscar_rem_deny(GaimConnection *gc, const char *who) {
+void oscar_rem_deny(PurpleConnection *gc, const char *who) {
 	OscarData *od = (OscarData *)gc->proto_data;
-	gaim_debug_info("oscar", "ssi: About to delete a deny\n");
+	purple_debug_info("oscar", "ssi: About to delete a deny\n");
 	if (od->ssi.received_data)
 		aim_ssi_deldeny(od, who);
 }
 
 GList *
-oscar_status_types(GaimAccount *account)
+oscar_status_types(PurpleAccount *account)
 {
 	gboolean is_icq;
 	GList *status_types = NULL;
-	GaimStatusType *type;
+	PurpleStatusType *type;
 
 	g_return_val_if_fail(account != NULL, NULL);
 
 	/* Used to flag some statuses as "user settable" or not */
-	is_icq = aim_sn_is_icq(gaim_account_get_username(account));
+	is_icq = aim_sn_is_icq(purple_account_get_username(account));
 
 	/* Common status types */
 	/* Really the available message should only be settable for AIM accounts */
-	type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE,
+	type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
 										   OSCAR_STATUS_ID_AVAILABLE,
 										   NULL, TRUE, TRUE, FALSE,
 										   "message", _("Message"),
-										   gaim_value_new(GAIM_TYPE_STRING),
+										   purple_value_new(PURPLE_TYPE_STRING),
 										   "itmsurl", _("iTunes Music Store Link"),
-										   gaim_value_new(GAIM_TYPE_STRING), NULL);
+										   purple_value_new(PURPLE_TYPE_STRING), NULL);
 	status_types = g_list_prepend(status_types, type);
 
-	type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
+	type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE,
 									 OSCAR_STATUS_ID_FREE4CHAT,
 									 _("Free For Chat"), TRUE, is_icq, FALSE);
 	status_types = g_list_prepend(status_types, type);
 
-	type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY,
+	type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
 										   OSCAR_STATUS_ID_AWAY,
 										   NULL, TRUE, TRUE, FALSE,
 										   "message", _("Message"),
-										   gaim_value_new(GAIM_TYPE_STRING), NULL);
+										   purple_value_new(PURPLE_TYPE_STRING), NULL);
 	status_types = g_list_prepend(status_types, type);
 
-	type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE,
+	type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE,
 									 OSCAR_STATUS_ID_INVISIBLE,
 									 NULL, TRUE, TRUE, FALSE);
 	status_types = g_list_prepend(status_types, type);
 
-	type = gaim_status_type_new_full(GAIM_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE);
+	type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE);
 	status_types = g_list_prepend(status_types, type);
 
 	/* ICQ-specific status types */
-	type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE,
+	type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE,
 				OSCAR_STATUS_ID_OCCUPIED,
 				_("Occupied"), TRUE, is_icq, FALSE,
 				"message", _("Message"),
-				gaim_value_new(GAIM_TYPE_STRING), NULL);
+				purple_value_new(PURPLE_TYPE_STRING), NULL);
 	status_types = g_list_prepend(status_types, type);
 
-	type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY,
+	type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY,
 				OSCAR_STATUS_ID_DND,
 				_("Do Not Disturb"), TRUE, is_icq, FALSE,
 				"message", _("Message"),
-				gaim_value_new(GAIM_TYPE_STRING), NULL);
+				purple_value_new(PURPLE_TYPE_STRING), NULL);
 	status_types = g_list_prepend(status_types, type);
 
-	type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY,
+	type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY,
 				OSCAR_STATUS_ID_NA,
 				_("Not Available"), TRUE, is_icq, FALSE,
 				"message", _("Message"),
-				gaim_value_new(GAIM_TYPE_STRING), NULL);
+				purple_value_new(PURPLE_TYPE_STRING), NULL);
 	status_types = g_list_prepend(status_types, type);
 
-	type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
+	type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
 									 OSCAR_STATUS_ID_OFFLINE,
 									 NULL, TRUE, TRUE, FALSE);
 	status_types = g_list_prepend(status_types, type);
@@ -5753,17 +5753,17 @@
 }
 
 static void oscar_ssi_editcomment(struct name_data *data, const char *text) {
-	GaimConnection *gc = data->gc;
+	PurpleConnection *gc = data->gc;
 	OscarData *od = gc->proto_data;
-	GaimBuddy *b;
-	GaimGroup *g;
-
-	if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) {
+	PurpleBuddy *b;
+	PurpleGroup *g;
+
+	if (!(b = purple_find_buddy(purple_connection_get_account(data->gc), data->name))) {
 		oscar_free_name_data(data);
 		return;
 	}
 
-	if (!(g = gaim_buddy_get_group(b))) {
+	if (!(g = purple_buddy_get_group(b))) {
 		oscar_free_name_data(data);
 		return;
 	}
@@ -5771,31 +5771,31 @@
 	aim_ssi_editcomment(od, g->name, data->name, text);
 
 	if (!aim_sncmp(data->name, gc->account->username))
-		gaim_check_comment(od, text);
+		purple_check_comment(od, text);
 
 	oscar_free_name_data(data);
 }
 
-static void oscar_buddycb_edit_comment(GaimBlistNode *node, gpointer ignore) {
-
-	GaimBuddy *buddy;
-	GaimConnection *gc;
+static void oscar_buddycb_edit_comment(PurpleBlistNode *node, gpointer ignore) {
+
+	PurpleBuddy *buddy;
+	PurpleConnection *gc;
 	OscarData *od;
 	struct name_data *data;
-	GaimGroup *g;
+	PurpleGroup *g;
 	char *comment;
 	gchar *comment_utf8;
 	gchar *title;
 
-	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
-
-	buddy = (GaimBuddy *) node;
-	gc = gaim_account_get_connection(buddy->account);
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
+
+	buddy = (PurpleBuddy *) node;
+	gc = purple_account_get_connection(buddy->account);
 	od = gc->proto_data;
 
 	data = g_new(struct name_data, 1);
 
-	if (!(g = gaim_buddy_get_group(buddy)))
+	if (!(g = purple_buddy_get_group(buddy)))
 		return;
 	comment = aim_ssi_getcomment(od->ssi.local, g->name, buddy->name);
 	comment_utf8 = comment ? oscar_utf8_try_convert(gc->account, comment) : NULL;
@@ -5805,7 +5805,7 @@
 	data->nick = NULL;
 
 	title = g_strdup_printf(_("Buddy Comment for %s"), data->name);
-	gaim_request_input(gc, title, _("Buddy Comment:"), NULL,
+	purple_request_input(gc, title, _("Buddy Comment:"), NULL,
 					   comment_utf8, TRUE, FALSE, NULL,
 					   _("_OK"), G_CALLBACK(oscar_ssi_editcomment),
 					   _("_Cancel"), G_CALLBACK(oscar_free_name_data),
@@ -5835,18 +5835,18 @@
 static void
 oscar_ask_directim(gpointer object, gpointer ignored)
 {
-	GaimBlistNode *node;
-	GaimBuddy *buddy;
-	GaimConnection *gc;
+	PurpleBlistNode *node;
+	PurpleBuddy *buddy;
+	PurpleConnection *gc;
 	gchar *buf;
 	struct oscar_ask_directim_data *data;
 
 	node = object;
 
-	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
-
-	buddy = (GaimBuddy *)node;
-	gc = gaim_account_get_connection(buddy->account);
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
+
+	buddy = (PurpleBuddy *)node;
+	gc = purple_account_get_connection(buddy->account);
 
 	data = g_new0(struct oscar_ask_directim_data, 1);
 	data->who = g_strdup(buddy->name);
@@ -5854,7 +5854,7 @@
 	buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."),
 			buddy->name);
 
-	gaim_request_action(gc, NULL, buf,
+	purple_request_action(gc, NULL, buf,
 			_("Because this reveals your IP address, it "
 			  "may be considered a security risk.  Do you "
 			  "wish to continue?"),
@@ -5865,72 +5865,72 @@
 }
 
 static void
-oscar_get_aim_info_cb(GaimBlistNode *node, gpointer ignore)
+oscar_get_aim_info_cb(PurpleBlistNode *node, gpointer ignore)
 {
-	GaimBuddy *buddy;
-	GaimConnection *gc;
-
-	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
-
-	buddy = (GaimBuddy *)node;
-	gc = gaim_account_get_connection(buddy->account);
-
-	aim_locate_getinfoshort(gc->proto_data, gaim_buddy_get_name(buddy), 0x00000003);
+	PurpleBuddy *buddy;
+	PurpleConnection *gc;
+
+	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
+
+	buddy = (PurpleBuddy *)node;
+	gc = purple_account_get_connection(buddy->account);
+
+	aim_locate_getinfoshort(gc->proto_data, purple_buddy_get_name(buddy), 0x00000003);
 }
 
 static GList *
-oscar_buddy_menu(GaimBuddy *buddy) {
-
-	GaimConnection *gc;
+oscar_buddy_menu(PurpleBuddy *buddy) {
+
+	PurpleConnection *gc;
 	OscarData *od;
 	GList *menu;
-	GaimMenuAction *act;
+	PurpleMenuAction *act;
 	aim_userinfo_t *userinfo;
 
-	gc = gaim_account_get_connection(buddy->account);
+	gc = purple_account_get_connection(buddy->account);
 	od = gc->proto_data;
 	userinfo = aim_locate_finduserinfo(od, buddy->name);
 	menu = NULL;
 
-	if (od->icq && aim_sn_is_icq(gaim_buddy_get_name(buddy)))
+	if (od->icq && aim_sn_is_icq(purple_buddy_get_name(buddy)))
 	{
-		act = gaim_menu_action_new(_("Get AIM Info"),
-								   GAIM_CALLBACK(oscar_get_aim_info_cb),
+		act = purple_menu_action_new(_("Get AIM Info"),
+								   PURPLE_CALLBACK(oscar_get_aim_info_cb),
 								   NULL, NULL);
 		menu = g_list_prepend(menu, act);
 	}
 
-	act = gaim_menu_action_new(_("Edit Buddy Comment"),
-	                           GAIM_CALLBACK(oscar_buddycb_edit_comment),
+	act = purple_menu_action_new(_("Edit Buddy Comment"),
+	                           PURPLE_CALLBACK(oscar_buddycb_edit_comment),
 	                           NULL, NULL);
 	menu = g_list_prepend(menu, act);
 
 #if 0
 	if (od->icq)
 	{
-		act = gaim_menu_action_new(_("Get Status Msg"),
-		                           GAIM_CALLBACK(oscar_get_icqstatusmsg),
+		act = purple_menu_action_new(_("Get Status Msg"),
+		                           PURPLE_CALLBACK(oscar_get_icqstatusmsg),
 		                           NULL, NULL);
 		menu = g_list_prepend(menu, act);
 	}
 #endif
 
 	if (userinfo &&
-		aim_sncmp(gaim_account_get_username(buddy->account), buddy->name) &&
-		GAIM_BUDDY_IS_ONLINE(buddy))
+		aim_sncmp(purple_account_get_username(buddy->account), buddy->name) &&
+		PURPLE_BUDDY_IS_ONLINE(buddy))
 	{
 		if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM)
 		{
-			act = gaim_menu_action_new(_("Direct IM"),
-			                           GAIM_CALLBACK(oscar_ask_directim),
+			act = purple_menu_action_new(_("Direct IM"),
+			                           PURPLE_CALLBACK(oscar_ask_directim),
 			                           NULL, NULL);
 			menu = g_list_prepend(menu, act);
 		}
 #if 0
 		/* TODO: This menu item should be added by the core */
 		if (userinfo->capabilities & OSCAR_CAPABILITY_GETFILE) {
-			act = gaim_menu_action_new(_("Get File"),
-			                           GAIM_CALLBACK(oscar_ask_getfile),
+			act = purple_menu_action_new(_("Get File"),
+			                           PURPLE_CALLBACK(oscar_ask_getfile),
 			                           NULL, NULL);
 			menu = g_list_prepend(menu, act);
 		}
@@ -5943,8 +5943,8 @@
 		gname = aim_ssi_itemlist_findparentname(od->ssi.local, buddy->name);
 		if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, buddy->name))
 		{
-			act = gaim_menu_action_new(_("Re-request Authorization"),
-			                           GAIM_CALLBACK(gaim_auth_sendrequest_menu),
+			act = purple_menu_action_new(_("Re-request Authorization"),
+			                           PURPLE_CALLBACK(purple_auth_sendrequest_menu),
 			                           NULL, NULL);
 			menu = g_list_prepend(menu, act);
 		}
@@ -5956,69 +5956,69 @@
 }
 
 
-GList *oscar_blist_node_menu(GaimBlistNode *node) {
-	if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
-		return oscar_buddy_menu((GaimBuddy *) node);
+GList *oscar_blist_node_menu(PurpleBlistNode *node) {
+	if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+		return oscar_buddy_menu((PurpleBuddy *) node);
 	} else {
 		return NULL;
 	}
 }
 
 static void
-oscar_icq_privacy_opts(GaimConnection *gc, GaimRequestFields *fields)
+oscar_icq_privacy_opts(PurpleConnection *gc, PurpleRequestFields *fields)
 {
 	OscarData *od = gc->proto_data;
-	GaimAccount *account = gaim_connection_get_account(gc);
-	GaimRequestField *f;
+	PurpleAccount *account = purple_connection_get_account(gc);
+	PurpleRequestField *f;
 	gboolean auth, web_aware;
 
-	f = gaim_request_fields_get_field(fields, "authorization");
-	auth = gaim_request_field_bool_get_value(f);
-
-	f = gaim_request_fields_get_field(fields, "web_aware");
-	web_aware = gaim_request_field_bool_get_value(f);
-
-	gaim_account_set_bool(account, "authorization", auth);
-	gaim_account_set_bool(account, "web_aware", web_aware);
+	f = purple_request_fields_get_field(fields, "authorization");
+	auth = purple_request_field_bool_get_value(f);
+
+	f = purple_request_fields_get_field(fields, "web_aware");
+	web_aware = purple_request_field_bool_get_value(f);
+
+	purple_account_set_bool(account, "authorization", auth);
+	purple_account_set_bool(account, "web_aware", web_aware);
 
 	oscar_set_extendedstatus(gc);
 	aim_icq_setsecurity(od, auth, web_aware);
 }
 
 static void
-oscar_show_icq_privacy_opts(GaimPluginAction *action)
+oscar_show_icq_privacy_opts(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
-	GaimAccount *account = gaim_connection_get_account(gc);
-	GaimRequestFields *fields;
-	GaimRequestFieldGroup *g;
-	GaimRequestField *f;
+	PurpleConnection *gc = (PurpleConnection *) action->context;
+	PurpleAccount *account = purple_connection_get_account(gc);
+	PurpleRequestFields *fields;
+	PurpleRequestFieldGroup *g;
+	PurpleRequestField *f;
 	gboolean auth, web_aware;
 
-	auth = gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION);
-	web_aware = gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE);
-
-	fields = gaim_request_fields_new();
-
-	g = gaim_request_field_group_new(NULL);
-
-	f = gaim_request_field_bool_new("authorization", _("Require authorization"), auth);
-	gaim_request_field_group_add_field(g, f);
-
-	f = gaim_request_field_bool_new("web_aware", _("Web aware (enabling this will cause you to receive SPAM!)"), web_aware);
-	gaim_request_field_group_add_field(g, f);
-
-	gaim_request_fields_add_group(fields, g);
-
-	gaim_request_fields(gc, _("ICQ Privacy Options"), _("ICQ Privacy Options"),
+	auth = purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION);
+	web_aware = purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE);
+
+	fields = purple_request_fields_new();
+
+	g = purple_request_field_group_new(NULL);
+
+	f = purple_request_field_bool_new("authorization", _("Require authorization"), auth);
+	purple_request_field_group_add_field(g, f);
+
+	f = purple_request_field_bool_new("web_aware", _("Web aware (enabling this will cause you to receive SPAM!)"), web_aware);
+	purple_request_field_group_add_field(g, f);
+
+	purple_request_fields_add_group(fields, g);
+
+	purple_request_fields(gc, _("ICQ Privacy Options"), _("ICQ Privacy Options"),
 						NULL, fields,
 						_("OK"), G_CALLBACK(oscar_icq_privacy_opts),
 						_("Cancel"), NULL, gc);
 }
 
-static void oscar_format_screenname(GaimConnection *gc, const char *nick) {
+static void oscar_format_screenname(PurpleConnection *gc, const char *nick) {
 	OscarData *od = gc->proto_data;
-	if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) {
+	if (!aim_sncmp(purple_account_get_username(purple_connection_get_account(gc)), nick)) {
 		if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) {
 			od->setnick = TRUE;
 			od->newsn = g_strdup(nick);
@@ -6027,18 +6027,18 @@
 			aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), nick);
 		}
 	} else {
-		gaim_notify_error(gc, NULL, _("The new formatting is invalid."),
+		purple_notify_error(gc, NULL, _("The new formatting is invalid."),
 						  _("Screen name formatting can change only capitalization and whitespace."));
 	}
 }
 
-static void oscar_confirm_account(GaimPluginAction *action)
+static void oscar_confirm_account(PurplePluginAction *action)
 {
-	GaimConnection *gc;
+	PurpleConnection *gc;
 	OscarData *od;
 	FlapConnection *conn;
 
-	gc = (GaimConnection *)action->context;
+	gc = (PurpleConnection *)action->context;
 	od = gc->proto_data;
 
 	conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN);
@@ -6050,9 +6050,9 @@
 	}
 }
 
-static void oscar_show_email(GaimPluginAction *action)
+static void oscar_show_email(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
+	PurpleConnection *gc = (PurpleConnection *) action->context;
 	OscarData *od = gc->proto_data;
 	FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN);
 
@@ -6064,7 +6064,7 @@
 	}
 }
 
-static void oscar_change_email(GaimConnection *gc, const char *email)
+static void oscar_change_email(PurpleConnection *gc, const char *email)
 {
 	OscarData *od = gc->proto_data;
 	FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN);
@@ -6078,40 +6078,40 @@
 	}
 }
 
-static void oscar_show_change_email(GaimPluginAction *action)
+static void oscar_show_change_email(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
-	gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL,
+	PurpleConnection *gc = (PurpleConnection *) action->context;
+	purple_request_input(gc, NULL, _("Change Address To:"), NULL, NULL,
 					   FALSE, FALSE, NULL,
 					   _("_OK"), G_CALLBACK(oscar_change_email),
 					   _("_Cancel"), NULL,
 					   gc);
 }
 
-static void oscar_show_awaitingauth(GaimPluginAction *action)
+static void oscar_show_awaitingauth(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
+	PurpleConnection *gc = (PurpleConnection *) action->context;
 	OscarData *od = gc->proto_data;
 	gchar *nombre, *text, *tmp;
-	GaimBlistNode *gnode, *cnode, *bnode;
+	PurpleBlistNode *gnode, *cnode, *bnode;
 	int num=0;
 
 	text = g_strdup("");
 
-	for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
-		GaimGroup *group = (GaimGroup *)gnode;
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
+	for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
+		PurpleGroup *group = (PurpleGroup *)gnode;
+		if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
 			continue;
 		for (cnode = gnode->child; cnode; cnode = cnode->next) {
-			if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
+			if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
 				continue;
 			for (bnode = cnode->child; bnode; bnode = bnode->next) {
-				GaimBuddy *buddy = (GaimBuddy *)bnode;
-				if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
+				PurpleBuddy *buddy = (PurpleBuddy *)bnode;
+				if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
 				if (buddy->account == gc->account && aim_ssi_waitingforauth(od->ssi.local, group->name, buddy->name)) {
-					if (gaim_buddy_get_alias_only(buddy))
-						nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_buddy_get_alias_only(buddy));
+					if (purple_buddy_get_alias_only(buddy))
+						nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy));
 					else
 						nombre = g_strdup_printf(" %s", buddy->name);
 					tmp = g_strdup_printf("%s%s<br>", text, nombre);
@@ -6129,7 +6129,7 @@
 		text = g_strdup(_("<i>you are not waiting for authorization</i>"));
 	}
 
-	gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from "
+	purple_notify_formatted(gc, NULL, _("You are awaiting authorization from "
 						  "the following buddies"),	_("You can re-request "
 						  "authorization from these buddies by "
 						  "right-clicking on them and selecting "
@@ -6137,17 +6137,17 @@
 	g_free(text);
 }
 
-static void search_by_email_cb(GaimConnection *gc, const char *email)
+static void search_by_email_cb(PurpleConnection *gc, const char *email)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	aim_search_address(od, email);
 }
 
-static void oscar_show_find_email(GaimPluginAction *action)
+static void oscar_show_find_email(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
-	gaim_request_input(gc, _("Find Buddy by E-Mail"),
+	PurpleConnection *gc = (PurpleConnection *) action->context;
+	purple_request_input(gc, _("Find Buddy by E-Mail"),
 					   _("Search for a buddy by e-mail address"),
 					   _("Type the e-mail address of the buddy you are "
 						 "searching for."),
@@ -6156,40 +6156,40 @@
 					   _("_Cancel"), NULL, gc);
 }
 
-static void oscar_show_set_info(GaimPluginAction *action)
+static void oscar_show_set_info(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
-	gaim_account_request_change_user_info(gaim_connection_get_account(gc));
-}
-
-static void oscar_show_set_info_icqurl(GaimPluginAction *action)
+	PurpleConnection *gc = (PurpleConnection *) action->context;
+	purple_account_request_change_user_info(purple_connection_get_account(gc));
+}
+
+static void oscar_show_set_info_icqurl(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
-	gaim_notify_uri(gc, "http://www.icq.com/whitepages/user_details.php");
-}
-
-static void oscar_change_pass(GaimPluginAction *action)
+	PurpleConnection *gc = (PurpleConnection *) action->context;
+	purple_notify_uri(gc, "http://www.icq.com/whitepages/user_details.php");
+}
+
+static void oscar_change_pass(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
-	gaim_account_request_change_password(gaim_connection_get_account(gc));
-}
-
-static void oscar_show_chpassurl(GaimPluginAction *action)
+	PurpleConnection *gc = (PurpleConnection *) action->context;
+	purple_account_request_change_password(purple_connection_get_account(gc));
+}
+
+static void oscar_show_chpassurl(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
+	PurpleConnection *gc = (PurpleConnection *) action->context;
 	OscarData *od = gc->proto_data;
-	gchar *substituted = gaim_strreplace(od->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc)));
-	gaim_notify_uri(gc, substituted);
+	gchar *substituted = purple_strreplace(od->authinfo->chpassurl, "%s", purple_account_get_username(purple_connection_get_account(gc)));
+	purple_notify_uri(gc, substituted);
 	g_free(substituted);
 }
 
-static void oscar_show_imforwardingurl(GaimPluginAction *action)
+static void oscar_show_imforwardingurl(PurplePluginAction *action)
 {
-	GaimConnection *gc = (GaimConnection *) action->context;
-	gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1");
-}
-
-void oscar_set_icon(GaimConnection *gc, const char *iconfile)
+	PurpleConnection *gc = (PurpleConnection *) action->context;
+	purple_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1");
+}
+
+void oscar_set_icon(PurpleConnection *gc, const char *iconfile)
 {
 	OscarData *od = gc->proto_data;
 	FILE *file;
@@ -6202,8 +6202,8 @@
 		file = g_fopen(iconfile, "rb");
 		if (file)
 		{
-			GaimCipher *cipher;
-			GaimCipherContext *context;
+			PurpleCipher *cipher;
+			PurpleCipherContext *context;
 			guchar md5[16];
 			int len;
 
@@ -6211,33 +6211,33 @@
 			len = fread(buf, 1, st.st_size, file);
 			fclose(file);
 
-			cipher = gaim_ciphers_find_cipher("md5");
-			context = gaim_cipher_context_new(cipher, NULL);
-			gaim_cipher_context_append(context, buf, len);
-			gaim_cipher_context_digest(context, 16, md5, NULL);
-			gaim_cipher_context_destroy(context);
+			cipher = purple_ciphers_find_cipher("md5");
+			context = purple_cipher_context_new(cipher, NULL);
+			purple_cipher_context_append(context, buf, len);
+			purple_cipher_context_digest(context, 16, md5, NULL);
+			purple_cipher_context_destroy(context);
 
 			aim_ssi_seticon(od, md5, 16);
 		} else
-			gaim_debug_error("oscar",
+			purple_debug_error("oscar",
 				   "Can't open buddy icon file!\n");
 		g_free(buf);
 	} else
-		gaim_debug_error("oscar", "Can't stat buddy icon file!\n");
+		purple_debug_error("oscar", "Can't stat buddy icon file!\n");
 }
 
 /**
- * Called by the Gaim core to determine whether or not we're
+ * Called by the Purple core to determine whether or not we're
  * allowed to send a file to this user.
  */
 gboolean
-oscar_can_receive_file(GaimConnection *gc, const char *who)
+oscar_can_receive_file(PurpleConnection *gc, const char *who)
 {
 	OscarData *od;
-	GaimAccount *account;
+	PurpleAccount *account;
 
 	od = gc->proto_data;
-	account = gaim_connection_get_account(gc);
+	account = purple_connection_get_account(gc);
 
 	if (od != NULL)
 	{
@@ -6250,7 +6250,7 @@
 		 */
 		if (((userinfo == NULL) ||
 			(userinfo->capabilities & OSCAR_CAPABILITY_SENDFILE)) &&
-			aim_sncmp(who, gaim_account_get_username(account)))
+			aim_sncmp(who, purple_account_get_username(account)))
 		{
 			return TRUE;
 		}
@@ -6259,25 +6259,25 @@
 	return FALSE;
 }
 
-GaimXfer *
-oscar_new_xfer(GaimConnection *gc, const char *who)
+PurpleXfer *
+oscar_new_xfer(PurpleConnection *gc, const char *who)
 {
-	GaimXfer *xfer;
+	PurpleXfer *xfer;
 	OscarData *od;
-	GaimAccount *account;
+	PurpleAccount *account;
 	PeerConnection *conn;
 
 	od = gc->proto_data;
-	account = gaim_connection_get_account(gc);
-
-	xfer = gaim_xfer_new(account, GAIM_XFER_SEND, who);
+	account = purple_connection_get_account(gc);
+
+	xfer = purple_xfer_new(account, PURPLE_XFER_SEND, who);
 	if (xfer)
 	{
-		gaim_xfer_ref(xfer);
-		gaim_xfer_set_init_fnc(xfer, peer_oft_sendcb_init);
-		gaim_xfer_set_cancel_send_fnc(xfer, peer_oft_cb_generic_cancel);
-		gaim_xfer_set_request_denied_fnc(xfer, peer_oft_cb_generic_cancel);
-		gaim_xfer_set_ack_fnc(xfer, peer_oft_sendcb_ack);
+		purple_xfer_ref(xfer);
+		purple_xfer_set_init_fnc(xfer, peer_oft_sendcb_init);
+		purple_xfer_set_cancel_send_fnc(xfer, peer_oft_cb_generic_cancel);
+		purple_xfer_set_request_denied_fnc(xfer, peer_oft_cb_generic_cancel);
+		purple_xfer_set_ack_fnc(xfer, peer_oft_sendcb_ack);
 
 		conn = peer_connection_new(od, OSCAR_CAPABILITY_SENDFILE, who);
 		conn->flags |= PEER_CONNECTION_FLAG_INITIATED_BY_ME;
@@ -6291,52 +6291,52 @@
 }
 
 /*
- * Called by the Gaim core when the user indicates that a
+ * Called by the Purple core when the user indicates that a
  * file is to be sent to a special someone.
  */
 void
-oscar_send_file(GaimConnection *gc, const char *who, const char *file)
+oscar_send_file(PurpleConnection *gc, const char *who, const char *file)
 {
-	GaimXfer *xfer;
+	PurpleXfer *xfer;
 
 	xfer = oscar_new_xfer(gc, who);
 
 	if (file != NULL)
-		gaim_xfer_request_accepted(xfer, file);
+		purple_xfer_request_accepted(xfer, file);
 	else
-		gaim_xfer_request(xfer);
+		purple_xfer_request(xfer);
 }
 
 GList *
-oscar_actions(GaimPlugin *plugin, gpointer context)
+oscar_actions(PurplePlugin *plugin, gpointer context)
 {
-	GaimConnection *gc = (GaimConnection *) context;
+	PurpleConnection *gc = (PurpleConnection *) context;
 	OscarData *od = gc->proto_data;
 	GList *menu = NULL;
-	GaimPluginAction *act;
-
-	act = gaim_plugin_action_new(_("Set User Info..."),
+	PurplePluginAction *act;
+
+	act = purple_plugin_action_new(_("Set User Info..."),
 			oscar_show_set_info);
 	menu = g_list_prepend(menu, act);
 
 	if (od->icq)
 	{
-		act = gaim_plugin_action_new(_("Set User Info (URL)..."),
+		act = purple_plugin_action_new(_("Set User Info (URL)..."),
 				oscar_show_set_info_icqurl);
 		menu = g_list_prepend(menu, act);
 	}
 
-	act = gaim_plugin_action_new(_("Change Password..."),
+	act = purple_plugin_action_new(_("Change Password..."),
 			oscar_change_pass);
 	menu = g_list_prepend(menu, act);
 
 	if (od->authinfo->chpassurl != NULL)
 	{
-		act = gaim_plugin_action_new(_("Change Password (URL)"),
+		act = purple_plugin_action_new(_("Change Password (URL)"),
 				oscar_show_chpassurl);
 		menu = g_list_prepend(menu, act);
 
-		act = gaim_plugin_action_new(_("Configure IM Forwarding (URL)"),
+		act = purple_plugin_action_new(_("Configure IM Forwarding (URL)"),
 				oscar_show_imforwardingurl);
 		menu = g_list_prepend(menu, act);
 	}
@@ -6346,40 +6346,40 @@
 	if (od->icq)
 	{
 		/* ICQ actions */
-		act = gaim_plugin_action_new(_("Set Privacy Options..."),
+		act = purple_plugin_action_new(_("Set Privacy Options..."),
 				oscar_show_icq_privacy_opts);
 		menu = g_list_prepend(menu, act);
 	}
 	else
 	{
 		/* AIM actions */
-		act = gaim_plugin_action_new(_("Confirm Account"),
+		act = purple_plugin_action_new(_("Confirm Account"),
 				oscar_confirm_account);
 		menu = g_list_prepend(menu, act);
 
-		act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"),
+		act = purple_plugin_action_new(_("Display Currently Registered E-Mail Address"),
 				oscar_show_email);
 		menu = g_list_prepend(menu, act);
 
-		act = gaim_plugin_action_new(_("Change Currently Registered E-Mail Address..."),
+		act = purple_plugin_action_new(_("Change Currently Registered E-Mail Address..."),
 				oscar_show_change_email);
 		menu = g_list_prepend(menu, act);
 	}
 
 	menu = g_list_prepend(menu, NULL);
 
-	act = gaim_plugin_action_new(_("Show Buddies Awaiting Authorization"),
+	act = purple_plugin_action_new(_("Show Buddies Awaiting Authorization"),
 			oscar_show_awaitingauth);
 	menu = g_list_prepend(menu, act);
 
 	menu = g_list_prepend(menu, NULL);
 
-	act = gaim_plugin_action_new(_("Search for Buddy by E-Mail Address..."),
+	act = purple_plugin_action_new(_("Search for Buddy by E-Mail Address..."),
 			oscar_show_find_email);
 	menu = g_list_prepend(menu, act);
 
 #if 0
-	act = gaim_plugin_action_new(_("Search for Buddy by Information"),
+	act = purple_plugin_action_new(_("Search for Buddy by Information"),
 			show_find_info);
 	menu = g_list_prepend(menu, act);
 #endif
@@ -6389,7 +6389,7 @@
 	return menu;
 }
 
-void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new)
+void oscar_change_passwd(PurpleConnection *gc, const char *old, const char *new)
 {
 	OscarData *od = gc->proto_data;
 
@@ -6410,7 +6410,7 @@
 }
 
 void
-oscar_convo_closed(GaimConnection *gc, const char *who)
+oscar_convo_closed(PurpleConnection *gc, const char *who)
 {
 	OscarData *od;
 	PeerConnection *conn;
@@ -6428,10 +6428,10 @@
 }
 
 static void
-recent_buddies_cb(const char *name, GaimPrefType type,
+recent_buddies_cb(const char *name, PurplePrefType type,
 				  gconstpointer value, gpointer data)
 {
-	GaimConnection *gc = data;
+	PurpleConnection *gc = data;
 	OscarData *od = gc->proto_data;
 	guint32 presence;
 
@@ -6447,15 +6447,15 @@
 }
 
 #ifdef USE_PRPL_PREFERENCES
-	ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/recent_buddies", _("Use recent buddies group"));
-	gaim_plugin_pref_frame_add(frame, ppref);
-
-	ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/show_idle", _("Show how long you have been idle"));
-	gaim_plugin_pref_frame_add(frame, ppref);
+	ppref = purple_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/recent_buddies", _("Use recent buddies group"));
+	purple_plugin_pref_frame_add(frame, ppref);
+
+	ppref = purple_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/show_idle", _("Show how long you have been idle"));
+	purple_plugin_pref_frame_add(frame, ppref);
 #endif
 
 const char *
-oscar_normalize(const GaimAccount *account, const char *str)
+oscar_normalize(const PurpleAccount *account, const char *str)
 {
 	static char buf[BUF_LEN];
 	char *tmp1, *tmp2;
@@ -6482,36 +6482,36 @@
 }
 
 gboolean
-oscar_offline_message(const GaimBuddy *buddy)
+oscar_offline_message(const PurpleBuddy *buddy)
 {
 	OscarData *od;
-	GaimAccount *account;
-	GaimConnection *gc;
-
-	account = gaim_buddy_get_account(buddy);
-	gc = gaim_account_get_connection(account);
+	PurpleAccount *account;
+	PurpleConnection *gc;
+
+	account = purple_buddy_get_account(buddy);
+	gc = purple_account_get_connection(account);
 	od = (OscarData *)gc->proto_data;
 
-	return (od->icq && aim_sn_is_icq(gaim_account_get_username(account)));
+	return (od->icq && aim_sn_is_icq(purple_account_get_username(account)));
 }
 
 /* TODO: Find somewhere to put this instead of including it in a bunch of places.
- * Maybe just change gaim_accounts_find() to return anything for the prpl if there is no acct_id.
+ * Maybe just change purple_accounts_find() to return anything for the prpl if there is no acct_id.
  */
-static GaimAccount *find_acct(const char *prpl, const char *acct_id)
+static PurpleAccount *find_acct(const char *prpl, const char *acct_id)
 {
-	GaimAccount *acct = NULL;
+	PurpleAccount *acct = NULL;
 
 	/* If we have a specific acct, use it */
 	if (acct_id) {
-		acct = gaim_accounts_find(acct_id, prpl);
-		if (acct && !gaim_account_is_connected(acct))
+		acct = purple_accounts_find(acct_id, prpl);
+		if (acct && !purple_account_is_connected(acct))
 			acct = NULL;
 	} else { /* Otherwise find an active account for the protocol */
-		GList *l = gaim_accounts_get_all();
+		GList *l = purple_accounts_get_all();
 		while (l) {
-			if (!strcmp(prpl, gaim_account_get_protocol_id(l->data))
-					&& gaim_account_is_connected(l->data)) {
+			if (!strcmp(prpl, purple_account_get_protocol_id(l->data))
+					&& purple_account_is_connected(l->data)) {
 				acct = l->data;
 				break;
 			}
@@ -6527,7 +6527,7 @@
 {
 	char *acct_id = g_hash_table_lookup(params, "account");
 	char prpl[11];
-	GaimAccount *acct;
+	PurpleAccount *acct;
 
 	if (g_ascii_strcasecmp(proto, "aim") && g_ascii_strcasecmp(proto, "icq"))
 		return FALSE;
@@ -6545,21 +6545,21 @@
 		if (sname) {
 			char *message = g_hash_table_lookup(params, "message");
 
-			GaimConversation *conv = gaim_find_conversation_with_account(
-				GAIM_CONV_TYPE_IM, sname, acct);
+			PurpleConversation *conv = purple_find_conversation_with_account(
+				PURPLE_CONV_TYPE_IM, sname, acct);
 			if (conv == NULL)
-				conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, acct, sname);
-			gaim_conversation_present(conv);
+				conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname);
+			purple_conversation_present(conv);
 
 			if (message) {
 				/* Spaces are encoded as '+' */
 				g_strdelimit(message, "+", ' ');
-				gaim_conv_im_send(GAIM_CONV_IM(conv), message);
+				purple_conv_im_send(PURPLE_CONV_IM(conv), message);
 			}
 		}
 		/*else
 			**If pidgindialogs_im() was in the core, we could use it here.
-			 * It is all gaim_request_* based, but I'm not sure it really belongs in the core
+			 * It is all purple_request_* based, but I'm not sure it really belongs in the core
 			pidgindialogs_im();*/
 
 		return TRUE;
@@ -6571,10 +6571,10 @@
 			/* This is somewhat hacky, but the params aren't useful after this command */
 			g_hash_table_insert(params, g_strdup("exchange"), g_strdup("4"));
 			g_hash_table_insert(params, g_strdup("room"), g_strdup(rname));
-			serv_join_chat(gaim_account_get_connection(acct), params);
+			serv_join_chat(purple_account_get_connection(acct), params);
 		}
 		/*else
-			** Same as above (except that this would have to be re-written using gaim_request_*)
+			** Same as above (except that this would have to be re-written using purple_request_*)
 			pidgin_blist_joinchat_show(); */
 
 		return TRUE;
@@ -6583,25 +6583,25 @@
 	else if (!g_ascii_strcasecmp(cmd, "AddBuddy")) {
 		char *sname = g_hash_table_lookup(params, "screenname");
 		char *gname = g_hash_table_lookup(params, "groupname");
-		gaim_blist_request_add_buddy(acct, sname, gname, NULL);
+		purple_blist_request_add_buddy(acct, sname, gname, NULL);
 		return TRUE;
 	}
 
 	return FALSE;
 }
 
-void oscar_init(GaimPluginProtocolInfo *prpl_info)
+void oscar_init(PurplePluginProtocolInfo *prpl_info)
 {
-	GaimAccountOption *option;
+	PurpleAccountOption *option;
 	static gboolean init = FALSE;
 
-	option = gaim_account_option_string_new(_("Server"), "server", OSCAR_DEFAULT_LOGIN_SERVER);
+	option = purple_account_option_string_new(_("Server"), "server", OSCAR_DEFAULT_LOGIN_SERVER);
 	prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
 
-	option = gaim_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT);
+	option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT);
 	prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
 
-	option = gaim_account_option_bool_new(
+	option = purple_account_option_bool_new(
 		_("Always use ICQ proxy server for file transfers\n(slower, but does not reveal your IP address)"), "always_use_rv_proxy",
 		OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY);
 	prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
@@ -6611,14 +6611,14 @@
 	init = TRUE;
 
 	/* Preferences */
-	gaim_prefs_add_none("/plugins/prpl/oscar");
-	gaim_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE);
-	gaim_prefs_add_bool("/plugins/prpl/oscar/show_idle", FALSE);
-	gaim_prefs_remove("/plugins/prpl/oscar/always_use_rv_proxy");
+	purple_prefs_add_none("/plugins/prpl/oscar");
+	purple_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE);
+	purple_prefs_add_bool("/plugins/prpl/oscar/show_idle", FALSE);
+	purple_prefs_remove("/plugins/prpl/oscar/always_use_rv_proxy");
 
 	/* protocol handler */
 	/* TODO: figure out a good instance to use here */
-	gaim_signal_connect(gaim_get_core(), "uri-handler", &init,
-		GAIM_CALLBACK(oscar_uri_handler), NULL);
-}
-
+	purple_signal_connect(purple_get_core(), "uri-handler", &init,
+		PURPLE_CALLBACK(oscar_uri_handler), NULL);
+}
+