changeset 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 437ce90442cf
children 01f13d2e73de
files libgaim/protocols/qq/buddy_opt.c libgaim/protocols/qq/group_find.c libgaim/protocols/qq/qq.c libgaim/protocols/qq/utils.c libgaim/protocols/qq/utils.h
diffstat 5 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/qq/buddy_opt.c	Thu Aug 24 07:00:34 2006 +0000
+++ b/libgaim/protocols/qq/buddy_opt.c	Thu Aug 24 08:04:46 2006 +0000
@@ -511,7 +511,7 @@
 			gaim_blist_remove_buddy(b);
 		gaim_notify_error(gc, NULL,
 				  _("QQid Error"),
-				  _("Invalid QQid, to add buddy 1234567, \nyou should input qq-1234567"));
+				  _("Invalid QQid"));
 	}
 }
 
--- a/libgaim/protocols/qq/group_find.c	Thu Aug 24 07:00:34 2006 +0000
+++ b/libgaim/protocols/qq/group_find.c	Thu Aug 24 08:04:46 2006 +0000
@@ -38,10 +38,13 @@
 
 	g_return_val_if_fail(gc != NULL && who != NULL, NULL);
 
+	/* TODO checkbox for this in UI */
 	/* if it starts with QQ_NAME_PREFIX, we think it is valid name already
 	 * otherwise we think it is nickname and try to find the matching gaim_name */
+	/*
 	if (gaim_str_has_prefix(who, QQ_NAME_PREFIX) && gaim_name_to_uid(who) > 0)
 		return (gchar *) who;
+		*/
 
 	group = qq_group_find_by_channel(gc, channel);
 	g_return_val_if_fail(group != NULL, NULL);
--- a/libgaim/protocols/qq/qq.c	Thu Aug 24 07:00:34 2006 +0000
+++ b/libgaim/protocols/qq/qq.c	Thu Aug 24 08:04:46 2006 +0000
@@ -374,7 +374,7 @@
 
 	if (uid <= 0) {
 		gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Not valid QQid: %s\n", who);
-		gaim_notify_error(gc, NULL, _("Invalid name, please input in qq-xxxxxxxx format"), NULL);
+		gaim_notify_error(gc, NULL, _("Invalid name"), NULL);
 		return;
 	}
 
--- 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 */
--- a/libgaim/protocols/qq/utils.h	Thu Aug 24 07:00:34 2006 +0000
+++ b/libgaim/protocols/qq/utils.h	Thu Aug 24 08:04:46 2006 +0000
@@ -26,8 +26,6 @@
 #include <stdio.h>
 #include <glib.h>
 
-#define QQ_NAME_PREFIX    "qq-"
-
 gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount);
 gchar *get_index_str_by_name(gchar **array, const gchar *name, gint amount);
 gint qq_string_to_dec_value(const gchar *str);