comparison src/protocols/toc/toc.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 50224ac8184d
children bb0d7b719af2
comparison
equal deleted inserted replaced
11152:c25b3815d781 11153:8e600ee6ec61
1471 } 1471 }
1472 1472
1473 static void toc_keepalive(GaimConnection *gc) 1473 static void toc_keepalive(GaimConnection *gc)
1474 { 1474 {
1475 sflap_send(gc, "", 0, TYPE_KEEPALIVE); 1475 sflap_send(gc, "", 0, TYPE_KEEPALIVE);
1476 }
1477
1478 static const char *
1479 toc_normalize(const GaimAccount *account, const char *str)
1480 {
1481 static char buf[BUF_LEN];
1482 char *tmp1, *tmp2;
1483 int i, j;
1484
1485 g_return_val_if_fail(str != NULL, NULL);
1486
1487 strncpy(buf, str, BUF_LEN);
1488 for (i=0, j=0; buf[j]; i++, j++)
1489 {
1490 while (buf[j] == ' ')
1491 j++;
1492 buf[i] = buf[j];
1493 }
1494 buf[i] = '\0';
1495
1496 tmp1 = g_utf8_strdown(buf, -1);
1497 tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT);
1498 g_snprintf(buf, sizeof(buf), "%s", tmp2);
1499 g_free(tmp2);
1500 g_free(tmp1);
1501
1502 return buf;
1476 } 1503 }
1477 1504
1478 static const char *toc_list_icon(GaimAccount *a, GaimBuddy *b) 1505 static const char *toc_list_icon(GaimAccount *a, GaimBuddy *b)
1479 { 1506 {
1480 if (!b || (b && b->name && b->name[0] == '+')) { 1507 if (!b || (b && b->name && b->name[0] == '+')) {
2257 NULL, /* alias_buddy */ 2284 NULL, /* alias_buddy */
2258 NULL, /* group_buddy */ 2285 NULL, /* group_buddy */
2259 NULL, /* rename_group */ 2286 NULL, /* rename_group */
2260 NULL, /* buddy_free */ 2287 NULL, /* buddy_free */
2261 NULL, /* convo_closed */ 2288 NULL, /* convo_closed */
2262 NULL, /* normalize */ 2289 toc_normalize, /* normalize */
2263 NULL, /* set_buddy_icon */ 2290 NULL, /* set_buddy_icon */
2264 NULL, /* remove_group */ 2291 NULL, /* remove_group */
2265 NULL, /* get_cb_real_name */ 2292 NULL, /* get_cb_real_name */
2266 NULL, /* set_chat_topic */ 2293 NULL, /* set_chat_topic */
2267 NULL, /* find_blist_chat */ 2294 NULL, /* find_blist_chat */