Mercurial > pidgin
comparison src/protocols/msn/switchboard.c @ 4793:677d3cb193a1
[gaim-migrate @ 5113]
this removes all the remaining deprecated glib, gdk, gdk-pixbuf, and gtk
function calls. Hopefully I didn't break anything.
Most of this is due to the deprecation of g_strcasecmp and g_strncasecmp.
Two functions I never thought would be deprecated, but apparently they're
no good at comparing utf8 text. g_ascii_str{,n}casecmp is OK when you're
sure that it's ASCII. Otherwise, we're supposed to use g_utf8_collate(),
except that it is case sensitive. Since glib doesn't currently have a
case-insensitive one, I wrote one. If you need to compare utf8 text, you
can use gaim_utf8_strcasecmp().
I have to go do dishes now.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 16 Mar 2003 00:01:49 +0000 |
parents | 283fb289c510 |
children | abe4d103e300 |
comparison
equal
deleted
inserted
replaced
4792:9212d1c5b7dc | 4793:677d3cb193a1 |
---|---|
76 { | 76 { |
77 struct gaim_connection *gc = ms->gc; | 77 struct gaim_connection *gc = ms->gc; |
78 char sendbuf[MSN_BUF_LEN]; | 78 char sendbuf[MSN_BUF_LEN]; |
79 static int id = 0; | 79 static int id = 0; |
80 | 80 |
81 if (!g_strncasecmp(buf, "ACK", 3)) { | 81 if (!g_ascii_strncasecmp(buf, "ACK", 3)) { |
82 } else if (!g_strncasecmp(buf, "ANS", 3)) { | 82 } else if (!g_ascii_strncasecmp(buf, "ANS", 3)) { |
83 if (ms->chat) | 83 if (ms->chat) |
84 gaim_chat_add_user(GAIM_CHAT(ms->chat), gc->username, NULL); | 84 gaim_chat_add_user(GAIM_CHAT(ms->chat), gc->username, NULL); |
85 } else if (!g_strncasecmp(buf, "BYE", 3)) { | 85 } else if (!g_ascii_strncasecmp(buf, "BYE", 3)) { |
86 char *user, *tmp = buf; | 86 char *user, *tmp = buf; |
87 GET_NEXT(tmp); | 87 GET_NEXT(tmp); |
88 user = tmp; | 88 user = tmp; |
89 | 89 |
90 if (ms->chat) { | 90 if (ms->chat) { |
108 WFLAG_SYSTEM, time(NULL)); | 108 WFLAG_SYSTEM, time(NULL)); |
109 | 109 |
110 msn_kill_switch(ms); | 110 msn_kill_switch(ms); |
111 return 0; | 111 return 0; |
112 } | 112 } |
113 } else if (!g_strncasecmp(buf, "CAL", 3)) { | 113 } else if (!g_ascii_strncasecmp(buf, "CAL", 3)) { |
114 } else if (!g_strncasecmp(buf, "IRO", 3)) { | 114 } else if (!g_ascii_strncasecmp(buf, "IRO", 3)) { |
115 char *tot, *user, *tmp = buf; | 115 char *tot, *user, *tmp = buf; |
116 | 116 |
117 GET_NEXT(tmp); | 117 GET_NEXT(tmp); |
118 GET_NEXT(tmp); | 118 GET_NEXT(tmp); |
119 GET_NEXT(tmp); | 119 GET_NEXT(tmp); |
127 if (!ms->chat) | 127 if (!ms->chat) |
128 ms->chat = serv_got_joined_chat(gc, ++id, "MSN Chat"); | 128 ms->chat = serv_got_joined_chat(gc, ++id, "MSN Chat"); |
129 | 129 |
130 gaim_chat_add_user(GAIM_CHAT(ms->chat), user, NULL); | 130 gaim_chat_add_user(GAIM_CHAT(ms->chat), user, NULL); |
131 } | 131 } |
132 } else if (!g_strncasecmp(buf, "JOI", 3)) { | 132 } else if (!g_ascii_strncasecmp(buf, "JOI", 3)) { |
133 char *user, *tmp = buf; | 133 char *user, *tmp = buf; |
134 GET_NEXT(tmp); | 134 GET_NEXT(tmp); |
135 user = tmp; | 135 user = tmp; |
136 GET_NEXT(tmp); | 136 GET_NEXT(tmp); |
137 | 137 |
160 return 0; | 160 return 0; |
161 } | 161 } |
162 | 162 |
163 debug_printf("\n"); | 163 debug_printf("\n"); |
164 } | 164 } |
165 } else if (!g_strncasecmp(buf, "MSG", 3)) { | 165 } else if (!g_ascii_strncasecmp(buf, "MSG", 3)) { |
166 char *user, *tmp = buf; | 166 char *user, *tmp = buf; |
167 int length; | 167 int length; |
168 | 168 |
169 GET_NEXT(tmp); | 169 GET_NEXT(tmp); |
170 user = tmp; | 170 user = tmp; |
175 length = atoi(tmp); | 175 length = atoi(tmp); |
176 | 176 |
177 ms->msg = TRUE; | 177 ms->msg = TRUE; |
178 ms->msguser = g_strdup(user); | 178 ms->msguser = g_strdup(user); |
179 ms->msglen = length; | 179 ms->msglen = length; |
180 } else if (!g_strncasecmp(buf, "NAK", 3)) { | 180 } else if (!g_ascii_strncasecmp(buf, "NAK", 3)) { |
181 do_error_dialog(_("An MSN message may not have been received."), NULL, GAIM_ERROR); | 181 do_error_dialog(_("An MSN message may not have been received."), NULL, GAIM_ERROR); |
182 } else if (!g_strncasecmp(buf, "NLN", 3)) { | 182 } else if (!g_ascii_strncasecmp(buf, "NLN", 3)) { |
183 } else if (!g_strncasecmp(buf, "OUT", 3)) { | 183 } else if (!g_ascii_strncasecmp(buf, "OUT", 3)) { |
184 if (ms->chat) | 184 if (ms->chat) |
185 serv_got_chat_left(gc, gaim_chat_get_id(GAIM_CHAT(ms->chat))); | 185 serv_got_chat_left(gc, gaim_chat_get_id(GAIM_CHAT(ms->chat))); |
186 msn_kill_switch(ms); | 186 msn_kill_switch(ms); |
187 return 0; | 187 return 0; |
188 } else if (!g_strncasecmp(buf, "USR", 3)) { | 188 } else if (!g_ascii_strncasecmp(buf, "USR", 3)) { |
189 /* good, we got USR, now we need to find out who we want to talk to */ | 189 /* good, we got USR, now we need to find out who we want to talk to */ |
190 struct msn_switchboard *ms = msn_find_writable_switch(gc); | 190 struct msn_switchboard *ms = msn_find_writable_switch(gc); |
191 | 191 |
192 if (!ms) | 192 if (!ms) |
193 return 0; | 193 return 0; |
219 char *message = NULL; | 219 char *message = NULL; |
220 int flags = 0; | 220 int flags = 0; |
221 | 221 |
222 agent = strstr(msg, "User-Agent: "); | 222 agent = strstr(msg, "User-Agent: "); |
223 if (agent) { | 223 if (agent) { |
224 if (!g_strncasecmp(agent, "User-Agent: Gaim", | 224 if (!g_ascii_strncasecmp(agent, "User-Agent: Gaim", |
225 strlen("User-Agent: Gaim"))) | 225 strlen("User-Agent: Gaim"))) |
226 flags |= IM_FLAG_GAIMUSER; | 226 flags |= IM_FLAG_GAIMUSER; |
227 } | 227 } |
228 | 228 |
229 format = strstr(msg, "X-MMS-IM-Format: "); | 229 format = strstr(msg, "X-MMS-IM-Format: "); |
234 } | 234 } |
235 | 235 |
236 content = strstr(msg, "Content-Type: "); | 236 content = strstr(msg, "Content-Type: "); |
237 if (!content) | 237 if (!content) |
238 return; | 238 return; |
239 if (!g_strncasecmp(content, "Content-Type: text/x-msmsgscontrol\r\n", | 239 if (!g_ascii_strncasecmp(content, "Content-Type: text/x-msmsgscontrol\r\n", |
240 strlen( "Content-Type: text/x-msmsgscontrol\r\n"))) { | 240 strlen( "Content-Type: text/x-msmsgscontrol\r\n"))) { |
241 if (strstr(content,"TypingUser: ") && !ms->chat) { | 241 if (strstr(content,"TypingUser: ") && !ms->chat) { |
242 serv_got_typing(ms->gc, ms->msguser, | 242 serv_got_typing(ms->gc, ms->msguser, |
243 MSN_TYPING_RECV_TIMEOUT, TYPING); | 243 MSN_TYPING_RECV_TIMEOUT, TYPING); |
244 return; | 244 return; |
245 } | 245 } |
246 | 246 |
247 } else if (!g_strncasecmp(content, "Content-Type: text/x-msmsgsinvite;", | 247 } else if (!g_ascii_strncasecmp(content, "Content-Type: text/x-msmsgsinvite;", |
248 strlen("Content-Type: text/x-msmsgsinvite;"))) { | 248 strlen("Content-Type: text/x-msmsgsinvite;"))) { |
249 | 249 |
250 /* | 250 /* |
251 * NOTE: Other things, such as voice communication, would go in | 251 * NOTE: Other things, such as voice communication, would go in |
252 * here too (since they send the same Content-Type). However, | 252 * here too (since they send the same Content-Type). However, |
255 * for anything else that sends a text/x-msmsgsinvite, perhaps | 255 * for anything else that sends a text/x-msmsgsinvite, perhaps |
256 * this should be changed. For now, it stays. | 256 * this should be changed. For now, it stays. |
257 */ | 257 */ |
258 msn_process_ft_msg(ms, content); | 258 msn_process_ft_msg(ms, content); |
259 | 259 |
260 } else if (!g_strncasecmp(content, "Content-Type: text/plain", | 260 } else if (!g_ascii_strncasecmp(content, "Content-Type: text/plain", |
261 strlen("Content-Type: text/plain"))) { | 261 strlen("Content-Type: text/plain"))) { |
262 | 262 |
263 char *skiphead = strstr(msg, "\r\n\r\n"); | 263 char *skiphead = strstr(msg, "\r\n\r\n"); |
264 | 264 |
265 if (!skiphead || !skiphead[4]) { | 265 if (!skiphead || !skiphead[4]) { |
440 GSList *m = md->switches; | 440 GSList *m = md->switches; |
441 | 441 |
442 for (m = md->switches; m != NULL; m = m->next) { | 442 for (m = md->switches; m != NULL; m = m->next) { |
443 struct msn_switchboard *ms = (struct msn_switchboard *)m->data; | 443 struct msn_switchboard *ms = (struct msn_switchboard *)m->data; |
444 | 444 |
445 if (ms->total <= 1 && !g_strcasecmp(ms->user, username)) | 445 if (ms->total <= 1 && !gaim_utf8_strcasecmp(ms->user, username)) |
446 return ms; | 446 return ms; |
447 } | 447 } |
448 | 448 |
449 return NULL; | 449 return NULL; |
450 } | 450 } |