diff 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
line wrap: on
line diff
--- a/src/util.c	Mon Oct 31 03:55:56 2005 +0000
+++ b/src/util.c	Mon Oct 31 04:27:06 2005 +0000
@@ -2465,19 +2465,35 @@
 }
 
 void
-gaim_str_strip_cr(char *text)
+gaim_str_strip_char(char *text, char thechar)
 {
 	int i, j;
 
 	g_return_if_fail(text != NULL);
 
 	for (i = 0, j = 0; text[i]; i++)
-		if (text[i] != '\r')
+		if (text[i] != thechar)
 			text[j++] = text[i];
 
 	text[j++] = '\0';
 }
 
+void
+gaim_util_chrreplace(char *string, char delimiter,
+					 char replacement)
+{
+	int i = 0;
+
+	g_return_if_fail(string != NULL);
+
+	while (string[i] != '\0')
+	{
+		if (string[i] == delimiter)
+			string[i] = replacement;
+		i++;
+	}
+}
+
 gchar *
 gaim_strreplace(const char *string, const char *delimiter,
 				const char *replacement)