changeset 32279:318345f39e98

Gadu-Gadu: function to normalize gg usernames
author tomkiewicz@cpw.pidgin.im
date Thu, 13 Oct 2011 15:27:52 +0000
parents 9740dd029827
children 26ffd7fdba7d
files libpurple/protocols/gg/gg.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 */