diff src/util.c @ 11552:11d30825c1bb

[gaim-migrate @ 13812] Source Forge patch 1273590 from Casey Harkins to move all sound playing events into gtksound.[ch] as well as a few other clean ups to make sure that all sounds are being played by the ui. committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Sat, 17 Sep 2005 03:00:12 +0000
parents 3fe6b56a39cc
children f9c5480ad0ce
line wrap: on
line diff
--- a/src/util.c	Thu Sep 15 14:54:23 2005 +0000
+++ b/src/util.c	Sat Sep 17 03:00:12 2005 +0000
@@ -3373,6 +3373,31 @@
 	return ret;
 }
 
+/* previously conversation::find_nick() */
+gboolean 
+gaim_utf8_has_word(const char *haystack, const char *needle)
+{
+	char *hay, *pin, *p;
+	int n;
+	gboolean ret = FALSE;
+
+	hay = g_utf8_strdown(haystack, -1);
+
+	pin = g_utf8_strdown(needle, -1);
+	n = strlen(pin);
+
+	if ((p = strstr(hay, pin)) != NULL) {
+		if ((p == hay || !isalnum(*(p - 1))) && !isalnum(*(p + n))) {
+			ret = TRUE;
+		}
+	}
+
+	g_free(pin);
+	g_free(hay);
+
+	return ret;
+}
+
 gboolean gaim_message_meify(char *message, size_t len)
 {
 	char *c;