comparison libpurple/protocols/qq/utils.c @ 24081:119d85c40d75

2008.10.07 - ccpaging <ccpaging(at)gmail.com> * Update buddy icon
author SHiNE CsyFeK <csyfek@gmail.com>
date Wed, 22 Oct 2008 15:00:47 +0000
parents ce94189f15ad
children 237e5a94e11c
comparison
equal deleted inserted replaced
24080:818ab62006f5 24081:119d85c40d75
116 116
117 segments = g_strsplit_set((gchar *) input, delimit, 0); 117 segments = g_strsplit_set((gchar *) input, delimit, 0);
118 if (expected_fields <= 0) 118 if (expected_fields <= 0)
119 return segments; 119 return segments;
120 120
121 for (count = 0; segments[count] != NULL; count++) {; 121 count = g_strv_length(segments);
122 }
123 if (count < expected_fields) { /* not enough fields */ 122 if (count < expected_fields) { /* not enough fields */
124 purple_debug_error("QQ", "Less fields %d then %d\n", count, expected_fields); 123 purple_debug_error("QQ", "Less fields %d then %d\n", count, expected_fields);
125 return NULL; 124 return NULL;
126 } else if (count > expected_fields) { /* more fields, OK */ 125 } else if (count > expected_fields) { /* more fields, OK */
127 purple_debug_warning("QQ", "More fields %d than %d\n", count, expected_fields); 126 purple_debug_warning("QQ", "More fields %d than %d\n", count, expected_fields);
364 void qq_show_packet(const gchar *desc, const guint8 *buf, gint len) 363 void qq_show_packet(const gchar *desc, const guint8 *buf, gint len)
365 { 364 {
366 qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", buf, len, desc); 365 qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", buf, len, desc);
367 } 366 }
368 367
369 /* convert face num from packet (0-299) to local face (1-100) */
370 gchar *face_to_icon_str(gint face)
371 {
372 gchar *icon_num_str;
373 gint icon_num = face / 3 + 1;
374 icon_num_str = g_strdup_printf("%d", icon_num);
375 return icon_num_str;
376 }
377
378 /* return the location of the buddy icon dir
379 * any application using libpurple but not installing the QQ buddy icons
380 * under datadir needs to set the pref below, or buddy icons won't work */
381 const char *qq_buddy_icon_dir(void)
382 {
383 if (purple_prefs_exists("/prpl/qq/buddy_icon_dir"))
384 return purple_prefs_get_string("/prpl/qq/buddy_icon_dir");
385 else
386 return NULL;
387 }