diff src/protocols/oscar/oscar.c @ 11153:8e600ee6ec61

[gaim-migrate @ 13235] sf patch #1243998, from Evan Schoenberg, also some changes by me Basically novell needed a prpl->normalize function that didn't remove spaces. But I didn't like having the default normalize code make the string lowercase and remove spaces, so I changed the default to basically do nothing. Anyhoo, if you think of yourself as the primary contact for one of the PRPLs, you may want to make sure your PRPL has a normalize function, if it needs one. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 24 Jul 2005 19:36:22 +0000
parents eac408c8900f
children 92453bf9b86b
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Sun Jul 24 18:20:04 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Jul 24 19:36:22 2005 +0000
@@ -7606,6 +7606,33 @@
 }
 #endif
 
+static const char *
+oscar_normalize(const GaimAccount *account, const char *str)
+{
+	static char buf[BUF_LEN];
+	char *tmp1, *tmp2;
+	int i, j;
+
+	g_return_val_if_fail(str != NULL, NULL);
+
+	strncpy(buf, str, BUF_LEN);
+	for (i=0, j=0; buf[j]; i++, j++)
+	{
+		while (buf[j] == ' ')
+			j++;
+		buf[i] = buf[j];
+	}
+	buf[i] = '\0';
+
+	tmp1 = g_utf8_strdown(buf, -1);
+	tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT);
+	g_snprintf(buf, sizeof(buf), "%s", tmp2);
+	g_free(tmp2);
+	g_free(tmp1);
+
+	return buf;
+}
+
 static GaimPluginProtocolInfo prpl_info =
 {
 	OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE,
@@ -7656,7 +7683,7 @@
 	oscar_rename_group,		/* rename_group */
 	NULL,					/* buddy_free */
 	oscar_convo_closed,		/* convo_closed */
-	NULL,					/* normalize */
+	oscar_normalize,		/* normalize */
 	oscar_set_icon,			/* set_buddy_icon */
 	NULL,					/* remove_group */
 	NULL,					/* get_cb_real_name */