changeset 23189:7e0b815d2133

merge of '45401c961ca97b6dd3675db39ca8d46f5142dada' and '886c30a3d3006c7497f9e6ce6354ba660e5505bd'
author Richard Laager <rlaager@wiktel.com>
date Sun, 25 May 2008 22:06:51 +0000
parents e0bcb8cfda74 (current diff) 50b33c18815e (diff)
children eab3ce582cac 66ccd61eaff6
files
diffstat 5 files changed, 28 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Smiley.xs	Sun May 25 21:56:36 2008 +0000
+++ b/libpurple/plugins/perl/common/Smiley.xs	Sun May 25 22:06:51 2008 +0000
@@ -23,11 +23,10 @@
 	const char * shortcut
 
 void
-purple_smiley_set_data(smiley, data, data_len, keepfilename)
+purple_smiley_set_data(smiley, data, data_len)
 	Purple::Smiley  smiley
 	guchar * data
 	size_t  data_len
-	gboolean keepfilename
 
 const char *
 purple_smiley_get_shortcut(smiley)
--- a/libpurple/smiley.c	Sun May 25 21:56:36 2008 +0000
+++ b/libpurple/smiley.c	Sun May 25 22:06:51 2008 +0000
@@ -119,7 +119,7 @@
 
 static void
 purple_smiley_set_data_impl(PurpleSmiley *smiley, guchar *smiley_data,
-		size_t smiley_data_len, const char *filename);
+		size_t smiley_data_len);
 
 static void
 purple_smiley_data_store(PurpleStoredImage *stored_img);
@@ -499,7 +499,7 @@
 
 	if (read_smiley_file(fullpath, &smiley_data, &smiley_data_len))
 		purple_smiley_set_data_impl(smiley, smiley_data,
-				smiley_data_len, filename);
+				smiley_data_len);
 	else
 		purple_smiley_delete(smiley);
 
@@ -617,7 +617,7 @@
 
 static void
 purple_smiley_set_data_impl(PurpleSmiley *smiley, guchar *smiley_data,
-				size_t smiley_data_len, const char *filename)
+				size_t smiley_data_len)
 {
 	PurpleStoredImage *old_img, *new_img;
 	const char *old_filename = NULL;
@@ -629,10 +629,7 @@
 
 	old_img = smiley->img;
 
-	if (filename)
-		new_img = purple_imgstore_add(smiley_data, smiley_data_len, filename);
-	else
-		new_img = purple_smiley_data_new(smiley_data, smiley_data_len);
+	new_img = purple_smiley_data_new(smiley_data, smiley_data_len);
 
 	g_object_set(G_OBJECT(smiley), PROP_IMGSTORE_S, new_img, NULL);
 
@@ -688,7 +685,7 @@
 
 static PurpleSmiley *
 purple_smiley_new_from_stream(const char *shortcut, guchar *smiley_data,
-			size_t smiley_data_len, const char *filename)
+			size_t smiley_data_len)
 {
 	PurpleSmiley *smiley;
 
@@ -705,7 +702,7 @@
 	if (!smiley)
 		return NULL;
 
-	purple_smiley_set_data_impl(smiley, smiley_data, smiley_data_len, filename);
+	purple_smiley_set_data_impl(smiley, smiley_data, smiley_data_len);
 
 	purple_smiley_data_store(smiley->img);
 
@@ -718,17 +715,15 @@
 	PurpleSmiley *smiley = NULL;
 	guchar *smiley_data;
 	size_t smiley_data_len;
-	char *filename;
 
 	g_return_val_if_fail(shortcut  != NULL,  NULL);
 	g_return_val_if_fail(filepath != NULL,  NULL);
 
-	filename = g_path_get_basename(filepath);
-	if (read_smiley_file(filepath, &smiley_data, &smiley_data_len))
+	if (read_smiley_file(filepath, &smiley_data, &smiley_data_len)) {
 		smiley = purple_smiley_new_from_stream(shortcut, smiley_data,
-				smiley_data_len, filename);
-	g_free(filename);
-
+				smiley_data_len);
+	}
+	
 	return smiley;
 }
 
@@ -769,7 +764,7 @@
 
 void
 purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data,
-			   size_t smiley_data_len, gboolean keepfilename)
+			   size_t smiley_data_len)
 {
 	g_return_if_fail(smiley     != NULL);
 	g_return_if_fail(smiley_data != NULL);
@@ -779,14 +774,7 @@
 	g_hash_table_remove(smiley_checksum_index, smiley->checksum);
 
 	/* Update the file data. This also updates the checksum. */
-	if ((keepfilename) && (smiley->img) &&
-			(purple_imgstore_get_filename(smiley->img)))
-		purple_smiley_set_data_impl(smiley, smiley_data,
-				smiley_data_len,
-				purple_imgstore_get_filename(smiley->img));
-	else
-		purple_smiley_set_data_impl(smiley, smiley_data,
-				smiley_data_len, NULL);
+	purple_smiley_set_data_impl(smiley, smiley_data, smiley_data_len);
 
 	/* Reinsert the index item. */
 	g_hash_table_insert(smiley_checksum_index, g_strdup(smiley->checksum), smiley);
--- a/libpurple/smiley.h	Sun May 25 21:56:36 2008 +0000
+++ b/libpurple/smiley.h	Sun May 25 22:06:51 2008 +0000
@@ -128,12 +128,10 @@
  * @param smiley             The custom smiley.
  * @param smiley_data        The custom smiley data.
  * @param smiley_data_len    The custom smiley data length.
- * @param keepfilename      The current custom smiley's filename must be
- *                           kept.
  */
 void
 purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data,
-                                           size_t smiley_data_len, gboolean keepfilename);
+                                           size_t smiley_data_len);
 
 /**
  * Returns the custom smiley's associated shortcut.
--- a/pidgin/gtkconv.c	Sun May 25 21:56:36 2008 +0000
+++ b/pidgin/gtkconv.c	Sun May 25 22:06:51 2008 +0000
@@ -3153,10 +3153,18 @@
 
 		if ((chat == NULL) && (gtkconv->imhtml != NULL)) {
 			GHashTable *components;
-			components = g_hash_table_new_full(g_str_hash, g_str_equal,
-					g_free, g_free);
-			g_hash_table_replace(components, g_strdup("channel"),
-					g_strdup(conv->name));
+			PurpleAccount *account = purple_conversation_get_account(conv);
+			PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+			PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+			if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, chat_info_defaults)) {
+				components = prpl_info->chat_info_defaults(purple_account_get_connection(account),
+						purple_conversation_get_name(conv));
+			} else {
+				components = g_hash_table_new_full(g_str_hash, g_str_equal,
+						g_free, g_free);
+				g_hash_table_replace(components, g_strdup("channel"),
+						g_strdup(purple_conversation_get_name(conv)));
+			}
 			chat = purple_chat_new(conv->account, NULL, components);
 			purple_blist_node_set_flags((PurpleBlistNode *)chat,
 					PURPLE_BLIST_NODE_FLAG_NO_SAVE);
--- a/pidgin/gtksmiley.c	Sun May 25 21:56:36 2008 +0000
+++ b/pidgin/gtksmiley.c	Sun May 25 22:06:51 2008 +0000
@@ -229,7 +229,7 @@
 
 				return;
 			}
-			purple_smiley_set_data(s->smiley, (guchar*)data, len, FALSE);
+			purple_smiley_set_data(s->smiley, (guchar*)data, len);
 		}
 		purple_smiley_set_shortcut(s->smiley, entry);
 	} else {
@@ -329,8 +329,8 @@
 	window = gtk_dialog_new_with_buttons(smiley ? _("Edit Smiley") : _("Add Smiley"),
 			widget ? GTK_WINDOW(widget) : NULL,
 			GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,							 
 			smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			NULL);
 	s->parent = window;