pidgin.openq: 32aaec02: 2008.10.08 - ccpaging <ccpaging(at)gmail...

csyfek at gmail.com csyfek at gmail.com
Wed Oct 22 12:11:52 EDT 2008


-----------------------------------------------------------------
Revision: 32aaec02b94d017b8063f257bf40acba8cc2085b
Ancestor: 6fc65db67dac591fb779148d0db1e213f24b695b
Author: csyfek at gmail.com
Date: 2008-10-22T15:04:33
Branch: im.pidgin.pidgin.openq
URL: http://d.pidgin.im/viewmtn/revision/info/32aaec02b94d017b8063f257bf40acba8cc2085b

Modified files:
        libpurple/protocols/qq/ChangeLog
        libpurple/protocols/qq/buddy_info.c
        libpurple/protocols/qq/qq.c

ChangeLog: 

2008.10.08 - ccpaging <ccpaging(at)gmail.com>
	* Fixed QQ_BUDDY_ICON_DIR problem

-------------- next part --------------
============================================================
--- libpurple/protocols/qq/ChangeLog	480fd6809badb55727e27f61e9865bde0664b51a
+++ libpurple/protocols/qq/ChangeLog	7233b037ccd6538deaad21e1f030c07744bf871b
@@ -1,3 +1,6 @@
+2008.10.08 - ccpaging <ccpaging(at)gmail.com>
+	* Fixed QQ_BUDDY_ICON_DIR problem
+
 2008.10.07 - lonicerae <lonicerae(at)gmail.com>
 	* Update 'version display'
 
============================================================
--- libpurple/protocols/qq/buddy_info.c	a90960d155bd82fb9e9a911209e997e4ec543fd8
+++ libpurple/protocols/qq/buddy_info.c	bd315cab3a5bbe8b347f9b979f0b230f029b7b8f
@@ -74,7 +74,7 @@ static const gchar *genders_zh[] = {
 	N_("\xc5\xae"),
 };
 
-#define QQ_FACES	    100
+#define QQ_FACES	    134
 
 enum {
 	QQ_INFO_UID = 0, QQ_INFO_NICK, QQ_INFO_COUNTRY, QQ_INFO_PROVINCE, QQ_INFO_ZIPCODE,
@@ -127,7 +127,7 @@ static const QQ_FIELD_INFO field_infos[]
 	{ QQ_FIELD_BASE, 		QQ_FIELD_BOOL, 	"auth", 				N_("Authorize adding"), NULL, 0 },
 	{ QQ_FIELD_UNUSED, 	QQ_FIELD_STRING, "unknow1",	"Unknow1", NULL, 0 },
 	{ QQ_FIELD_UNUSED, 	QQ_FIELD_STRING, "unknow2",	"Unknow2", NULL, 0 },
-	{ QQ_FIELD_BASE, 		QQ_FIELD_STRING, "face",				"Face", NULL, 0 },
+	{ QQ_FIELD_UNUSED, 		QQ_FIELD_STRING, "face",				"Face", NULL, 0 },
 	{ QQ_FIELD_CONTACT, QQ_FIELD_STRING, "mobile",		N_("Cellphone Number"), NULL, 0 },
 	{ QQ_FIELD_UNUSED, 	QQ_FIELD_STRING, "mobile_type","Cellphone Type", NULL, 0 },
 	{ QQ_FIELD_BASE, 		QQ_FIELD_MULTI, 	"intro", 		N_("Personal Introduction"), NULL, 0 },
@@ -573,12 +573,28 @@ void qq_set_custom_icon(PurpleConnection
 	g_strfreev(segments);
 }
 
+static gchar *qq_get_icon_path(gchar *icon_name)
+{
+	gchar *icon_path;
+	const gchar *icon_dir;
+	
+	icon_dir = purple_prefs_get_string("/plugins/prpl/qq/icon_dir");
+	if ( icon_dir == NULL) {
+		purple_debug_error("QQ", "Icon dir is not defined in prefs '/plugins/prpl/qq/icon_dir'\n");
+		return NULL;
+	}
+
+	icon_path = g_strconcat(icon_dir, G_DIR_SEPARATOR_S,
+			QQ_ICON_PREFIX, icon_name, QQ_ICON_SUFFIX, NULL);
+	
+	return icon_path;
+}
+
 static void update_buddy_icon(PurpleAccount *account, const gchar *who, gint face)
 {
 	PurpleBuddy *buddy;
 	const gchar *icon_name_prev = NULL;
 	gchar *icon_name;
-	const gchar *icon_dir;
 	gchar *icon_path;
 	gchar *icon_file_content;
 	gsize icon_file_size;
@@ -595,21 +611,15 @@ static void update_buddy_icon(PurpleAcco
 		g_free(icon_name);
 		return;
 	}
-	icon_dir = NULL;
-	if ( purple_prefs_exists("/plugins/prpl/qq/icon_dir") ) {
-		icon_dir = purple_prefs_get_string("/plugins/prpl/qq/icon_dir");
-	}
-	if ( icon_dir == NULL) {
-		purple_debug_info("QQ", "Icon dir is not defined in prefs '/plugins/prpl/qq/icon_dir'\n");
+
+	icon_path = qq_get_icon_path(icon_name);
+	if (icon_path == NULL) {
 		g_free(icon_name);
 		return;
 	}
 
-	icon_path = g_strconcat(icon_dir, G_DIR_SEPARATOR_S,
-			QQ_ICON_PREFIX, icon_name, QQ_ICON_SUFFIX, NULL);
-
 	if (!g_file_get_contents(icon_path, &icon_file_content, &icon_file_size, NULL)) {
-			purple_debug_error("QQ", "Failed reading icon file %s\n", icon_path);
+		purple_debug_error("QQ", "Failed reading icon file %s\n", icon_path);
 	} else {
 		purple_buddy_icons_set_for_user(account, who,
 				icon_file_content, icon_file_size, icon_name);
============================================================
--- libpurple/protocols/qq/qq.c	b617fda0eb00749525f3b0fcdadde412bce288b1
+++ libpurple/protocols/qq/qq.c	f8767e4c5c06309a8ae3fc400fa0bee31c264d28
@@ -1093,7 +1093,7 @@ static void init_plugin(PurplePlugin *pl
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 
 	purple_prefs_add_none("/plugins/prpl/qq");
-	purple_prefs_add_string("/plugins/prpl/qq/icon_dir", "");
+	purple_prefs_add_string("/plugins/prpl/qq/icon_dir", QQ_BUDDY_ICON_DIR);
 	purple_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE);
 	purple_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE);
 	purple_prefs_add_bool("/plugins/prpl/qq/show_room_when_newin", TRUE);


More information about the Commits mailing list