comparison src/util.c @ 11920:52f27ffe68a5

[gaim-migrate @ 14211] sf patch #1339035, from Sadrul Habib Chowdhury "Remove the \n in Yahoo! status messages when showing them in the buddy list inline." Also some changes from me. I changed gaim_str_strip_cr(char *text) to gaim_str_strip_char(char *text, char thechar). I don't know why, really, but it seems like it could be more useful this way. Eh committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 31 Oct 2005 04:27:06 +0000
parents f672349cfc1c
children 936e3b7cd864
comparison
equal deleted inserted replaced
11919:51832ad72a6b 11920:52f27ffe68a5
2463 2463
2464 return ret; 2464 return ret;
2465 } 2465 }
2466 2466
2467 void 2467 void
2468 gaim_str_strip_cr(char *text) 2468 gaim_str_strip_char(char *text, char thechar)
2469 { 2469 {
2470 int i, j; 2470 int i, j;
2471 2471
2472 g_return_if_fail(text != NULL); 2472 g_return_if_fail(text != NULL);
2473 2473
2474 for (i = 0, j = 0; text[i]; i++) 2474 for (i = 0, j = 0; text[i]; i++)
2475 if (text[i] != '\r') 2475 if (text[i] != thechar)
2476 text[j++] = text[i]; 2476 text[j++] = text[i];
2477 2477
2478 text[j++] = '\0'; 2478 text[j++] = '\0';
2479 }
2480
2481 void
2482 gaim_util_chrreplace(char *string, char delimiter,
2483 char replacement)
2484 {
2485 int i = 0;
2486
2487 g_return_if_fail(string != NULL);
2488
2489 while (string[i] != '\0')
2490 {
2491 if (string[i] == delimiter)
2492 string[i] = replacement;
2493 i++;
2494 }
2479 } 2495 }
2480 2496
2481 gchar * 2497 gchar *
2482 gaim_strreplace(const char *string, const char *delimiter, 2498 gaim_strreplace(const char *string, const char *delimiter,
2483 const char *replacement) 2499 const char *replacement)