From: Mark D. <the...@us...> - 2005-07-24 19:36:33
|
Update of /cvsroot/gaim/gaim/src/protocols/toc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30113/src/protocols/toc Modified Files: toc.c Log Message: 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. Index: toc.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/toc/toc.c,v retrieving revision 1.176 retrieving revision 1.177 diff -u -d -p -r1.176 -r1.177 --- toc.c 28 Jun 2005 06:13:06 -0000 1.176 +++ toc.c 24 Jul 2005 19:36:22 -0000 1.177 @@ -1475,6 +1475,33 @@ static void toc_keepalive(GaimConnection sflap_send(gc, "", 0, TYPE_KEEPALIVE); } +static const char * +toc_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 const char *toc_list_icon(GaimAccount *a, GaimBuddy *b) { if (!b || (b && b->name && b->name[0] == '+')) { @@ -2259,7 +2286,7 @@ static GaimPluginProtocolInfo prpl_info NULL, /* rename_group */ NULL, /* buddy_free */ NULL, /* convo_closed */ - NULL, /* normalize */ + toc_normalize, /* normalize */ NULL, /* set_buddy_icon */ NULL, /* remove_group */ NULL, /* get_cb_real_name */ |