Mercurial > pidgin
changeset 24152:d3811bdb6b07
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
* Fixed QQ_BUDDY_ICON_DIR problem
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 15:04:33 +0000 |
parents | 4edf36682236 |
children | 340fc40fe4ef |
files | libpurple/protocols/qq/ChangeLog libpurple/protocols/qq/buddy_info.c libpurple/protocols/qq/qq.c |
diffstat | 3 files changed, 27 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/qq/ChangeLog Wed Oct 22 15:03:08 2008 +0000 +++ b/libpurple/protocols/qq/ChangeLog Wed Oct 22 15:04:33 2008 +0000 @@ -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'
--- a/libpurple/protocols/qq/buddy_info.c Wed Oct 22 15:03:08 2008 +0000 +++ b/libpurple/protocols/qq/buddy_info.c Wed Oct 22 15:04:33 2008 +0000 @@ -74,7 +74,7 @@ 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 @@ { 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 @@ 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 @@ 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);
--- a/libpurple/protocols/qq/qq.c Wed Oct 22 15:03:08 2008 +0000 +++ b/libpurple/protocols/qq/qq.c Wed Oct 22 15:04:33 2008 +0000 @@ -1093,7 +1093,7 @@ 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);