changeset 7125:208cb260d7a7

[gaim-migrate @ 7692] as long as we're pissing off plugin developers... committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 02 Oct 2003 05:26:40 +0000
parents be4ca65b3b48
children eda3de6dacbb
files plugins/perl/common/BuddyList_Chat.xs src/blist.c src/blist.h src/buddyicon.c src/conversation.c src/dialogs.c src/gtkconv.c src/protocols/oscar/oscar.c
diffstat 8 files changed, 37 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/perl/common/BuddyList_Chat.xs	Thu Oct 02 04:56:25 2003 +0000
+++ b/plugins/perl/common/BuddyList_Chat.xs	Thu Oct 02 05:26:40 2003 +0000
@@ -14,20 +14,20 @@
 gaim_chat_get_display_name(chat)
 	Gaim::BuddyList::Chat chat
 CODE:
-	RETVAL = gaim_blist_chat_get_display_name(chat);
+	RETVAL = gaim_chat_get_display_name(chat);
 OUTPUT:
 	RETVAL
 
 Gaim::BuddyList::Group
-gaim_blist_chat_get_group(chat)
+gaim_chat_get_group(chat)
 	Gaim::BuddyList::Chat chat
 CODE:
-	RETVAL = gaim_blist_chat_get_group(chat);
+	RETVAL = gaim_chat_get_group(chat);
 OUTPUT:
 	RETVAL
 
 void
-gaim_blist_chat_set_setting(chat, key, value)
+gaim_chat_set_setting(chat, key, value)
 	Gaim::BuddyList::Chat chat
 	const char *key
 	const char *value
@@ -37,7 +37,7 @@
 	Gaim::BuddyList::Chat chat
 	const char *key
 CODE:
-	RETVAL = gaim_blist_chat_get_setting(chat, key);
+	RETVAL = gaim_chat_get_setting(chat, key);
 OUTPUT:
 	RETVAL
 
--- a/src/blist.c	Thu Oct 02 04:56:25 2003 +0000
+++ b/src/blist.c	Thu Oct 02 05:26:40 2003 +0000
@@ -432,7 +432,7 @@
 	}
 }
 
-GaimChat *gaim_blist_chat_new(GaimAccount *account, const char *alias, GHashTable *components)
+GaimChat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components)
 {
 	GaimChat *chat;
 	GaimBlistUiOps *ops;
@@ -458,7 +458,7 @@
 	return chat;
 }
 
-char *gaim_blist_chat_get_display_name(GaimChat *chat)
+char *gaim_chat_get_display_name(GaimChat *chat)
 {
 	char *name;
 
@@ -1169,7 +1169,7 @@
 	return ret ? ret : buddy->name;
 }
 
-const char *gaim_blist_chat_get_name(GaimChat *chat)
+const char *gaim_chat_get_name(GaimChat *chat)
 {
 	if(chat->alias && *chat->alias) {
 		return chat->alias;
@@ -1313,7 +1313,7 @@
 }
 
 GaimGroup *
-gaim_blist_chat_get_group(GaimChat *chat)
+gaim_chat_get_group(GaimChat *chat)
 {
 	g_return_val_if_fail(chat != NULL, NULL);
 
@@ -2025,7 +2025,7 @@
 		GaimAccount *account = gaim_accounts_find(blist_parser_account_name,
 				blist_parser_account_protocol);
 		if(account) {
-			GaimChat *chat = gaim_blist_chat_new(account,
+			GaimChat *chat = gaim_chat_new(account,
 					blist_parser_chat_alias, blist_parser_chat_components);
 			gaim_blist_add_chat(chat,blist_parser_group,
 					gaim_blist_get_last_child((GaimBlistNode*)blist_parser_group));
@@ -2548,13 +2548,13 @@
 	g_hash_table_replace(g->settings, g_strdup(key), g_strdup(value));
 }
 
-char *gaim_group_get_setting(GaimGroup *g, const char *key) {
+const char *gaim_group_get_setting(GaimGroup *g, const char *key) {
 	if(!g)
 		return NULL;
-	return g_strdup(g_hash_table_lookup(g->settings, key));
+	return g_hash_table_lookup(g->settings, key);
 }
 
-void gaim_blist_chat_set_setting(GaimChat *c, const char *key,
+void gaim_chat_set_setting(GaimChat *c, const char *key,
 		const char *value)
 {
 	if(!c)
@@ -2562,11 +2562,11 @@
 	g_hash_table_replace(c->settings, g_strdup(key), g_strdup(value));
 }
 
-char *gaim_blist_chat_get_setting(GaimChat *c, const char *key)
+const char *gaim_chat_get_setting(GaimChat *c, const char *key)
 {
 	if(!c)
 		return NULL;
-	return g_strdup(g_hash_table_lookup(c->settings, key));
+	return g_hash_table_lookup(c->settings, key);
 }
 
 void gaim_buddy_set_setting(GaimBuddy *b, const char *key,
@@ -2576,10 +2576,10 @@
 	g_hash_table_replace(b->settings, g_strdup(key), g_strdup(value));
 }
 
-char *gaim_buddy_get_setting(GaimBuddy *b, const char *key) {
+const char *gaim_buddy_get_setting(GaimBuddy *b, const char *key) {
 	if(!b)
 		return NULL;
-	return g_strdup(g_hash_table_lookup(b->settings, key));
+	return g_hash_table_lookup(b->settings, key);
 }
 
 int gaim_blist_get_group_size(GaimGroup *group, gboolean offline) {
--- a/src/blist.h	Thu Oct 02 04:56:25 2003 +0000
+++ b/src/blist.h	Thu Oct 02 05:26:40 2003 +0000
@@ -322,7 +322,7 @@
  * @param components The info the prpl needs to join the chat
  * @return           A newly allocated chat
  */
-GaimChat *gaim_blist_chat_new(GaimAccount *account, const char *alias, GHashTable *components);
+GaimChat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components);
 
 /**
  * Gets the alias of the chat, or the chat name if the alias does not exist
@@ -330,7 +330,7 @@
  * @param chat    The chat
  * @return        The display name of the chat
  */
-char *gaim_blist_chat_get_display_name(GaimChat *chat);
+char *gaim_chat_get_display_name(GaimChat *chat);
 
 /**
  * Adds a new chat to the buddy list.
@@ -519,7 +519,7 @@
  * @param chat   The chat whose name will be returned.
  * @return       The alias (if set), or first component value.
  */
-const char *gaim_blist_chat_get_name(GaimChat *chat);
+const char *gaim_chat_get_name(GaimChat *chat);
 
 /**
  * Finds the buddy struct given a screenname and an account
@@ -586,7 +586,7 @@
  *
  * @return The parent group, or @c NULL if the chat is not in a group.
  */
-GaimGroup *gaim_blist_chat_get_group(GaimChat *chat);
+GaimGroup *gaim_chat_get_group(GaimChat *chat);
 
 /**
  * Returns the group of which the buddy is a member.
@@ -720,7 +720,7 @@
  * @param key    The key to retrieve the data with
  * @return       The associated data or NULL if no data is associated
  */
-char *gaim_group_get_setting(GaimGroup *g, const char *key);
+const char *gaim_group_get_setting(GaimGroup *g, const char *key);
 
 /**
  * Associates some data with the chat in the xml buddy list
@@ -729,17 +729,17 @@
  * @param key    The key used to retrieve the data
  * @param value  The data to set
  */
-void gaim_blist_chat_set_setting(GaimChat *c, const char *key, const char *value);
+void gaim_chat_set_setting(GaimChat *c, const char *key, const char *value);
 
 /**
- * Retrieves data from the XML buddy list set by gaim_blist_chat_set_setting())
+ * Retrieves data from the XML buddy list set by gaim_chat_set_setting())
  *
  * @param c      The chat to retrieve data from
  * @param key    The key to retrieve the data with
  *
  * @return       The associated data or NULL if no data is associated
  */
-char *gaim_blist_chat_get_setting(GaimChat *c, const char *key);
+const char *gaim_chat_get_setting(GaimChat *c, const char *key);
 
 /**
  * Associates some data with the buddy in the xml buddy list
@@ -757,7 +757,7 @@
  * @param key    The key to retrieve the data with
  * @return       The associated data or NULL if no data is associated
  */
-char *gaim_buddy_get_setting(GaimBuddy *b, const char *key);
+const char *gaim_buddy_get_setting(GaimBuddy *b, const char *key);
 
 /*@}*/
 
--- a/src/buddyicon.c	Thu Oct 02 04:56:25 2003 +0000
+++ b/src/buddyicon.c	Thu Oct 02 05:26:40 2003 +0000
@@ -164,7 +164,7 @@
 	const char *dirname;
 	char *random;
 	char *filename;
-	char *old_icon;
+	const char *old_icon;
 	size_t len;
 	FILE *file = NULL;
 
@@ -202,10 +202,7 @@
 	}
 
 	if (old_icon != NULL)
-	{
 		unlink(old_icon);
-		g_free(old_icon);
-	}
 
 	gaim_buddy_set_setting(buddy, "buddy_icon", filename);
 	gaim_blist_save();
--- a/src/conversation.c	Thu Oct 02 04:56:25 2003 +0000
+++ b/src/conversation.c	Thu Oct 02 05:26:40 2003 +0000
@@ -2254,7 +2254,7 @@
 									gaim_conversation_get_name(conv));
 
 		if (chat != NULL)
-			group = gaim_blist_chat_get_group(chat);
+			group = gaim_chat_get_group(chat);
 
 		/* Go through the list of chats and find one with this group. */
 		for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
@@ -2276,7 +2276,7 @@
 					gaim_conversation_get_name(conv2));
 
 				if (chat2 != NULL)
-					group2 = gaim_blist_chat_get_group(chat2);
+					group2 = gaim_chat_get_group(chat2);
 
 				if (group == group2) {
 					gaim_conv_window_add_conversation(win2, conv);
--- a/src/dialogs.c	Thu Oct 02 04:56:25 2003 +0000
+++ b/src/dialogs.c	Thu Oct 02 05:26:40 2003 +0000
@@ -470,7 +470,7 @@
 
 void show_confirm_del_blist_chat(GaimChat *chat)
 {
-	char *name = gaim_blist_chat_get_display_name(chat);
+	char *name = gaim_chat_get_display_name(chat);
 	char *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list.  Do you want to continue?"), name);
 
 	gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2,
--- a/src/gtkconv.c	Thu Oct 02 04:56:25 2003 +0000
+++ b/src/gtkconv.c	Thu Oct 02 05:26:40 2003 +0000
@@ -5274,11 +5274,9 @@
 
 	if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv),
 					gaim_conversation_get_name(conv))) != NULL) {
-		char *file = gaim_buddy_get_setting(buddy, "buddy_icon");
-		if(file) {
+		const char *file;
+		if((file = gaim_buddy_get_setting(buddy, "buddy_icon")))
 			gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err);
-			g_free(file);
-		}
 	}
 	else
 	{
--- a/src/protocols/oscar/oscar.c	Thu Oct 02 04:56:25 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Oct 02 05:26:40 2003 +0000
@@ -1817,7 +1817,8 @@
 
 	/* Server stored icon stuff */
 	if (info->iconcsumlen) {
-		char *filename = NULL, *b16 = NULL, *saved_b16 = NULL;
+		const char *filename = NULL, *saved_b16 = NULL;
+		char *b16 = NULL;
 		GaimBuddy *b = NULL;
 
 		b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen);
@@ -1830,7 +1831,6 @@
 		if (filename != NULL) {
 			if (g_file_test(filename, G_FILE_TEST_EXISTS))
 				saved_b16 = gaim_buddy_get_setting(b, "icon_checksum");
-			g_free(filename);
 		} else
 			saved_b16 = NULL;
 
@@ -1845,7 +1845,6 @@
 				od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc);
 			}
 		}
-		g_free(saved_b16);
 		g_free(b16);
 	}
 
@@ -4896,11 +4895,10 @@
 							continue;
 						buddy = (GaimBuddy *)bnode;
 						if (buddy->account == gc->account) {
-							gchar *servernick = gaim_buddy_get_setting(buddy, "servernick");
-							if (servernick) {
+							const char *servernick = gaim_buddy_get_setting(buddy, "servernick");
+							if (servernick)
 								serv_got_alias(gc, buddy->name, servernick);
-								g_free(servernick);
-							}
+
 							if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) {
 								/* Store local alias on server */
 								char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name);