changeset 16499:f2114f10a39d

merge of '3915457bd0530d71d2a7240c102329dfd261794c' and 'dd8d4a47d58343b94148f133559605ee8e10ec90'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 27 Apr 2007 04:37:55 +0000
parents d6b81413ef79 (diff) 0b97b224a829 (current diff)
children 6379629a976e
files
diffstat 13 files changed, 68 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/config.h.mingw	Fri Apr 27 04:35:57 2007 +0000
+++ b/config.h.mingw	Fri Apr 27 04:37:55 2007 +0000
@@ -325,7 +325,7 @@
 /* #define HAVE_SIGNAL_H 1 */
 
 /* Define if we have silcmime.h */
-/* #undef HAVE_SILCMIME_H */
+#define HAVE_SILCMIME_H 1
 
 /* Define to 1 if you have the <smime.h> header file. */
 /* #undef HAVE_SMIME_H */
--- a/doc/funniest_home_convos.txt	Fri Apr 27 04:35:57 2007 +0000
+++ b/doc/funniest_home_convos.txt	Fri Apr 27 04:37:55 2007 +0000
@@ -451,3 +451,12 @@
 (07:54:03 PM) clueless21:  what's an im client?
 (07:54:25 PM) Nathan Walp: it lets you chat with other people, like we are chatting now
 (07:54:45 PM) clueless21:  oooooooooo... thanks
+
+23:58 -!- seanegan is now known as beta7
+23:58 <beta7> Hey, guys, remember me?
+23:59 <beta7> We were all supposed to be working on getting me out.
+23:59 <beta7> you guys remember that?
+23:59 -!- mode/#pidgin [+o elb] by ChanServ
+23:59 -!- beta7 was kicked from #pidgin by elb [getting feisty, are we?]
+23:59 -!- mode/#pidgin [-o elb] by ChanServ
+23:59 <marv> elb: good job getting beta7 out
--- a/libpurple/account.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/account.c	Fri Apr 27 04:37:55 2007 +0000
@@ -792,6 +792,8 @@
 	}
 
 	xmlnode_free(node);
+
+	purple_buddy_icons_account_loaded_cb();
 }
 
 
--- a/libpurple/buddyicon.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/buddyicon.c	Fri Apr 27 04:37:55 2007 +0000
@@ -960,6 +960,30 @@
 }
 
 void
+purple_buddy_icons_account_loaded_cb()
+{
+	GList *cur;
+
+	for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)
+	{
+		PurpleAccount *account = cur->data;
+		const char *account_icon_file = purple_account_get_string(account, "buddy_icon", NULL);
+
+		if (account_icon_file != NULL)
+		{
+			char *path = g_build_filename(dirname, filename, NULL);
+			if (!g_file_test(filename, G_FILE_TEST_EXISTS))
+			{
+				purple_account_set_string(account, "buddy_icon", NULL);
+			} else {
+				ref_filename(account_icon_file);
+			}
+			g_free(path);
+		}
+	}
+}
+
+void
 purple_buddy_icons_blist_loaded_cb()
 {
 	PurpleBlistNode *node = purple_blist_get_root();
@@ -999,7 +1023,7 @@
 				else
 				{
 					char *path = g_build_filename(dirname, filename, NULL);
-					if (!g_file_test(filename, G_FILE_TEST_EXISTS))
+					if (!g_file_test(path, G_FILE_TEST_EXISTS))
 					{
 						purple_blist_node_remove_setting(node,
 						                                 "buddy_icon");
--- a/libpurple/core.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/core.c	Fri Apr 27 04:37:55 2007 +0000
@@ -310,7 +310,7 @@
 gboolean
 purple_core_migrate(void)
 {
-#error  This code wants to migrate your .gaim directory to .purple. It is strongly suggested that you back .gaim up before proceeding.
+#error You probably want to back up your .gaim directory right now. This revision is going to destroy it, potentially not in the way we've intended
 	const char *user_dir = purple_user_dir();
 	char *old_user_dir = g_strconcat(purple_home_dir(),
 	                                 G_DIR_SEPARATOR_S ".gaim", NULL);
@@ -597,7 +597,7 @@
 					return FALSE;
 				}
 
-				if (!fwrite(buf, size, 1, new_file))
+				if (!fwrite(buf, size, 1, new_file) && ferror(new_file) != 0)
 				{
 					purple_debug_error("core", "Error writing %s: %s\n",
 					                   new_name, strerror(errno));
--- a/libpurple/internal.h	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/internal.h	Fri Apr 27 04:37:55 2007 +0000
@@ -184,6 +184,11 @@
 
 #define PURPLE_WEBSITE "http://pidgin.im/"
 
+/* This is for the accounts code to notify the buddy icon code that
+ * it's done loading.  We may want to replace this with a signal. */
+void
+purple_buddy_icons_account_loaded_cb(void);
+
 /* This is for the buddy list to notify the buddy icon code that
  * it's done loading.  We may want to replace this with a signal. */
 void
--- a/libpurple/protocols/jabber/auth.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/protocols/jabber/auth.c	Fri Apr 27 04:37:55 2007 +0000
@@ -294,7 +294,7 @@
 					purple_request_yes_no(js->gc, _("Plaintext Authentication"),
 							_("Plaintext Authentication"),
 							_("This server requires plaintext authentication over an unencrypted connection.  Allow this and continue authentication?"),
-							2, js->gc->account,
+							2, js->gc->account, NULL, NULL, NULL,
 							allow_cyrus_plaintext_auth,
 							disallow_plaintext_auth);
 					return;
--- a/libpurple/protocols/silc/buddy.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/protocols/silc/buddy.c	Fri Apr 27 04:37:55 2007 +0000
@@ -987,8 +987,10 @@
 					const unsigned char *data;
 					SilcUInt32 data_len;
 					data = silc_mime_get_data(m, &data_len);
-					if (data)
-						purple_buddy_icons_set_for_user(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), g_memdup(data, data_len), data_len);
+					if (data) {
+						/* TODO: Check if SILC gives us something to use as the checksum instead */
+						purple_buddy_icons_set_for_user(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), g_memdup(data, data_len), data_len, NULL);
+					}
 				}
 				silc_mime_free(m);
 			}
@@ -1681,48 +1683,31 @@
 }
 
 #ifdef SILC_ATTRIBUTE_USER_ICON
-void silcpurple_buddy_set_icon(PurpleConnection *gc, const char *iconfile)
+void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img)
 {
 	SilcPurple sg = gc->proto_data;
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
 	SilcMime mime;
-	PurpleBuddyIcon ic;
 	char type[32];
 	unsigned char *icon;
 	const char *t;
-	struct stat st;
-	FILE *fp;
 	SilcAttributeObjMime obj;
 
 	/* Remove */
-	if (!iconfile) {
+	if (!img) {
 		silc_client_attribute_del(client, conn,
 					  SILC_ATTRIBUTE_USER_ICON, NULL);
 		return;
 	}
 
 	/* Add */
-	if (g_stat(iconfile, &st) < 0)
-		return;
-	fp = g_fopen(iconfile, "rb");
-	if (!fp)
-		return;
-	ic.data = g_malloc(st.st_size);
-	if (!ic.data)
+	mime = silc_mime_alloc();
+	if (!mime)
 		return;
-	ic.len = fread(ic.data, 1, st.st_size, fp);
-	fclose(fp);
 
-	mime = silc_mime_alloc();
-	if (!mime) {
-		g_free(ic.data);
-		return;
-	}
-
-	t = purple_buddy_icon_get_type((const PurpleBuddyIcon *)&ic);
+	t = purple_util_get_image_extension(purple_imgstore_get_data(img), purple_imgstore_get_size(img));
 	if (!t || !strcmp(t, "icon")) {
-		g_free(ic.data);
 		silc_mime_free(mime);
 		return;
 	}
@@ -1730,7 +1715,7 @@
 		t = "jpeg";
 	g_snprintf(type, sizeof(type), "image/%s", t);
 	silc_mime_add_field(mime, "Content-Type", type);
-	silc_mime_add_data(mime, ic.data, ic.len);
+	silc_mime_add_data(mime, purple_imgstore_get_data(img), purple_imgstore_get_size(img));
 
 	obj.mime = icon = silc_mime_encode(mime, &obj.mime_len);
 	if (obj.mime)
@@ -1738,7 +1723,6 @@
 					  SILC_ATTRIBUTE_USER_ICON, &obj, sizeof(obj));
 
 	silc_free(icon);
-	g_free(ic.data);
 	silc_mime_free(mime);
 }
 #endif
--- a/libpurple/protocols/silc/silc.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/protocols/silc/silc.c	Fri Apr 27 04:37:55 2007 +0000
@@ -194,7 +194,7 @@
 		SilcUInt32 mask;
 		const char *tmp;
 #ifdef SILC_ATTRIBUTE_USER_ICON
-		char *icon;
+		PurpleStoredImage *img;
 #endif
 #ifdef HAVE_SYS_UTSNAME_H
 		struct utsname u;
@@ -233,9 +233,9 @@
 
 #ifdef SILC_ATTRIBUTE_USER_ICON
 		/* Set our buddy icon */
-		icon = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account));
-		silcpurple_buddy_set_icon(gc, icon);
-		g_free(icon);
+		img = purple_buddy_icons_find_account_icon(account);
+		silcpurple_buddy_set_icon(gc, img);
+		purple_imgstore_unref(img);
 #endif
 	}
 
--- a/libpurple/protocols/silc/silcpurple.h	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/protocols/silc/silcpurple.h	Fri Apr 27 04:37:55 2007 +0000
@@ -145,7 +145,7 @@
 					 char **contactstr, char **langstr, char **devicestr,
 					 char **tzstr, char **geostr);
 #ifdef SILC_ATTRIBUTE_USER_ICON
-void silcpurple_buddy_set_icon(PurpleConnection *gc, const char *iconfile);
+void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img);
 #endif
 #ifdef HAVE_SILCMIME_H
 char *silcpurple_file2mime(const char *filename);
--- a/libpurple/protocols/silc/util.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/protocols/silc/util.c	Fri Apr 27 04:37:55 2007 +0000
@@ -676,9 +676,9 @@
 		}
 
 		id = g_datalist_get_data(&attribs, "id");
-		if (id && (image = purple_imgstore_get(atoi(id)))) {
+		if (id && (image = purple_imgstore_find_by_id(atoi(id)))) {
 			unsigned long imglen = purple_imgstore_get_size(image);
-			gpointer img = purple_imgstore_get_data(image);
+			gconstpointer img = purple_imgstore_get_data(image);
 
 			p = silc_mime_alloc();
 
--- a/libpurple/util.c	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/util.c	Fri Apr 27 04:37:55 2007 +0000
@@ -2570,7 +2570,7 @@
 }
 
 const char *
-purple_util_get_image_extension(gpointer data, size_t len)
+purple_util_get_image_extension(gconstpointer data, size_t len)
 {
 	g_return_val_if_fail(data != NULL, NULL);
 	g_return_val_if_fail(len   > 0,    NULL);
@@ -2667,7 +2667,7 @@
 gboolean
 purple_running_osx(void)
 {
-#if defined(__APPLE__)	
+#if defined(__APPLE__)
 	return TRUE;
 #else
 	return FALSE;
@@ -4207,7 +4207,7 @@
 	signal(SIGABRT, SIG_DFL);	/* 6:  abort program */
 
 #ifdef SIGPOLL
-	signal(SIGPOLL,  SIG_DFL);	/* 7:  pollable event (POSIX) */	
+	signal(SIGPOLL,  SIG_DFL);	/* 7:  pollable event (POSIX) */
 #endif /* SIGPOLL */
 
 #ifdef SIGEMT
@@ -4223,7 +4223,7 @@
 	signal(SIGTERM, SIG_DFL);	/* 15: software termination signal */
 	signal(SIGCHLD, SIG_DFL);	/* 20: child status has changed */
 	signal(SIGXCPU, SIG_DFL);	/* 24: exceeded CPU time limit */
-	signal(SIGXFSZ, SIG_DFL);	/* 25: exceeded file size limit */	
+	signal(SIGXFSZ, SIG_DFL);	/* 25: exceeded file size limit */
 #endif /* HAVE_SIGNAL_H */
 #endif /* !_WIN32 */
 }
--- a/libpurple/util.h	Fri Apr 27 04:35:57 2007 +0000
+++ b/libpurple/util.h	Fri Apr 27 04:37:55 2007 +0000
@@ -469,7 +469,7 @@
  * the first character of the entity. If given an unrecognized entity, the function
  * returns @c NULL.
  *
- * Note that this function, unlike purple_unescape_html(), does not search 
+ * Note that this function, unlike purple_unescape_html(), does not search
  * the string for the entity, does not replace the entity, and does not
  * return a newly allocated string.
  *
@@ -606,7 +606,7 @@
  * @return The appropriate extension, or "icon" if unknown.
  */
 const char *
-purple_util_get_image_extension(gpointer data, size_t len);
+purple_util_get_image_extension(gconstpointer data, size_t len);
 
 /*@}*/