diff libgaim/protocols/qq/utils.c @ 14319:69f594f56de5

[gaim-migrate @ 17012] Removed the prefix before user IDs, it was giving the Adium folks a hard time. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Thu, 24 Aug 2006 08:04:46 +0000
parents 584cbd1628d0
children 8ff8f1c897b5
line wrap: on
line diff
--- a/libgaim/protocols/qq/utils.c	Thu Aug 24 07:00:34 2006 +0000
+++ b/libgaim/protocols/qq/utils.c	Thu Aug 24 08:04:46 2006 +0000
@@ -36,7 +36,7 @@
 #include "util.h"
 #include "utils.h"
 
-#define QQ_NAME_FORMAT    "qq-%d"
+#define QQ_NAME_FORMAT    "%d"
 
 gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount)
 {
@@ -164,22 +164,24 @@
 	return g_strdup_printf("qq_%d", set);
 }
 
-/* convert a QQ UID to a unique name of GAIM
+/* convert a QQ UID to a unique name of Gaim
  * the return needs to be freed */
 gchar *uid_to_gaim_name(guint32 uid)
 {
 	return g_strdup_printf(QQ_NAME_FORMAT, uid);
 }
 
-/* convert GAIM name to original QQ UID */
+/* convert Gaim name to original QQ UID */
 guint32 gaim_name_to_uid(const gchar *const name)
 {
-	gchar *p;
+	guint32 ret;
+	g_return_val_if_fail(name != NULL, 0);
 
-	g_return_val_if_fail(gaim_str_has_prefix(name, QQ_NAME_PREFIX), 0);
-
-	p = g_strrstr(name, QQ_NAME_PREFIX);
-	return (p == NULL) ? 0 : strtol(p + strlen(QQ_NAME_PREFIX), NULL, 10);
+	ret = strtol(name, NULL, 10);
+	if (errno == ERANGE)
+		return 0;
+	else 
+		return ret;
 }
 
 /* try to dump the data as GBK */