Gadu-Gadu: function to normalize gg usernames

Thu, 13 Oct 2011 15:27:52 +0000

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Thu, 13 Oct 2011 15:27:52 +0000
changeset 32652
9cf860cf65f2
parent 32651
cc247c37281e
child 32653
5ff7a8b6e0f1

Gadu-Gadu: function to normalize gg usernames

libpurple/protocols/gg/gg.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/gg/gg.c	Wed Oct 12 21:06:20 2011 +0000
+++ b/libpurple/protocols/gg/gg.c	Thu Oct 13 15:27:52 2011 +0000
@@ -2082,6 +2082,19 @@
 	return "gadu-gadu";
 }
 
+static const char *ggp_normalize(const PurpleAccount *account, const char *who)
+{
+	static char normalized[21]; /* maximum unsigned long long int size */
+
+	uin_t uin = ggp_str_to_uin(who);
+	if (uin <= 0)
+		return NULL;
+
+	g_snprintf(normalized, sizeof(normalized), "%u", uin);
+
+	return normalized;
+}
+
 static char *ggp_status_text(PurpleBuddy *b)
 {
 	PurpleStatus *status;
@@ -2850,7 +2863,7 @@
 	NULL,				/* rename_group */
 	NULL,				/* buddy_free */
 	NULL,				/* convo_closed */
-	NULL,				/* normalize */
+	ggp_normalize,			/* normalize */
 	NULL,				/* set_buddy_icon */
 	NULL,				/* remove_group */
 	NULL,				/* get_cb_real_name */

mercurial