Mercurial > pidgin
annotate src/protocols/msn/notification.c @ 5353:620d05932f00
[gaim-migrate @ 5729]
We shouldn't continue to use a switchboard if we know it doesn't exist.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 11 May 2003 03:45:26 +0000 |
parents | bbf2141d30d0 |
children | 91db34a45cbe |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file notification.c Notification server functions | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 #include "msn.h" | |
23 #include "notification.h" | |
24 #include "away.h" | |
25 #include "error.h" | |
26 #include "utils.h" | |
27 | |
28 typedef struct | |
29 { | |
30 struct gaim_connection *gc; | |
31 MsnUser *user; | |
32 | |
33 } MsnPermitAdd; | |
34 | |
35 static GHashTable *notification_commands = NULL; | |
36 static GHashTable *notification_msg_types = NULL; | |
5312
89948fedf782
[gaim-migrate @ 5684]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
37 G_MODULE_IMPORT GSList *connections; |
5309 | 38 |
39 /************************************************************************** | |
40 * Callbacks | |
41 **************************************************************************/ | |
42 static void | |
43 msn_accept_add_cb(MsnPermitAdd *pa) | |
44 { | |
45 if (g_slist_find(connections, pa->gc) != NULL) { | |
46 MsnSession *session = pa->gc->proto_data; | |
47 char outparams[MSN_BUF_LEN]; | |
48 | |
49 g_snprintf(outparams, sizeof(outparams), "AL %s %s", | |
50 msn_user_get_passport(pa->user), | |
51 msn_url_encode(msn_user_get_name(pa->user))); | |
52 | |
53 if (msn_servconn_send_command(session->notification_conn, | |
54 "ADD", outparams) <= 0) { | |
55 hide_login_progress(pa->gc, _("Write error")); | |
56 signoff(pa->gc); | |
57 return; | |
58 } | |
59 | |
60 gaim_privacy_permit_add(pa->gc->account, | |
61 msn_user_get_passport(pa->user)); | |
62 build_allow_list(); | |
63 | |
64 show_got_added(pa->gc, NULL, msn_user_get_passport(pa->user), | |
65 msn_user_get_name(pa->user), NULL); | |
66 } | |
67 | |
68 msn_user_destroy(pa->user); | |
69 g_free(pa); | |
70 } | |
71 | |
72 static void | |
73 msn_cancel_add_cb(MsnPermitAdd *pa) | |
74 { | |
75 if (g_slist_find(connections, pa->gc) != NULL) { | |
76 MsnSession *session = pa->gc->proto_data; | |
77 char outparams[MSN_BUF_LEN]; | |
78 | |
79 g_snprintf(outparams, sizeof(outparams), "BL %s %s", | |
80 msn_user_get_passport(pa->user), | |
81 msn_url_encode(msn_user_get_name(pa->user))); | |
82 | |
83 if (msn_servconn_send_command(session->notification_conn, | |
84 "ADD", outparams) <= 0) { | |
85 hide_login_progress(pa->gc, _("Write error")); | |
86 signoff(pa->gc); | |
87 return; | |
88 } | |
89 | |
90 gaim_privacy_deny_add(pa->gc->account, | |
91 msn_user_get_passport(pa->user)); | |
92 build_block_list(); | |
93 } | |
94 | |
95 msn_user_destroy(pa->user); | |
96 g_free(pa); | |
97 } | |
98 | |
99 /************************************************************************** | |
100 * Catch-all commands | |
101 **************************************************************************/ | |
102 static gboolean | |
103 __blank_cmd(MsnServConn *servconn, const char *command, const char **params, | |
104 size_t param_count) | |
105 { | |
106 return TRUE; | |
107 } | |
108 | |
109 static gboolean | |
110 __unknown_cmd(MsnServConn *servconn, const char *command, const char **params, | |
111 size_t param_count) | |
112 { | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
113 char buf[MSN_BUF_LEN]; |
5309 | 114 |
5334
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
115 if (isdigit(*command)) { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
116 int errnum = atoi(command); |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
117 |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
118 if (errnum == 225) { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
119 /* |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
120 * Ignore this. It happens as a result of moving a buddy from |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
121 * one group that isn't on the server to another that is. |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
122 * The user doesn't care if the old group was there or not. |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
123 */ |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
124 return TRUE; |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
125 } |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
126 |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
127 g_snprintf(buf, sizeof(buf), "MSN Error: %s\n", |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
128 msn_error_get_text(errnum)); |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
129 } |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
130 else { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
131 g_snprintf(buf, sizeof(buf), "MSN Error: Unable to parse message\n"); |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
132 } |
5309 | 133 |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
134 do_error_dialog(buf, NULL, GAIM_ERROR); |
5309 | 135 |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
136 return TRUE; |
5309 | 137 } |
138 | |
139 | |
140 /************************************************************************** | |
141 * Login | |
142 **************************************************************************/ | |
143 static gboolean | |
144 __ver_cmd(MsnServConn *servconn, const char *command, const char **params, | |
145 size_t param_count) | |
146 { | |
147 struct gaim_connection *gc = servconn->session->account->gc; | |
148 size_t i; | |
149 gboolean msnp5_found = FALSE; | |
150 | |
151 for (i = 1; i < param_count; i++) { | |
152 if (!strcmp(params[i], "MSNP5")) { | |
153 msnp5_found = TRUE; | |
154 break; | |
155 } | |
156 } | |
157 | |
158 if (!msnp5_found) { | |
159 hide_login_progress(gc, _("Protocol not supported")); | |
160 signoff(gc); | |
161 | |
162 return FALSE; | |
163 } | |
164 | |
165 if (!msn_servconn_send_command(servconn, "INF", NULL)) { | |
166 hide_login_progress(gc, _("Unable to request INF")); | |
167 signoff(gc); | |
168 | |
169 return FALSE; | |
170 } | |
171 | |
172 return TRUE; | |
173 } | |
174 | |
175 static gboolean | |
176 __inf_cmd(MsnServConn *servconn, const char *command, const char **params, | |
177 size_t param_count) | |
178 { | |
179 struct gaim_connection *gc = servconn->session->account->gc; | |
180 char outparams[MSN_BUF_LEN]; | |
181 | |
182 if (strcmp(params[1], "MD5")) { | |
183 hide_login_progress(gc, _("Unable to login using MD5")); | |
184 signoff(gc); | |
185 | |
186 return FALSE; | |
187 } | |
188 | |
189 g_snprintf(outparams, sizeof(outparams), "MD5 I %s", gc->username); | |
190 | |
191 if (!msn_servconn_send_command(servconn, "USR", outparams)) { | |
192 hide_login_progress(gc, _("Unable to send USR")); | |
193 signoff(gc); | |
194 | |
195 return FALSE; | |
196 } | |
197 | |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
198 set_login_progress(gc, 4, _("Requesting to send password")); |
5309 | 199 |
200 return TRUE; | |
201 } | |
202 | |
203 static gboolean | |
204 __usr_cmd(MsnServConn *servconn, const char *command, const char **params, | |
205 size_t param_count) | |
206 { | |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
207 MsnSession *session = servconn->session; |
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
208 struct gaim_connection *gc = session->account->gc; |
5309 | 209 char outparams[MSN_BUF_LEN]; |
210 | |
211 /* We're either getting the challenge or the OK. Let's find out. */ | |
212 if (!g_ascii_strcasecmp(params[1], "OK")) { | |
213 /* OK */ | |
214 | |
215 if (!msn_servconn_send_command(servconn, "SYN", "0")) { | |
216 hide_login_progress(gc, _("Unable to write")); | |
217 signoff(gc); | |
218 | |
219 return FALSE; | |
220 } | |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
221 |
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
222 set_login_progress(session->account->gc, 4, _("Retrieving buddy list")); |
5309 | 223 } |
224 else { | |
225 /* Challenge */ | |
226 const char *challenge = params[3]; | |
227 char buf[MSN_BUF_LEN]; | |
228 md5_state_t st; | |
229 md5_byte_t di[16]; | |
230 int i; | |
231 | |
232 g_snprintf(buf, sizeof(buf), "%s%s", challenge, gc->password); | |
233 | |
234 md5_init(&st); | |
235 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
236 md5_finish(&st, di); | |
237 | |
238 g_snprintf(outparams, sizeof(outparams), "MD5 S "); | |
239 | |
240 for (i = 0; i < 16; i++) { | |
241 g_snprintf(buf, sizeof(buf), "%02x", di[i]); | |
242 strcat(outparams, buf); | |
243 } | |
244 | |
245 if (!msn_servconn_send_command(servconn, "USR", outparams)) { | |
246 hide_login_progress(gc, _("Unable to send password")); | |
247 signoff(gc); | |
248 | |
249 return FALSE; | |
250 } | |
251 | |
252 set_login_progress(gc, 4, _("Password sent")); | |
253 } | |
254 | |
255 return TRUE; | |
256 } | |
257 | |
258 /************************************************************************** | |
259 * Log out | |
260 **************************************************************************/ | |
261 static gboolean | |
262 __out_cmd(MsnServConn *servconn, const char *command, const char **params, | |
263 size_t param_count) | |
264 { | |
265 struct gaim_connection *gc = servconn->session->account->gc; | |
266 | |
267 if (!g_ascii_strcasecmp(params[0], "OTH")) { | |
268 hide_login_progress(gc, | |
269 _("You have been disconnected. You have " | |
270 "signed on from another location.")); | |
271 signoff(gc); | |
272 } | |
273 else if (!g_ascii_strcasecmp(params[0], "SSD")) { | |
274 hide_login_progress(gc, | |
275 _("You have been disconnected. The MSN servers " | |
276 "are going down temporarily.")); | |
277 signoff(gc); | |
278 } | |
279 | |
280 return FALSE; | |
281 } | |
282 | |
283 /************************************************************************** | |
284 * Messages | |
285 **************************************************************************/ | |
286 static gboolean | |
287 __msg_cmd(MsnServConn *servconn, const char *command, const char **params, | |
288 size_t param_count) | |
289 { | |
290 gaim_debug(GAIM_DEBUG_INFO, "msn", "Found message. Parsing.\n"); | |
291 | |
292 servconn->parsing_msg = TRUE; | |
293 servconn->msg_passport = g_strdup(params[0]); | |
294 servconn->msg_friendly = g_strdup(params[1]); | |
295 servconn->msg_len = atoi(params[2]); | |
296 | |
297 return TRUE; | |
298 } | |
299 | |
300 /************************************************************************** | |
301 * Challenges | |
302 **************************************************************************/ | |
303 static gboolean | |
304 __chl_cmd(MsnServConn *servconn, const char *command, const char **params, | |
305 size_t param_count) | |
306 { | |
307 struct gaim_connection *gc = servconn->session->account->gc; | |
308 char buf[MSN_BUF_LEN]; | |
309 char buf2[3]; | |
310 md5_state_t st; | |
311 md5_byte_t di[16]; | |
312 int i; | |
313 | |
314 md5_init(&st); | |
315 md5_append(&st, (const md5_byte_t *)params[1], strlen(params[1])); | |
316 md5_append(&st, (const md5_byte_t *)"Q1P7W2E4J9R8U3S5", | |
317 strlen("Q1P7W2E4J9R8U3S5")); | |
318 md5_finish(&st, di); | |
319 | |
320 g_snprintf(buf, sizeof(buf), | |
321 "QRY %u msmsgs@msnmsgr.com 32\r\n", | |
322 servconn->session->trId++); | |
323 | |
324 for (i = 0; i < 16; i++) { | |
325 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); | |
326 strcat(buf, buf2); | |
327 } | |
328 | |
329 if (msn_servconn_write(servconn, buf, strlen(buf)) <= 0) { | |
330 hide_login_progress(gc, _("Unable to write to server")); | |
331 signoff(gc); | |
332 } | |
333 | |
334 return TRUE; | |
335 } | |
336 | |
337 /************************************************************************** | |
338 * Buddy Lists | |
339 **************************************************************************/ | |
340 static gboolean | |
341 __add_cmd(MsnServConn *servconn, const char *command, const char **params, | |
342 size_t param_count) | |
343 { | |
344 MsnSession *session = servconn->session; | |
345 struct gaim_connection *gc = session->account->gc; | |
346 MsnPermitAdd *pa; | |
347 GSList *sl; | |
348 const char *list, *passport; | |
349 char *friend; | |
350 char msg[MSN_BUF_LEN]; | |
351 | |
352 list = params[1]; | |
353 passport = params[3]; | |
354 | |
355 friend = msn_url_decode(params[4]); | |
356 | |
357 if (g_ascii_strcasecmp(list, "RL")) | |
358 return TRUE; | |
359 | |
360 for (sl = gc->account->permit; sl != NULL; sl = sl->next) { | |
361 if (!gaim_utf8_strcasecmp(sl->data, passport)) | |
362 return TRUE; | |
363 } | |
364 | |
365 pa = g_new0(MsnPermitAdd, 1); | |
366 pa->user = msn_user_new(session, passport, friend); | |
367 pa->gc = gc; | |
368 | |
369 g_snprintf(msg, sizeof(msg), | |
370 _("The user %s (%s) wants to add %s to his or her buddy list."), | |
371 passport, friend, gc->username); | |
372 | |
373 do_ask_dialog(msg, NULL, pa, | |
374 _("Authorize"), msn_accept_add_cb, | |
375 _("Deny"), msn_cancel_add_cb, | |
376 session->prpl->handle, FALSE); | |
377 | |
378 return TRUE; | |
379 } | |
380 | |
381 static gboolean | |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
382 __adg_cmd(MsnServConn *servconn, const char *command, const char **params, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
383 size_t param_count) |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
384 { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
385 MsnSession *session = servconn->session; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
386 gint *group_id; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
387 char *group_name; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
388 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
389 group_id = g_new(gint, 1); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
390 *group_id = atoi(params[3]); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
391 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
392 group_name = msn_url_decode(params[2]); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
393 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
394 gaim_debug(GAIM_DEBUG_INFO, "msn", "Added group %s (id %d)\n", |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
395 group_name, group_id); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
396 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
397 g_hash_table_insert(session->group_ids, group_name, group_id); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
398 g_hash_table_insert(session->group_names, group_id, g_strdup(group_name)); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
399 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
400 return TRUE; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
401 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
402 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
403 static gboolean |
5309 | 404 __blp_cmd(MsnServConn *servconn, const char *command, const char **params, |
405 size_t param_count) | |
406 { | |
407 struct gaim_connection *gc = servconn->session->account->gc; | |
408 | |
409 if (!g_ascii_strcasecmp(params[2], "AL")) { | |
410 /* | |
411 * If the current setting is AL, messages from users who | |
412 * are not in BL will be delivered. | |
413 * | |
414 * In other words, deny some. | |
415 */ | |
416 gc->account->permdeny = DENY_SOME; | |
417 } | |
418 else { | |
419 /* If the current setting is BL, only messages from people | |
420 * who are in the AL will be delivered. | |
421 * | |
422 * In other words, permit some. | |
423 */ | |
424 gc->account->permdeny = PERMIT_SOME; | |
425 } | |
426 | |
427 return TRUE; | |
428 } | |
429 | |
430 static gboolean | |
431 __fln_cmd(MsnServConn *servconn, const char *command, const char **params, | |
432 size_t param_count) | |
433 { | |
434 struct gaim_connection *gc = servconn->session->account->gc; | |
435 | |
436 serv_got_update(gc, (char *)params[0], 0, 0, 0, 0, 0); | |
437 | |
438 return TRUE; | |
439 } | |
440 | |
441 static gboolean | |
442 __iln_cmd(MsnServConn *servconn, const char *command, const char **params, | |
443 size_t param_count) | |
444 { | |
445 struct gaim_connection *gc = servconn->session->account->gc; | |
446 int status = 0; | |
447 const char *state, *passport, *friend; | |
448 | |
449 state = params[1]; | |
450 passport = params[2]; | |
451 friend = msn_url_decode(params[3]); | |
452 | |
453 serv_got_alias(gc, (char *)passport, (char *)friend); | |
454 | |
455 if (!g_ascii_strcasecmp(state, "BSY")) | |
456 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
457 else if (!g_ascii_strcasecmp(state, "IDL")) | |
458 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
459 else if (!g_ascii_strcasecmp(state, "BRB")) | |
460 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
461 else if (!g_ascii_strcasecmp(state, "AWY")) | |
462 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
463 else if (!g_ascii_strcasecmp(state, "PHN")) | |
464 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
465 else if (!g_ascii_strcasecmp(state, "LUN")) | |
466 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
467 | |
468 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
469 | |
470 return TRUE; | |
471 } | |
472 | |
473 static gboolean | |
474 __lsg_cmd(MsnServConn *servconn, const char *command, const char **params, | |
475 size_t param_count) | |
476 { | |
477 MsnSession *session = servconn->session; | |
478 struct group *g; | |
479 const char *name; | |
480 int group_num, num_groups, group_id; | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
481 gint *group_id_1, *group_id_2; |
5309 | 482 |
483 group_num = atoi(params[2]); | |
484 num_groups = atoi(params[3]); | |
485 group_id = atoi(params[4]); | |
486 name = msn_url_decode(params[5]); | |
487 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
488 if (num_groups == 0) |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
489 return TRUE; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
490 |
5309 | 491 if (group_num == 1) { |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
492 session->group_names = g_hash_table_new_full(g_int_hash, g_int_equal, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
493 g_free, g_free); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
494 session->group_ids = g_hash_table_new_full(g_str_hash, g_str_equal, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
495 g_free, g_free); |
5309 | 496 } |
497 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
498 group_id_1 = g_new(gint, 1); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
499 group_id_2 = g_new(gint, 1); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
500 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
501 *group_id_1 = group_id; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
502 *group_id_2 = group_id; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
503 |
5323
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
504 if (!strcmp(name, "~")) |
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
505 name = _("Buddies"); |
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
506 |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
507 g_hash_table_insert(session->group_names, group_id_1, g_strdup(name)); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
508 g_hash_table_insert(session->group_ids, g_strdup(name), group_id_2); |
5309 | 509 |
510 if ((g = gaim_find_group(name)) == NULL) { | |
511 g = gaim_group_new(name); | |
512 gaim_blist_add_group(g, NULL); | |
513 } | |
514 | |
515 return TRUE; | |
516 } | |
517 | |
518 static gboolean | |
519 __lst_cmd(MsnServConn *servconn, const char *command, const char **params, | |
520 size_t param_count) | |
521 { | |
522 MsnSession *session = servconn->session; | |
523 struct gaim_connection *gc = session->account->gc; | |
524 int user_num; | |
525 int num_users; | |
526 const char *type; | |
527 const char *passport; | |
528 const char *friend; | |
529 | |
530 user_num = atoi(params[3]); | |
531 num_users = atoi(params[4]); | |
532 | |
533 if (user_num == 0 && num_users == 0) | |
534 return TRUE; /* There are no users on this list. */ | |
535 | |
536 type = params[1]; | |
537 passport = params[5]; | |
538 friend = msn_url_decode(params[6]); | |
539 | |
540 if (!g_ascii_strcasecmp(type, "FL") && user_num != 0) { | |
541 /* These are users on our contact list. */ | |
542 MsnUser *user; | |
543 | |
544 user = msn_user_new(session, passport, friend); | |
545 | |
546 if (param_count == 8) | |
547 msn_user_set_group_id(user, atoi(params[7])); | |
548 | |
549 session->lists.forward = g_slist_append(session->lists.forward, user); | |
550 } | |
551 else if (!g_ascii_strcasecmp(type, "AL") && user_num != 0) { | |
552 /* These are users who are allowed to see our status. */ | |
553 if (g_slist_find_custom(gc->account->deny, passport, | |
554 (GCompareFunc)strcmp)) { | |
555 | |
556 gaim_debug(GAIM_DEBUG_INFO, "msn", | |
557 "Moving user from deny list to permit: %s (%s)\n", | |
558 passport, friend); | |
559 | |
560 gaim_privacy_deny_remove(gc->account, passport); | |
561 } | |
562 | |
563 gaim_privacy_permit_add(gc->account, passport); | |
564 } | |
565 else if (!g_ascii_strcasecmp(type, "BL") && user_num != 0) { | |
566 /* These are users who are not allowed to see our status. */ | |
567 gaim_privacy_deny_add(gc->account, passport); | |
568 } | |
569 else if (!g_ascii_strcasecmp(type, "RL")) { | |
570 /* These are users who have us on their contact list. */ | |
571 if (user_num > 0) { | |
572 gboolean new_entry = TRUE; | |
573 | |
574 if (g_slist_find_custom(gc->account->permit, passport, | |
575 (GCompareFunc)g_ascii_strcasecmp)) { | |
576 new_entry = FALSE; | |
577 } | |
578 | |
579 if (g_slist_find_custom(gc->account->deny, passport, | |
580 (GCompareFunc)g_ascii_strcasecmp)) { | |
581 new_entry = FALSE; | |
582 } | |
583 | |
584 if (new_entry) { | |
585 MsnPermitAdd *pa; | |
586 char msg[MSN_BUF_LEN]; | |
587 | |
588 gaim_debug(GAIM_DEBUG_WARNING, "msn", | |
589 "Unresolved MSN RL entry: %s\n", passport); | |
590 | |
591 pa = g_new0(MsnPermitAdd, 1); | |
592 pa->user = msn_user_new(session, passport, friend); | |
593 pa->gc = gc; | |
594 | |
595 g_snprintf(msg, sizeof(msg), | |
596 _("The user %s (%s) wants to add you to their " | |
597 "buddy list."), | |
598 msn_user_get_passport(pa->user), | |
599 msn_user_get_name(pa->user)); | |
600 | |
601 do_ask_dialog(msg, NULL, pa, | |
602 _("Authorize"), msn_accept_add_cb, | |
603 _("Deny"), msn_cancel_add_cb, | |
604 session->prpl->handle, FALSE); | |
605 } | |
606 } | |
607 | |
608 if (user_num != num_users) | |
609 return TRUE; /* This isn't the last one in the RL. */ | |
610 | |
611 if (!msn_servconn_send_command(servconn, "CHG", "NLN")) { | |
612 hide_login_progress(gc, _("Unable to write")); | |
613 signoff(gc); | |
614 | |
615 return FALSE; | |
616 } | |
617 | |
618 account_online(gc); | |
619 serv_finish_login(gc); | |
620 | |
621 session->lists.allow = g_slist_copy(gc->account->permit); | |
622 session->lists.block = g_slist_copy(gc->account->deny); | |
623 | |
624 while (session->lists.forward != NULL) { | |
625 MsnUser *user = session->lists.forward->data; | |
626 struct buddy *b; | |
627 | |
628 b = gaim_find_buddy(gc->account, msn_user_get_passport(user)); | |
629 | |
630 session->lists.forward = g_slist_remove(session->lists.forward, | |
631 user); | |
632 | |
633 if (b == NULL) { | |
634 struct group *g = NULL; | |
635 const char *group_name = NULL; | |
636 int group_id; | |
637 | |
638 group_id = msn_user_get_group_id(user); | |
639 | |
640 if (group_id > -1) { | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
641 group_name = g_hash_table_lookup(session->group_names, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
642 &group_id); |
5309 | 643 } |
644 | |
645 if (group_name == NULL) { | |
646 gaim_debug(GAIM_DEBUG_WARNING, "msn", | |
647 "Group ID %d for user %s was not defined.\n", | |
648 group_id, passport); | |
649 } | |
650 else if ((g = gaim_find_group(group_name)) == NULL) { | |
651 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
652 "Group '%s' appears in server-side " | |
653 "buddy list, but not here!", | |
654 group_name); | |
655 } | |
656 | |
657 if (g == NULL) { | |
658 if ((g = gaim_find_group(_("Buddies"))) == NULL) { | |
659 g = gaim_group_new(_("Buddies")); | |
660 gaim_blist_add_group(g, NULL); | |
661 } | |
662 } | |
663 | |
664 b = gaim_buddy_new(gc->account, | |
665 msn_user_get_passport(user), NULL); | |
666 | |
667 gaim_blist_add_buddy(b, g, NULL); | |
668 } | |
669 | |
670 serv_got_alias(gc, (char *)msn_user_get_passport(user), | |
671 (char *)msn_user_get_name(user)); | |
672 | |
673 msn_user_destroy(user); | |
674 } | |
675 } | |
676 | |
677 return TRUE; | |
678 } | |
679 | |
680 static gboolean | |
681 __nln_cmd(MsnServConn *servconn, const char *command, const char **params, | |
682 size_t param_count) | |
683 { | |
684 MsnSession *session = servconn->session; | |
685 struct gaim_connection *gc = session->account->gc; | |
686 const char *state; | |
687 const char *passport; | |
688 const char *friend; | |
689 int status = 0; | |
690 | |
691 state = params[0]; | |
692 passport = params[1]; | |
693 friend = msn_url_decode(params[2]); | |
694 | |
695 serv_got_alias(gc, (char *)passport, (char *)friend); | |
696 | |
697 if (!g_ascii_strcasecmp(state, "BSY")) | |
698 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
699 else if (!g_ascii_strcasecmp(state, "IDL")) | |
700 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
701 else if (!g_ascii_strcasecmp(state, "BRB")) | |
702 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
703 else if (!g_ascii_strcasecmp(state, "AWY")) | |
704 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
705 else if (!g_ascii_strcasecmp(state, "PHN")) | |
706 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
707 else if (!g_ascii_strcasecmp(state, "LUN")) | |
708 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
709 | |
710 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
711 | |
712 return TRUE; | |
713 } | |
714 | |
715 static gboolean | |
716 __rea_cmd(MsnServConn *servconn, const char *command, const char **params, | |
717 size_t param_count) | |
718 { | |
719 MsnSession *session = servconn->session; | |
720 struct gaim_connection *gc = session->account->gc; | |
721 char *friend; | |
722 | |
723 friend = msn_url_decode(params[2]); | |
724 | |
725 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); | |
726 | |
727 return TRUE; | |
728 } | |
729 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
730 static gboolean |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
731 __reg_cmd(MsnServConn *servconn, const char *command, const char **params, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
732 size_t param_count) |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
733 { |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
734 MsnSession *session = servconn->session; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
735 gint *group_id; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
736 char *group_name; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
737 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
738 group_id = g_new(gint, 1); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
739 *group_id = atoi(params[2]); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
740 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
741 group_name = msn_url_decode(params[3]); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
742 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
743 gaim_debug(GAIM_DEBUG_INFO, "msn", "Renamed group %s to %s\n", |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
744 g_hash_table_lookup(session->group_names, group_id), |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
745 group_name); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
746 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
747 g_hash_table_replace(session->group_names, group_id, g_strdup(group_name)); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
748 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
749 g_hash_table_remove(session->group_ids, group_name); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
750 g_hash_table_insert(session->group_ids, group_name, group_id); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
751 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
752 return TRUE; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
753 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
754 |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
755 static gboolean |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
756 __rem_cmd(MsnServConn *servconn, const char *command, const char **params, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
757 size_t param_count) |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
758 { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
759 MsnSession *session = servconn->session; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
760 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
761 /* I hate this. */ |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
762 if (session->moving_buddy) { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
763 struct gaim_connection *gc = session->account->gc; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
764 const char *passport = params[3]; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
765 char outparams[MSN_BUF_LEN]; |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
766 int *group_id; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
767 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
768 group_id = g_hash_table_lookup(session->group_ids, |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
769 session->dest_group_name); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
770 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
771 g_free(session->dest_group_name); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
772 session->dest_group_name = NULL; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
773 session->moving_buddy = FALSE; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
774 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
775 if (group_id == NULL) { |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
776 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
777 "Still don't have a group ID for %s while moving %s!\n", |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
778 session->dest_group_name, passport); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
779 return TRUE; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
780 } |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
781 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
782 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
783 passport, passport, *group_id); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
784 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
785 if (!msn_servconn_send_command(session->notification_conn, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
786 "ADD", outparams)) { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
787 hide_login_progress(gc, _("Write error")); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
788 signoff(gc); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
789 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
790 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
791 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
792 return TRUE; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
793 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
794 |
5309 | 795 /************************************************************************** |
796 * Misc commands | |
797 **************************************************************************/ | |
798 static gboolean | |
799 __url_cmd(MsnServConn *servconn, const char *command, const char **params, | |
800 size_t param_count) | |
801 { | |
802 MsnSession *session = servconn->session; | |
803 struct gaim_connection *gc = session->account->gc; | |
804 const char *rru; | |
805 const char *url; | |
806 md5_state_t st; | |
807 md5_byte_t di[16]; | |
808 FILE *fd; | |
809 char buf[2048]; | |
810 char buf2[3]; | |
811 char sendbuf[64]; | |
812 int i; | |
813 | |
814 rru = params[1]; | |
815 url = params[2]; | |
816 | |
817 g_snprintf(buf, sizeof(buf), "%s%lu%s", | |
818 session->passport_info.mspauth, | |
819 time(NULL) - session->passport_info.sl, gc->password); | |
820 | |
821 md5_init(&st); | |
822 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
823 md5_finish(&st, di); | |
824 | |
825 memset(sendbuf, 0, sizeof(sendbuf)); | |
826 | |
827 for (i = 0; i < 16; i++) { | |
828 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); | |
829 strcat(sendbuf, buf2); | |
830 } | |
831 | |
832 if (session->passport_info.file != NULL) { | |
833 unlink(session->passport_info.file); | |
834 g_free(session->passport_info.file); | |
835 } | |
836 | |
837 if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL) { | |
838 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
839 "Error opening temp passport file: %s\n", | |
840 strerror(errno)); | |
841 } | |
842 else { | |
843 fputs("<html>\n" | |
844 "<head>\n" | |
845 "<noscript>\n" | |
846 "<meta http-equiv=\"Refresh\" content=\"0; " | |
847 "url=http://www.hotmail.com\">\n" | |
848 "</noscript>\n" | |
849 "</head>\n\n", | |
850 fd); | |
851 | |
852 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); | |
853 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", | |
854 url); | |
855 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); | |
856 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", | |
857 gc->username); | |
858 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", | |
859 gc->username); | |
860 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", | |
861 session->passport_info.sid); | |
862 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", | |
863 session->passport_info.kv); | |
864 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); | |
865 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", | |
866 time(NULL) - session->passport_info.sl); | |
867 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", | |
868 rru); | |
869 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", | |
870 session->passport_info.mspauth); | |
871 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", | |
872 sendbuf); /* TODO Digest me (huh? -- ChipX86) */ | |
873 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); | |
874 fprintf(fd, "<input type=\"hiden\" name=\"js\" value=\"yes\">\n"); | |
875 fprintf(fd, "</form></body>\n"); | |
876 fprintf(fd, "</html>\n"); | |
877 | |
878 if (fclose(fd)) { | |
879 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
880 "Error closing temp passport file: %s\n", | |
881 strerror(errno)); | |
882 | |
883 unlink(session->passport_info.file); | |
884 g_free(session->passport_info.file); | |
885 } | |
886 else { | |
887 /* | |
888 * Renaming file with .html extension, so that the | |
889 * win32 open_url will work. | |
890 */ | |
891 char *tmp; | |
892 | |
893 if ((tmp = g_strdup_printf("%s.html", | |
894 session->passport_info.file)) != NULL) { | |
895 | |
896 if (rename(session->passport_info.file, tmp) == 0) { | |
897 g_free(session->passport_info.file); | |
898 session->passport_info.file = tmp; | |
899 } | |
900 else | |
901 g_free(tmp); | |
902 } | |
903 } | |
904 } | |
905 | |
906 return TRUE; | |
907 } | |
908 /************************************************************************** | |
909 * Switchboards | |
910 **************************************************************************/ | |
911 static gboolean | |
912 __rng_cmd(MsnServConn *servconn, const char *command, const char **params, | |
913 size_t param_count) | |
914 { | |
915 MsnSession *session = servconn->session; | |
916 MsnSwitchBoard *swboard; | |
917 MsnUser *user; | |
918 const char *session_id; | |
919 char *host, *c; | |
920 int port; | |
921 | |
922 session_id = params[0]; | |
923 | |
924 host = g_strdup(params[1]); | |
925 | |
926 if ((c = strchr(host, ':')) != NULL) { | |
927 *c = '\0'; | |
928 port = atoi(c + 1); | |
929 } | |
930 else | |
931 port = 1863; | |
932 | |
933 swboard = msn_switchboard_new(session); | |
934 | |
935 user = msn_user_new(session, params[4], NULL); | |
936 | |
937 msn_switchboard_set_invited(swboard, TRUE); | |
938 msn_switchboard_set_session_id(swboard, params[0]); | |
939 msn_switchboard_set_auth_key(swboard, params[3]); | |
940 msn_switchboard_set_user(swboard, user); | |
941 | |
942 if (!msn_switchboard_connect(swboard, host, port)) { | |
943 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
944 "Unable to connect to switchboard on %s, port %d\n", | |
945 host, port); | |
946 | |
947 g_free(host); | |
948 | |
949 return FALSE; | |
950 } | |
951 | |
952 g_free(host); | |
953 | |
954 return TRUE; | |
955 } | |
956 | |
957 static gboolean | |
958 __xfr_cmd(MsnServConn *servconn, const char *command, const char **params, | |
959 size_t param_count) | |
960 { | |
961 MsnSession *session = servconn->session; | |
962 MsnSwitchBoard *swboard; | |
963 struct gaim_connection *gc = session->account->gc; | |
964 char *host; | |
965 char *c; | |
966 int port; | |
967 | |
968 if (strcmp(params[1], "SB")) { | |
969 hide_login_progress(gc, _("Got invalid XFR")); | |
970 signoff(gc); | |
971 | |
972 return FALSE; | |
973 } | |
974 | |
975 host = g_strdup(params[2]); | |
976 | |
977 if ((c = strchr(host, ':')) != NULL) { | |
978 *c = '\0'; | |
979 port = atoi(c + 1); | |
980 } | |
981 else | |
982 port = 1863; | |
983 | |
984 swboard = msn_session_find_unused_switch(session); | |
985 | |
986 if (swboard == NULL) { | |
987 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
988 "Received an XFR SB request when there's no unused " | |
989 "switchboards!\n"); | |
5353
620d05932f00
[gaim-migrate @ 5729]
Christian Hammond <chipx86@chipx86.com>
parents:
5334
diff
changeset
|
990 return FALSE; |
5309 | 991 } |
992 | |
993 msn_switchboard_set_auth_key(swboard, params[4]); | |
994 | |
995 if (!msn_switchboard_connect(swboard, host, port)) { | |
996 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
997 "Unable to connect to switchboard on %s, port %d\n", | |
998 host, port); | |
999 | |
1000 g_free(host); | |
1001 | |
1002 return FALSE; | |
1003 } | |
1004 | |
1005 g_free(host); | |
1006 | |
1007 return TRUE; | |
1008 } | |
1009 | |
1010 /************************************************************************** | |
1011 * Message Types | |
1012 **************************************************************************/ | |
1013 static gboolean | |
1014 __profile_msg(MsnServConn *servconn, const MsnMessage *msg) | |
1015 { | |
1016 MsnSession *session = servconn->session; | |
1017 const char *value; | |
1018 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1019 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1020 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1021 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1022 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1023 |
5309 | 1024 if ((value = msn_message_get_attr(msg, "kv")) != NULL) |
1025 session->passport_info.kv = g_strdup(value); | |
1026 | |
1027 if ((value = msn_message_get_attr(msg, "sid")) != NULL) | |
1028 session->passport_info.sid = g_strdup(value); | |
1029 | |
1030 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) | |
1031 session->passport_info.mspauth = g_strdup(value); | |
1032 | |
1033 return TRUE; | |
1034 } | |
1035 | |
1036 static gboolean | |
1037 __initial_email_msg(MsnServConn *servconn, const MsnMessage *msg) | |
1038 { | |
1039 MsnSession *session = servconn->session; | |
1040 struct gaim_connection *gc = session->account->gc; | |
1041 GHashTable *table; | |
1042 const char *unread; | |
1043 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1044 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1045 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1046 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1047 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1048 |
5309 | 1049 table = msn_message_get_hashtable_from_body(msg); |
1050 | |
1051 unread = g_hash_table_lookup(table, "Inbox-Unread"); | |
1052 | |
1053 if (unread != NULL) | |
1054 connection_has_mail(gc, atoi(unread), NULL, NULL, | |
1055 session->passport_info.file); | |
1056 | |
1057 g_hash_table_destroy(table); | |
1058 | |
1059 return TRUE; | |
1060 } | |
1061 | |
1062 static gboolean | |
1063 __email_msg(MsnServConn *servconn, const MsnMessage *msg) | |
1064 { | |
1065 MsnSession *session = servconn->session; | |
1066 struct gaim_connection *gc = session->account->gc; | |
1067 GHashTable *table; | |
1068 const char *from, *subject; | |
1069 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1070 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1071 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1072 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1073 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1074 |
5309 | 1075 table = msn_message_get_hashtable_from_body(msg); |
1076 | |
1077 from = g_hash_table_lookup(table, "From"); | |
1078 subject = g_hash_table_lookup(table, "Subject"); | |
1079 | |
1080 if (from == NULL || subject == NULL) { | |
1081 connection_has_mail(gc, 1, NULL, NULL, session->passport_info.file); | |
1082 } | |
1083 else { | |
1084 connection_has_mail(gc, -1, from, subject, | |
1085 session->passport_info.file); | |
1086 } | |
1087 | |
1088 g_hash_table_destroy(table); | |
1089 | |
1090 return TRUE; | |
1091 } | |
1092 | |
1093 static gboolean | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1094 __system_msg(MsnServConn *servconn, const MsnMessage *msg) |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1095 { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1096 GHashTable *table; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1097 const char *type_s; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1098 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1099 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1100 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1101 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1102 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1103 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1104 table = msn_message_get_hashtable_from_body(msg); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1105 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1106 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1107 int type = atoi(type_s); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1108 char buf[MSN_BUF_LEN]; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1109 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1110 switch (type) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1111 case 1: |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1112 g_snprintf(buf, sizeof(buf), |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1113 _("The MSN server will shut down for maintenance " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1114 "in %d minute(s). You will automatically be " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1115 "signed out at that time. Please finish any " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1116 "conversations in progress.\n\n" |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1117 "After the maintenance has been completed, you " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1118 "will be able to successfully sign in."), |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1119 atoi(g_hash_table_lookup(table, "Arg1"))); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1120 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1121 default: |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1122 break; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1123 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1124 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1125 if (*buf != '\0') { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1126 do_error_dialog(buf, NULL, GAIM_INFO); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1127 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1128 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1129 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1130 g_hash_table_destroy(table); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1131 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1132 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1133 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1134 static gboolean |
5309 | 1135 __connect_cb(gpointer data, gint source, GaimInputCondition cond) |
1136 { | |
1137 MsnServConn *notification = data; | |
1138 MsnSession *session = notification->session; | |
1139 struct gaim_connection *gc = session->account->gc; | |
1140 | |
1141 if (source == -1) { | |
1142 hide_login_progress(session->account->gc, _("Unable to connect")); | |
1143 signoff(session->account->gc); | |
1144 return FALSE; | |
1145 } | |
1146 | |
1147 if (notification->fd != source) | |
1148 notification->fd = source; | |
1149 | |
1150 if (!msn_servconn_send_command(notification, "VER", | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1151 "MSNP7 MSNP6 MSNP5 MSNP4 CVR0")) { |
5309 | 1152 hide_login_progress(gc, _("Unable to write to server")); |
1153 signoff(gc); | |
1154 return FALSE; | |
1155 } | |
1156 | |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
1157 set_login_progress(session->account->gc, 4, _("Syncing with server")); |
5309 | 1158 |
1159 return TRUE; | |
1160 } | |
1161 | |
1162 static void | |
1163 __failed_read_cb(gpointer data, gint source, GaimInputCondition cond) | |
1164 { | |
1165 MsnServConn *notification = data; | |
1166 struct gaim_connection *gc; | |
1167 | |
1168 gc = notification->session->account->gc; | |
1169 | |
1170 hide_login_progress(gc, _("Error reading from server")); | |
1171 signoff(gc); | |
1172 } | |
1173 | |
1174 MsnServConn * | |
1175 msn_notification_new(MsnSession *session, const char *server, int port) | |
1176 { | |
1177 MsnServConn *notification; | |
1178 | |
1179 notification = msn_servconn_new(session); | |
1180 | |
1181 msn_servconn_set_server(notification, server, port); | |
1182 msn_servconn_set_connect_cb(notification, __connect_cb); | |
1183 msn_servconn_set_failed_read_cb(notification, __failed_read_cb); | |
1184 | |
1185 if (notification_commands == NULL) { | |
1186 /* Register the command callbacks. */ | |
1187 msn_servconn_register_command(notification, "ADD", __add_cmd); | |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1188 msn_servconn_register_command(notification, "ADG", __adg_cmd); |
5309 | 1189 msn_servconn_register_command(notification, "BLP", __blp_cmd); |
1190 msn_servconn_register_command(notification, "BPR", __blank_cmd); | |
1191 msn_servconn_register_command(notification, "CHG", __blank_cmd); | |
1192 msn_servconn_register_command(notification, "CHL", __chl_cmd); | |
1193 msn_servconn_register_command(notification, "FLN", __fln_cmd); | |
1194 msn_servconn_register_command(notification, "GTC", __blank_cmd); | |
1195 msn_servconn_register_command(notification, "ILN", __iln_cmd); | |
1196 msn_servconn_register_command(notification, "INF", __inf_cmd); | |
1197 msn_servconn_register_command(notification, "LSG", __lsg_cmd); | |
1198 msn_servconn_register_command(notification, "LST", __lst_cmd); | |
1199 msn_servconn_register_command(notification, "MSG", __msg_cmd); | |
1200 msn_servconn_register_command(notification, "NLN", __nln_cmd); | |
1201 msn_servconn_register_command(notification, "OUT", __out_cmd); | |
1202 msn_servconn_register_command(notification, "PRP", __blank_cmd); | |
1203 msn_servconn_register_command(notification, "QNG", __blank_cmd); | |
1204 msn_servconn_register_command(notification, "QRY", __blank_cmd); | |
1205 msn_servconn_register_command(notification, "REA", __rea_cmd); | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1206 msn_servconn_register_command(notification, "REG", __reg_cmd); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1207 msn_servconn_register_command(notification, "REM", __rem_cmd); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1208 msn_servconn_register_command(notification, "RMG", __blank_cmd); |
5309 | 1209 msn_servconn_register_command(notification, "RNG", __rng_cmd); |
1210 msn_servconn_register_command(notification, "SYN", __blank_cmd); | |
1211 msn_servconn_register_command(notification, "URL", __url_cmd); | |
1212 msn_servconn_register_command(notification, "USR", __usr_cmd); | |
1213 msn_servconn_register_command(notification, "VER", __ver_cmd); | |
1214 msn_servconn_register_command(notification, "XFR", __xfr_cmd); | |
1215 msn_servconn_register_command(notification, "_unknown_", __unknown_cmd); | |
1216 | |
1217 /* Register the message type callbacks. */ | |
1218 msn_servconn_register_msg_type(notification, "text/x-msmsgsprofile", | |
1219 __profile_msg); | |
1220 msn_servconn_register_msg_type(notification, | |
1221 "text/x-msmsgsinitialemailnotification", | |
1222 __initial_email_msg); | |
1223 msn_servconn_register_msg_type(notification, | |
1224 "text/x-msmsgsemailnotification", | |
1225 __email_msg); | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1226 msn_servconn_register_msg_type(notification, |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1227 "application/x-msmsgssystemmessage", |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1228 __system_msg); |
5309 | 1229 |
1230 /* Save these for future use. */ | |
1231 notification_commands = notification->commands; | |
1232 notification_msg_types = notification->msg_types; | |
1233 } | |
1234 else { | |
1235 g_hash_table_destroy(notification->commands); | |
1236 g_hash_table_destroy(notification->msg_types); | |
1237 | |
1238 notification->commands = notification_commands; | |
1239 notification->msg_types = notification_msg_types; | |
1240 } | |
1241 | |
1242 return notification; | |
1243 } |