comparison src/conversation.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 9fc7d0153332
children 9b3833da6840
comparison
equal deleted inserted replaced
11551:78aad676fdb2 11552:11d30825c1bb
52 52
53 static void ensure_default_funcs(void); 53 static void ensure_default_funcs(void);
54 static void conv_placement_last_created_win(GaimConversation *conv); 54 static void conv_placement_last_created_win(GaimConversation *conv);
55 55
56 static gboolean 56 static gboolean
57 find_nick(const char *nick, const char *message)
58 {
59 char *msg, *who, *p;
60 int n;
61 gboolean ret = FALSE;
62
63 msg = g_utf8_strdown(message, -1);
64
65 who = g_utf8_strdown(nick, -1);
66 n = strlen(who);
67
68 if ((p = strstr(msg, who)) != NULL) {
69 if ((p == msg || !isalnum(*(p - 1))) && !isalnum(*(p + n))) {
70 ret = TRUE;
71 }
72 }
73
74 g_free(who);
75 g_free(msg);
76
77 return ret;
78 }
79
80 static gboolean
81 reset_typing(gpointer data) 57 reset_typing(gpointer data)
82 { 58 {
83 GaimConversation *c = (GaimConversation *)data; 59 GaimConversation *c = (GaimConversation *)data;
84 GaimConvIm *im; 60 GaimConvIm *im;
85 61
1905 if (!strcmp(str, gaim_normalize(account, chat->nick))) { 1881 if (!strcmp(str, gaim_normalize(account, chat->nick))) {
1906 flags |= GAIM_MESSAGE_SEND; 1882 flags |= GAIM_MESSAGE_SEND;
1907 } else { 1883 } else {
1908 flags |= GAIM_MESSAGE_RECV; 1884 flags |= GAIM_MESSAGE_RECV;
1909 1885
1910 if (find_nick(chat->nick, message)) 1886 if (gaim_utf8_has_word(message, chat->nick))
1911 flags |= GAIM_MESSAGE_NICK; 1887 flags |= GAIM_MESSAGE_NICK;
1912 } 1888 }
1913 1889
1914 g_free(str); 1890 g_free(str);
1915 } 1891 }