diff libpurple/pounce.c @ 15822:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 6d8728fd3dda
children f2d8658b3a86
line wrap: on
line diff
--- a/libpurple/pounce.c	Mon Mar 19 06:11:46 2007 +0000
+++ b/libpurple/pounce.c	Mon Mar 19 07:01:17 2007 +0000
@@ -2,9 +2,9 @@
  * @file pounce.c Buddy Pounce API
  * @ingroup core
  *
- * gaim
+ * purple
  *
- * Gaim is the legal property of its developers, whose names are too numerous
+ * Purple is the legal property of its developers, whose names are too numerous
  * to list here.  Please refer to the COPYRIGHT file distributed with this
  * source distribution.
  *
@@ -35,9 +35,9 @@
 {
 	GString *buffer;
 
-	GaimPounce *pounce;
-	GaimPounceEvent events;
-	GaimPounceOption options;
+	PurplePounce *pounce;
+	PurplePounceEvent events;
+	PurplePounceOption options;
 
 	char *ui_name;
 	char *pouncee;
@@ -58,16 +58,16 @@
 
 	GHashTable *atts;
 
-} GaimPounceActionData;
+} PurplePounceActionData;
 
 typedef struct
 {
 	char *ui;
-	GaimPounceCb cb;
-	void (*new_pounce)(GaimPounce *);
-	void (*free_pounce)(GaimPounce *);
+	PurplePounceCb cb;
+	void (*new_pounce)(PurplePounce *);
+	void (*free_pounce)(PurplePounce *);
 
-} GaimPounceHandler;
+} PurplePounceHandler;
 
 
 static GHashTable *pounce_handlers = NULL;
@@ -80,10 +80,10 @@
  * Private utility functions                                         *
  *********************************************************************/
 
-static GaimPounceActionData *
-find_action_data(const GaimPounce *pounce, const char *name)
+static PurplePounceActionData *
+find_action_data(const PurplePounce *pounce, const char *name)
 {
-	GaimPounceActionData *action;
+	PurplePounceActionData *action;
 
 	g_return_val_if_fail(pounce != NULL, NULL);
 	g_return_val_if_fail(name   != NULL, NULL);
@@ -96,7 +96,7 @@
 static void
 free_action_data(gpointer data)
 {
-	GaimPounceActionData *action_data = data;
+	PurplePounceActionData *action_data = data;
 
 	g_free(action_data->name);
 
@@ -129,11 +129,11 @@
 action_parameter_list_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
 {
 	const char *action;
-	GaimPounceActionData *action_data;
+	PurplePounceActionData *action_data;
 	xmlnode *node, *child;
 
 	action      = (const char *)key;
-	action_data = (GaimPounceActionData *)value;
+	action_data = (PurplePounceActionData *)value;
 	node        = (xmlnode *)user_data;
 
 	if (!action_data->enabled)
@@ -164,60 +164,60 @@
 }
 
 static xmlnode *
-pounce_to_xmlnode(GaimPounce *pounce)
+pounce_to_xmlnode(PurplePounce *pounce)
 {
 	xmlnode *node, *child;
-	GaimAccount *pouncer;
-	GaimPounceEvent events;
-	GaimPounceOption options;
+	PurpleAccount *pouncer;
+	PurplePounceEvent events;
+	PurplePounceOption options;
 
-	pouncer = gaim_pounce_get_pouncer(pounce);
-	events  = gaim_pounce_get_events(pounce);
-	options = gaim_pounce_get_options(pounce);
+	pouncer = purple_pounce_get_pouncer(pounce);
+	events  = purple_pounce_get_events(pounce);
+	options = purple_pounce_get_options(pounce);
 
 	node = xmlnode_new("pounce");
 	xmlnode_set_attrib(node, "ui", pounce->ui_type);
 
 	child = xmlnode_new_child(node, "account");
 	xmlnode_set_attrib(child, "protocol", pouncer->protocol_id);
-	xmlnode_insert_data(child, gaim_account_get_username(pouncer), -1);
+	xmlnode_insert_data(child, purple_account_get_username(pouncer), -1);
 
 	child = xmlnode_new_child(node, "pouncee");
-	xmlnode_insert_data(child, gaim_pounce_get_pouncee(pounce), -1);
+	xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1);
 
 	/* Write pounce options */
 	child = xmlnode_new_child(node, "options");
-	if (options & GAIM_POUNCE_OPTION_AWAY)
+	if (options & PURPLE_POUNCE_OPTION_AWAY)
 		add_option_to_xmlnode(child, "on-away");
 
 	/* Write pounce events */
 	child = xmlnode_new_child(node, "events");
-	if (events & GAIM_POUNCE_SIGNON)
+	if (events & PURPLE_POUNCE_SIGNON)
 		add_event_to_xmlnode(child, "sign-on");
-	if (events & GAIM_POUNCE_SIGNOFF)
+	if (events & PURPLE_POUNCE_SIGNOFF)
 		add_event_to_xmlnode(child, "sign-off");
-	if (events & GAIM_POUNCE_AWAY)
+	if (events & PURPLE_POUNCE_AWAY)
 		add_event_to_xmlnode(child, "away");
-	if (events & GAIM_POUNCE_AWAY_RETURN)
+	if (events & PURPLE_POUNCE_AWAY_RETURN)
 		add_event_to_xmlnode(child, "return-from-away");
-	if (events & GAIM_POUNCE_IDLE)
+	if (events & PURPLE_POUNCE_IDLE)
 		add_event_to_xmlnode(child, "idle");
-	if (events & GAIM_POUNCE_IDLE_RETURN)
+	if (events & PURPLE_POUNCE_IDLE_RETURN)
 		add_event_to_xmlnode(child, "return-from-idle");
-	if (events & GAIM_POUNCE_TYPING)
+	if (events & PURPLE_POUNCE_TYPING)
 		add_event_to_xmlnode(child, "start-typing");
-	if (events & GAIM_POUNCE_TYPED)
+	if (events & PURPLE_POUNCE_TYPED)
 		add_event_to_xmlnode(child, "typed");
-	if (events & GAIM_POUNCE_TYPING_STOPPED)
+	if (events & PURPLE_POUNCE_TYPING_STOPPED)
 		add_event_to_xmlnode(child, "stop-typing");
-	if (events & GAIM_POUNCE_MESSAGE_RECEIVED)
+	if (events & PURPLE_POUNCE_MESSAGE_RECEIVED)
 		add_event_to_xmlnode(child, "message-received");
 
 	/* Write pounce actions */
 	child = xmlnode_new_child(node, "actions");
 	g_hash_table_foreach(pounce->actions, action_parameter_list_to_xmlnode, child);
 
-	if (gaim_pounce_get_save(pounce))
+	if (purple_pounce_get_save(pounce))
 		child = xmlnode_new_child(node, "save");
 
 	return node;
@@ -232,7 +232,7 @@
 	node = xmlnode_new("pounces");
 	xmlnode_set_attrib(node, "version", "1.0");
 
-	for (cur = gaim_pounces_get_all(); cur != NULL; cur = cur->next)
+	for (cur = purple_pounces_get_all(); cur != NULL; cur = cur->next)
 	{
 		child = pounce_to_xmlnode(cur->data);
 		xmlnode_insert_child(node, child);
@@ -249,14 +249,14 @@
 
 	if (!pounces_loaded)
 	{
-		gaim_debug_error("pounce", "Attempted to save buddy pounces before "
+		purple_debug_error("pounce", "Attempted to save buddy pounces before "
 						 "they were read!\n");
 		return;
 	}
 
 	node = pounces_to_xmlnode();
 	data = xmlnode_to_formatted_str(node, NULL);
-	gaim_util_write_data_to_file("pounces.xml", data, -1);
+	purple_util_write_data_to_file("pounces.xml", data, -1);
 	g_free(data);
 	xmlnode_free(node);
 }
@@ -273,7 +273,7 @@
 schedule_pounces_save(void)
 {
 	if (save_timer == 0)
-		save_timer = gaim_timeout_add(5000, save_cb, NULL);
+		save_timer = purple_timeout_add(5000, save_cb, NULL);
 }
 
 
@@ -328,7 +328,7 @@
 		const char *ui = g_hash_table_lookup(atts, "ui");
 
 		if (ui == NULL) {
-			gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+			purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 					   "Unset 'ui' parameter for pounce!\n");
 		}
 		else
@@ -340,7 +340,7 @@
 		const char *protocol_id = g_hash_table_lookup(atts, "protocol");
 
 		if (protocol_id == NULL) {
-			gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+			purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 					   "Unset 'protocol' parameter for account!\n");
 		}
 		else
@@ -350,7 +350,7 @@
 		const char *type = g_hash_table_lookup(atts, "type");
 
 		if (type == NULL) {
-			gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+			purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 					   "Unset 'type' parameter for option!\n");
 		}
 		else
@@ -360,7 +360,7 @@
 		const char *type = g_hash_table_lookup(atts, "type");
 
 		if (type == NULL) {
-			gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+			purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 					   "Unset 'type' parameter for event!\n");
 		}
 		else
@@ -370,7 +370,7 @@
 		const char *type = g_hash_table_lookup(atts, "type");
 
 		if (type == NULL) {
-			gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+			purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 					   "Unset 'type' parameter for action!\n");
 		}
 		else
@@ -380,7 +380,7 @@
 		const char *param_name = g_hash_table_lookup(atts, "name");
 
 		if (param_name == NULL) {
-			gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+			purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 					   "Unset 'name' parameter for param!\n");
 		}
 		else
@@ -407,7 +407,7 @@
 		g_free(data->account_name);
 		data->account_name = g_strdup(buffer);
 		tmp = data->protocol_id;
-		data->protocol_id = g_strdup(_gaim_oscar_convert(buffer, tmp));
+		data->protocol_id = g_strdup(_purple_oscar_convert(buffer, tmp));
 		g_free(tmp);
 	}
 	else if (!strcmp(element_name, "pouncee")) {
@@ -416,40 +416,40 @@
 	}
 	else if (!strcmp(element_name, "option")) {
 		if (!strcmp(data->option_type, "on-away"))
-			data->options |= GAIM_POUNCE_OPTION_AWAY;
+			data->options |= PURPLE_POUNCE_OPTION_AWAY;
 
 		g_free(data->option_type);
 		data->option_type = NULL;
 	}
 	else if (!strcmp(element_name, "event")) {
 		if (!strcmp(data->event_type, "sign-on"))
-			data->events |= GAIM_POUNCE_SIGNON;
+			data->events |= PURPLE_POUNCE_SIGNON;
 		else if (!strcmp(data->event_type, "sign-off"))
-			data->events |= GAIM_POUNCE_SIGNOFF;
+			data->events |= PURPLE_POUNCE_SIGNOFF;
 		else if (!strcmp(data->event_type, "away"))
-			data->events |= GAIM_POUNCE_AWAY;
+			data->events |= PURPLE_POUNCE_AWAY;
 		else if (!strcmp(data->event_type, "return-from-away"))
-			data->events |= GAIM_POUNCE_AWAY_RETURN;
+			data->events |= PURPLE_POUNCE_AWAY_RETURN;
 		else if (!strcmp(data->event_type, "idle"))
-			data->events |= GAIM_POUNCE_IDLE;
+			data->events |= PURPLE_POUNCE_IDLE;
 		else if (!strcmp(data->event_type, "return-from-idle"))
-			data->events |= GAIM_POUNCE_IDLE_RETURN;
+			data->events |= PURPLE_POUNCE_IDLE_RETURN;
 		else if (!strcmp(data->event_type, "start-typing"))
-			data->events |= GAIM_POUNCE_TYPING;
+			data->events |= PURPLE_POUNCE_TYPING;
 		else if (!strcmp(data->event_type, "typed"))
-			data->events |= GAIM_POUNCE_TYPED;
+			data->events |= PURPLE_POUNCE_TYPED;
 		else if (!strcmp(data->event_type, "stop-typing"))
-			data->events |= GAIM_POUNCE_TYPING_STOPPED;
+			data->events |= PURPLE_POUNCE_TYPING_STOPPED;
 		else if (!strcmp(data->event_type, "message-received"))
-			data->events |= GAIM_POUNCE_MESSAGE_RECEIVED;
+			data->events |= PURPLE_POUNCE_MESSAGE_RECEIVED;
 
 		g_free(data->event_type);
 		data->event_type = NULL;
 	}
 	else if (!strcmp(element_name, "action")) {
 		if (data->pounce != NULL) {
-			gaim_pounce_action_register(data->pounce, data->action_name);
-			gaim_pounce_action_set_enabled(data->pounce, data->action_name, TRUE);
+			purple_pounce_action_register(data->pounce, data->action_name);
+			purple_pounce_action_set_enabled(data->pounce, data->action_name, TRUE);
 		}
 
 		g_free(data->action_name);
@@ -457,7 +457,7 @@
 	}
 	else if (!strcmp(element_name, "param")) {
 		if (data->pounce != NULL) {
-			gaim_pounce_action_set_attribute(data->pounce, data->action_name,
+			purple_pounce_action_set_attribute(data->pounce, data->action_name,
 											 data->param_name, buffer);
 		}
 
@@ -465,9 +465,9 @@
 		data->param_name = NULL;
 	}
 	else if (!strcmp(element_name, "events")) {
-		GaimAccount *account;
+		PurpleAccount *account;
 
-		account = gaim_accounts_find(data->account_name, data->protocol_id);
+		account = purple_accounts_find(data->account_name, data->protocol_id);
 
 		g_free(data->account_name);
 		g_free(data->protocol_id);
@@ -476,7 +476,7 @@
 		data->protocol_id  = NULL;
 
 		if (account == NULL) {
-			gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+			purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 					   "Account for pounce not found!\n");
 			/*
 			 * This pounce has effectively been removed, so make
@@ -485,11 +485,11 @@
 			schedule_pounces_save();
 		}
 		else {
-			gaim_debug(GAIM_DEBUG_INFO, "pounce",
+			purple_debug(PURPLE_DEBUG_INFO, "pounce",
 					   "Creating pounce: %s, %s\n", data->ui_name,
 					   data->pouncee);
 
-			data->pounce = gaim_pounce_new(data->ui_name, account,
+			data->pounce = purple_pounce_new(data->ui_name, account,
 										   data->pouncee, data->events,
 										   data->options);
 		}
@@ -499,7 +499,7 @@
 	}
 	else if (!strcmp(element_name, "save")) {
 		if (data->pounce != NULL)
-			gaim_pounce_set_save(data->pounce, TRUE);
+			purple_pounce_set_save(data->pounce, TRUE);
 	}
 	else if (!strcmp(element_name, "pounce")) {
 		data->pounce  = NULL;
@@ -550,9 +550,9 @@
 };
 
 gboolean
-gaim_pounces_load(void)
+purple_pounces_load(void)
 {
-	gchar *filename = g_build_filename(gaim_user_dir(), "pounces.xml", NULL);
+	gchar *filename = g_build_filename(purple_user_dir(), "pounces.xml", NULL);
 	gchar *contents = NULL;
 	gsize length;
 	GMarkupParseContext *context;
@@ -565,7 +565,7 @@
 	}
 
 	if (!g_file_get_contents(filename, &contents, &length, &error)) {
-		gaim_debug(GAIM_DEBUG_ERROR, "pounce",
+		purple_debug(PURPLE_DEBUG_ERROR, "pounce",
 				   "Error reading pounces: %s\n", error->message);
 
 		g_free(filename);
@@ -591,7 +591,7 @@
 	}
 
 	if (!g_markup_parse_context_end_parse(context, NULL)) {
-		gaim_debug(GAIM_DEBUG_ERROR, "pounce", "Error parsing %s\n",
+		purple_debug(PURPLE_DEBUG_ERROR, "pounce", "Error parsing %s\n",
 				   filename);
 
 		g_markup_parse_context_free(context);
@@ -612,20 +612,20 @@
 }
 
 
-GaimPounce *
-gaim_pounce_new(const char *ui_type, GaimAccount *pouncer,
-				const char *pouncee, GaimPounceEvent event,
-				GaimPounceOption option)
+PurplePounce *
+purple_pounce_new(const char *ui_type, PurpleAccount *pouncer,
+				const char *pouncee, PurplePounceEvent event,
+				PurplePounceOption option)
 {
-	GaimPounce *pounce;
-	GaimPounceHandler *handler;
+	PurplePounce *pounce;
+	PurplePounceHandler *handler;
 
 	g_return_val_if_fail(ui_type != NULL, NULL);
 	g_return_val_if_fail(pouncer != NULL, NULL);
 	g_return_val_if_fail(pouncee != NULL, NULL);
 	g_return_val_if_fail(event   != 0,    NULL);
 
-	pounce = g_new0(GaimPounce, 1);
+	pounce = g_new0(PurplePounce, 1);
 
 	pounce->ui_type  = g_strdup(ui_type);
 	pounce->pouncer  = pouncer;
@@ -649,9 +649,9 @@
 }
 
 void
-gaim_pounce_destroy(GaimPounce *pounce)
+purple_pounce_destroy(PurplePounce *pounce)
 {
-	GaimPounceHandler *handler;
+	PurplePounceHandler *handler;
 
 	g_return_if_fail(pounce != NULL);
 
@@ -673,30 +673,30 @@
 }
 
 void
-gaim_pounce_destroy_all_by_account(GaimAccount *account)
+purple_pounce_destroy_all_by_account(PurpleAccount *account)
 {
-	GaimAccount *pouncer;
-	GaimPounce *pounce;
+	PurpleAccount *pouncer;
+	PurplePounce *pounce;
 	GList *l, *l_next;
 
 	g_return_if_fail(account != NULL);
 
-	for (l = gaim_pounces_get_all(); l != NULL; l = l_next)
+	for (l = purple_pounces_get_all(); l != NULL; l = l_next)
 	{
-		pounce = (GaimPounce *)l->data;
+		pounce = (PurplePounce *)l->data;
 		l_next = l->next;
 
-		pouncer = gaim_pounce_get_pouncer(pounce);
+		pouncer = purple_pounce_get_pouncer(pounce);
 		if (pouncer == account)
-			gaim_pounce_destroy(pounce);
+			purple_pounce_destroy(pounce);
 	}
 }
 
 void
-gaim_pounce_set_events(GaimPounce *pounce, GaimPounceEvent events)
+purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events)
 {
 	g_return_if_fail(pounce != NULL);
-	g_return_if_fail(events != GAIM_POUNCE_NONE);
+	g_return_if_fail(events != PURPLE_POUNCE_NONE);
 
 	pounce->events = events;
 
@@ -704,7 +704,7 @@
 }
 
 void
-gaim_pounce_set_options(GaimPounce *pounce, GaimPounceOption options)
+purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options)
 {
 	g_return_if_fail(pounce  != NULL);
 
@@ -714,7 +714,7 @@
 }
 
 void
-gaim_pounce_set_pouncer(GaimPounce *pounce, GaimAccount *pouncer)
+purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer)
 {
 	g_return_if_fail(pounce  != NULL);
 	g_return_if_fail(pouncer != NULL);
@@ -725,7 +725,7 @@
 }
 
 void
-gaim_pounce_set_pouncee(GaimPounce *pounce, const char *pouncee)
+purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee)
 {
 	g_return_if_fail(pounce  != NULL);
 	g_return_if_fail(pouncee != NULL);
@@ -737,7 +737,7 @@
 }
 
 void
-gaim_pounce_set_save(GaimPounce *pounce, gboolean save)
+purple_pounce_set_save(PurplePounce *pounce, gboolean save)
 {
 	g_return_if_fail(pounce != NULL);
 
@@ -747,9 +747,9 @@
 }
 
 void
-gaim_pounce_action_register(GaimPounce *pounce, const char *name)
+purple_pounce_action_register(PurplePounce *pounce, const char *name)
 {
-	GaimPounceActionData *action_data;
+	PurplePounceActionData *action_data;
 
 	g_return_if_fail(pounce != NULL);
 	g_return_if_fail(name   != NULL);
@@ -757,7 +757,7 @@
 	if (g_hash_table_lookup(pounce->actions, name) != NULL)
 		return;
 
-	action_data = g_new0(GaimPounceActionData, 1);
+	action_data = g_new0(PurplePounceActionData, 1);
 
 	action_data->name    = g_strdup(name);
 	action_data->enabled = FALSE;
@@ -770,10 +770,10 @@
 }
 
 void
-gaim_pounce_action_set_enabled(GaimPounce *pounce, const char *action,
+purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action,
 							   gboolean enabled)
 {
-	GaimPounceActionData *action_data;
+	PurplePounceActionData *action_data;
 
 	g_return_if_fail(pounce != NULL);
 	g_return_if_fail(action != NULL);
@@ -788,10 +788,10 @@
 }
 
 void
-gaim_pounce_action_set_attribute(GaimPounce *pounce, const char *action,
+purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action,
 								 const char *attr, const char *value)
 {
-	GaimPounceActionData *action_data;
+	PurplePounceActionData *action_data;
 
 	g_return_if_fail(pounce != NULL);
 	g_return_if_fail(action != NULL);
@@ -811,7 +811,7 @@
 }
 
 void
-gaim_pounce_set_data(GaimPounce *pounce, void *data)
+purple_pounce_set_data(PurplePounce *pounce, void *data)
 {
 	g_return_if_fail(pounce != NULL);
 
@@ -820,24 +820,24 @@
 	schedule_pounces_save();
 }
 
-GaimPounceEvent
-gaim_pounce_get_events(const GaimPounce *pounce)
+PurplePounceEvent
+purple_pounce_get_events(const PurplePounce *pounce)
 {
-	g_return_val_if_fail(pounce != NULL, GAIM_POUNCE_NONE);
+	g_return_val_if_fail(pounce != NULL, PURPLE_POUNCE_NONE);
 
 	return pounce->events;
 }
 
-GaimPounceOption
-gaim_pounce_get_options(const GaimPounce *pounce)
+PurplePounceOption
+purple_pounce_get_options(const PurplePounce *pounce)
 {
-	g_return_val_if_fail(pounce != NULL, GAIM_POUNCE_OPTION_NONE);
+	g_return_val_if_fail(pounce != NULL, PURPLE_POUNCE_OPTION_NONE);
 
 	return pounce->options;
 }
 
-GaimAccount *
-gaim_pounce_get_pouncer(const GaimPounce *pounce)
+PurpleAccount *
+purple_pounce_get_pouncer(const PurplePounce *pounce)
 {
 	g_return_val_if_fail(pounce != NULL, NULL);
 
@@ -845,7 +845,7 @@
 }
 
 const char *
-gaim_pounce_get_pouncee(const GaimPounce *pounce)
+purple_pounce_get_pouncee(const PurplePounce *pounce)
 {
 	g_return_val_if_fail(pounce != NULL, NULL);
 
@@ -853,7 +853,7 @@
 }
 
 gboolean
-gaim_pounce_get_save(const GaimPounce *pounce)
+purple_pounce_get_save(const PurplePounce *pounce)
 {
 	g_return_val_if_fail(pounce != NULL, FALSE);
 
@@ -861,9 +861,9 @@
 }
 
 gboolean
-gaim_pounce_action_is_enabled(const GaimPounce *pounce, const char *action)
+purple_pounce_action_is_enabled(const PurplePounce *pounce, const char *action)
 {
-	GaimPounceActionData *action_data;
+	PurplePounceActionData *action_data;
 
 	g_return_val_if_fail(pounce != NULL, FALSE);
 	g_return_val_if_fail(action != NULL, FALSE);
@@ -876,10 +876,10 @@
 }
 
 const char *
-gaim_pounce_action_get_attribute(const GaimPounce *pounce,
+purple_pounce_action_get_attribute(const PurplePounce *pounce,
 								 const char *action, const char *attr)
 {
-	GaimPounceActionData *action_data;
+	PurplePounceActionData *action_data;
 
 	g_return_val_if_fail(pounce != NULL, NULL);
 	g_return_val_if_fail(action != NULL, NULL);
@@ -893,7 +893,7 @@
 }
 
 void *
-gaim_pounce_get_data(const GaimPounce *pounce)
+purple_pounce_get_data(const PurplePounce *pounce)
 {
 	g_return_val_if_fail(pounce != NULL, NULL);
 
@@ -901,44 +901,44 @@
 }
 
 void
-gaim_pounce_execute(const GaimAccount *pouncer, const char *pouncee,
-					GaimPounceEvent events)
+purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee,
+					PurplePounceEvent events)
 {
-	GaimPounce *pounce;
-	GaimPounceHandler *handler;
-	GaimPresence *presence;
+	PurplePounce *pounce;
+	PurplePounceHandler *handler;
+	PurplePresence *presence;
 	GList *l, *l_next;
 	char *norm_pouncee;
 
 	g_return_if_fail(pouncer != NULL);
 	g_return_if_fail(pouncee != NULL);
-	g_return_if_fail(events  != GAIM_POUNCE_NONE);
+	g_return_if_fail(events  != PURPLE_POUNCE_NONE);
 
-	norm_pouncee = g_strdup(gaim_normalize(pouncer, pouncee));
+	norm_pouncee = g_strdup(purple_normalize(pouncer, pouncee));
 
-	for (l = gaim_pounces_get_all(); l != NULL; l = l_next)
+	for (l = purple_pounces_get_all(); l != NULL; l = l_next)
 	{
-		pounce = (GaimPounce *)l->data;
+		pounce = (PurplePounce *)l->data;
 		l_next = l->next;
 
-		presence = gaim_account_get_presence(pouncer);
+		presence = purple_account_get_presence(pouncer);
 
-		if ((gaim_pounce_get_events(pounce) & events) &&
-			(gaim_pounce_get_pouncer(pounce) == pouncer) &&
-			!gaim_utf8_strcasecmp(gaim_normalize(pouncer, gaim_pounce_get_pouncee(pounce)),
+		if ((purple_pounce_get_events(pounce) & events) &&
+			(purple_pounce_get_pouncer(pounce) == pouncer) &&
+			!purple_utf8_strcasecmp(purple_normalize(pouncer, purple_pounce_get_pouncee(pounce)),
 								  norm_pouncee) &&
-			(pounce->options == GAIM_POUNCE_OPTION_NONE ||
-			 (pounce->options & GAIM_POUNCE_OPTION_AWAY &&
-			  !gaim_presence_is_available(presence))))
+			(pounce->options == PURPLE_POUNCE_OPTION_NONE ||
+			 (pounce->options & PURPLE_POUNCE_OPTION_AWAY &&
+			  !purple_presence_is_available(presence))))
 		{
 			handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type);
 
 			if (handler != NULL && handler->cb != NULL)
 			{
-				handler->cb(pounce, events, gaim_pounce_get_data(pounce));
+				handler->cb(pounce, events, purple_pounce_get_data(pounce));
 
-				if (!gaim_pounce_get_save(pounce))
-					gaim_pounce_destroy(pounce);
+				if (!purple_pounce_get_save(pounce))
+					purple_pounce_destroy(pounce);
 			}
 		}
 	}
@@ -946,27 +946,27 @@
 	g_free(norm_pouncee);
 }
 
-GaimPounce *
-gaim_find_pounce(const GaimAccount *pouncer, const char *pouncee,
-				 GaimPounceEvent events)
+PurplePounce *
+purple_find_pounce(const PurpleAccount *pouncer, const char *pouncee,
+				 PurplePounceEvent events)
 {
-	GaimPounce *pounce = NULL;
+	PurplePounce *pounce = NULL;
 	GList *l;
 	char *norm_pouncee;
 
 	g_return_val_if_fail(pouncer != NULL, NULL);
 	g_return_val_if_fail(pouncee != NULL, NULL);
-	g_return_val_if_fail(events  != GAIM_POUNCE_NONE, NULL);
+	g_return_val_if_fail(events  != PURPLE_POUNCE_NONE, NULL);
 
-	norm_pouncee = g_strdup(gaim_normalize(pouncer, pouncee));
+	norm_pouncee = g_strdup(purple_normalize(pouncer, pouncee));
 
-	for (l = gaim_pounces_get_all(); l != NULL; l = l->next)
+	for (l = purple_pounces_get_all(); l != NULL; l = l->next)
 	{
-		pounce = (GaimPounce *)l->data;
+		pounce = (PurplePounce *)l->data;
 
-		if ((gaim_pounce_get_events(pounce) & events) &&
-			(gaim_pounce_get_pouncer(pounce) == pouncer) &&
-			!gaim_utf8_strcasecmp(gaim_normalize(pouncer, gaim_pounce_get_pouncee(pounce)),
+		if ((purple_pounce_get_events(pounce) & events) &&
+			(purple_pounce_get_pouncer(pounce) == pouncer) &&
+			!purple_utf8_strcasecmp(purple_normalize(pouncer, purple_pounce_get_pouncee(pounce)),
 								  norm_pouncee))
 		{
 			break;
@@ -981,16 +981,16 @@
 }
 
 void
-gaim_pounces_register_handler(const char *ui, GaimPounceCb cb,
-							  void (*new_pounce)(GaimPounce *pounce),
-							  void (*free_pounce)(GaimPounce *pounce))
+purple_pounces_register_handler(const char *ui, PurplePounceCb cb,
+							  void (*new_pounce)(PurplePounce *pounce),
+							  void (*free_pounce)(PurplePounce *pounce))
 {
-	GaimPounceHandler *handler;
+	PurplePounceHandler *handler;
 
 	g_return_if_fail(ui != NULL);
 	g_return_if_fail(cb != NULL);
 
-	handler = g_new0(GaimPounceHandler, 1);
+	handler = g_new0(PurplePounceHandler, 1);
 
 	handler->ui          = g_strdup(ui);
 	handler->cb          = cb;
@@ -1001,7 +1001,7 @@
 }
 
 void
-gaim_pounces_unregister_handler(const char *ui)
+purple_pounces_unregister_handler(const char *ui)
 {
 	g_return_if_fail(ui != NULL);
 
@@ -1009,7 +1009,7 @@
 }
 
 GList *
-gaim_pounces_get_all(void)
+purple_pounces_get_all(void)
 {
 	return pounces;
 }
@@ -1017,77 +1017,77 @@
 static void
 free_pounce_handler(gpointer user_data)
 {
-	GaimPounceHandler *handler = (GaimPounceHandler *)user_data;
+	PurplePounceHandler *handler = (PurplePounceHandler *)user_data;
 
 	g_free(handler->ui);
 	g_free(handler);
 }
 
 static void
-buddy_state_cb(GaimBuddy *buddy, GaimPounceEvent event)
+buddy_state_cb(PurpleBuddy *buddy, PurplePounceEvent event)
 {
-	gaim_pounce_execute(buddy->account, buddy->name, event);
+	purple_pounce_execute(buddy->account, buddy->name, event);
 }
 
 static void
-buddy_status_changed_cb(GaimBuddy *buddy, GaimStatus *old_status,
-                        GaimStatus *status)
+buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status,
+                        PurpleStatus *status)
 {
 	gboolean old_available, available;
 
-	available = gaim_status_is_available(status);
-	old_available = gaim_status_is_available(old_status);
+	available = purple_status_is_available(status);
+	old_available = purple_status_is_available(old_status);
 
 	if (available && !old_available)
-		gaim_pounce_execute(buddy->account, buddy->name,
-		                    GAIM_POUNCE_AWAY_RETURN);
+		purple_pounce_execute(buddy->account, buddy->name,
+		                    PURPLE_POUNCE_AWAY_RETURN);
 	else if (!available && old_available)
-		gaim_pounce_execute(buddy->account, buddy->name,
-		                    GAIM_POUNCE_AWAY);
+		purple_pounce_execute(buddy->account, buddy->name,
+		                    PURPLE_POUNCE_AWAY);
 }
 
 static void
-buddy_idle_changed_cb(GaimBuddy *buddy, gboolean old_idle, gboolean idle)
+buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle)
 {
 	if (idle && !old_idle)
-		gaim_pounce_execute(buddy->account, buddy->name,
-		                    GAIM_POUNCE_IDLE);
+		purple_pounce_execute(buddy->account, buddy->name,
+		                    PURPLE_POUNCE_IDLE);
 	else if (!idle && old_idle)
-		gaim_pounce_execute(buddy->account, buddy->name,
-		                    GAIM_POUNCE_IDLE_RETURN);
+		purple_pounce_execute(buddy->account, buddy->name,
+		                    PURPLE_POUNCE_IDLE_RETURN);
 }
 
 static void
-buddy_typing_cb(GaimAccount *account, const char *name, void *data)
+buddy_typing_cb(PurpleAccount *account, const char *name, void *data)
 {
-	GaimConversation *conv;
+	PurpleConversation *conv;
 
-	conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account);
 	if (conv != NULL)
 	{
-		GaimTypingState state;
-		GaimPounceEvent event;
+		PurpleTypingState state;
+		PurplePounceEvent event;
 
-		state = gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv));
-		if (state == GAIM_TYPED)
-			event = GAIM_POUNCE_TYPED;
-		else if (state == GAIM_NOT_TYPING)
-			event = GAIM_POUNCE_TYPING_STOPPED;
+		state = purple_conv_im_get_typing_state(PURPLE_CONV_IM(conv));
+		if (state == PURPLE_TYPED)
+			event = PURPLE_POUNCE_TYPED;
+		else if (state == PURPLE_NOT_TYPING)
+			event = PURPLE_POUNCE_TYPING_STOPPED;
 		else
-			event = GAIM_POUNCE_TYPING;
+			event = PURPLE_POUNCE_TYPING;
 
-		gaim_pounce_execute(account, name, event);
+		purple_pounce_execute(account, name, event);
 	}
 }
 
 static void
-received_message_cb(GaimAccount *account, const char *name, void *data)
+received_message_cb(PurpleAccount *account, const char *name, void *data)
 {
-	gaim_pounce_execute(account, name, GAIM_POUNCE_MESSAGE_RECEIVED);
+	purple_pounce_execute(account, name, PURPLE_POUNCE_MESSAGE_RECEIVED);
 }
 
 void *
-gaim_pounces_get_handle(void)
+purple_pounces_get_handle(void)
 {
 	static int pounce_handle;
 
@@ -1095,46 +1095,46 @@
 }
 
 void
-gaim_pounces_init(void)
+purple_pounces_init(void)
 {
-	void *handle       = gaim_pounces_get_handle();
-	void *blist_handle = gaim_blist_get_handle();
-	void *conv_handle  = gaim_conversations_get_handle();
+	void *handle       = purple_pounces_get_handle();
+	void *blist_handle = purple_blist_get_handle();
+	void *conv_handle  = purple_conversations_get_handle();
 
 	pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal,
 											g_free, free_pounce_handler);
 
-	gaim_signal_connect(blist_handle, "buddy-idle-changed",
-	                    handle, GAIM_CALLBACK(buddy_idle_changed_cb), NULL);
-	gaim_signal_connect(blist_handle, "buddy-status-changed",
-	                    handle, GAIM_CALLBACK(buddy_status_changed_cb), NULL);
-	gaim_signal_connect(blist_handle, "buddy-signed-on",
-						handle, GAIM_CALLBACK(buddy_state_cb),
-						GINT_TO_POINTER(GAIM_POUNCE_SIGNON));
-	gaim_signal_connect(blist_handle, "buddy-signed-off",
-						handle, GAIM_CALLBACK(buddy_state_cb),
-						GINT_TO_POINTER(GAIM_POUNCE_SIGNOFF));
+	purple_signal_connect(blist_handle, "buddy-idle-changed",
+	                    handle, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL);
+	purple_signal_connect(blist_handle, "buddy-status-changed",
+	                    handle, PURPLE_CALLBACK(buddy_status_changed_cb), NULL);
+	purple_signal_connect(blist_handle, "buddy-signed-on",
+						handle, PURPLE_CALLBACK(buddy_state_cb),
+						GINT_TO_POINTER(PURPLE_POUNCE_SIGNON));
+	purple_signal_connect(blist_handle, "buddy-signed-off",
+						handle, PURPLE_CALLBACK(buddy_state_cb),
+						GINT_TO_POINTER(PURPLE_POUNCE_SIGNOFF));
 
-	gaim_signal_connect(conv_handle, "buddy-typing",
-						handle, GAIM_CALLBACK(buddy_typing_cb), NULL);
-	gaim_signal_connect(conv_handle, "buddy-typed",
-						handle, GAIM_CALLBACK(buddy_typing_cb), NULL);
-	gaim_signal_connect(conv_handle, "buddy-typing-stopped",
-						handle, GAIM_CALLBACK(buddy_typing_cb), NULL);
+	purple_signal_connect(conv_handle, "buddy-typing",
+						handle, PURPLE_CALLBACK(buddy_typing_cb), NULL);
+	purple_signal_connect(conv_handle, "buddy-typed",
+						handle, PURPLE_CALLBACK(buddy_typing_cb), NULL);
+	purple_signal_connect(conv_handle, "buddy-typing-stopped",
+						handle, PURPLE_CALLBACK(buddy_typing_cb), NULL);
 
-	gaim_signal_connect(conv_handle, "received-im-msg",
-						handle, GAIM_CALLBACK(received_message_cb), NULL);
+	purple_signal_connect(conv_handle, "received-im-msg",
+						handle, PURPLE_CALLBACK(received_message_cb), NULL);
 }
 
 void
-gaim_pounces_uninit()
+purple_pounces_uninit()
 {
 	if (save_timer != 0)
 	{
-		gaim_timeout_remove(save_timer);
+		purple_timeout_remove(save_timer);
 		save_timer = 0;
 		sync_pounces();
 	}
 
-	gaim_signals_disconnect_by_handle(gaim_pounces_get_handle());
+	purple_signals_disconnect_by_handle(purple_pounces_get_handle());
 }