Mercurial > pidgin
annotate src/protocols/msn/notification.c @ 5406:9acf4832c0dc
[gaim-migrate @ 5782]
This should prevent the possibility of duplicate buddies when MSN
transfers us to a new notification server (rare).
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 17 May 2003 01:41:52 +0000 |
parents | 150cf1615098 |
children | ad445074d239 |
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" | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
24 #include "state.h" |
5309 | 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 | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
431 __bpr_cmd(MsnServConn *servconn, const char *command, const char **params, |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
432 size_t param_count) |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
433 { |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
434 MsnSession *session = servconn->session; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
435 struct gaim_connection *gc = session->account->gc; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
436 const char *passport, *type, *value; |
5375
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
437 struct buddy *b; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
438 MsnUser *user; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
439 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
440 passport = params[1]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
441 type = params[2]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
442 value = params[3]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
443 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
444 user = msn_users_find_with_passport(session->users, passport); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
445 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
446 if (value != NULL) { |
5375
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
447 if (!strcmp(type, "MOB")) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
448 if (!strcmp(value, "Y")) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
449 user->mobile = TRUE; |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
450 |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
451 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
452 if (GAIM_BUDDY_IS_ONLINE(b)) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
453 serv_got_update(gc, (char *)passport, |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
454 1, 0, 0, 0, b->uc); |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
455 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
456 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
457 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
458 } |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
459 else if (!strcmp(type, "PHH")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
460 msn_user_set_home_phone(user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
461 else if (!strcmp(type, "PHW")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
462 msn_user_set_work_phone(user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
463 else if (!strcmp(type, "PHM")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
464 msn_user_set_mobile_phone(user, msn_url_decode(value)); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
465 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
466 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
467 return TRUE; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
468 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
469 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
470 static gboolean |
5309 | 471 __fln_cmd(MsnServConn *servconn, const char *command, const char **params, |
472 size_t param_count) | |
473 { | |
474 struct gaim_connection *gc = servconn->session->account->gc; | |
475 | |
476 serv_got_update(gc, (char *)params[0], 0, 0, 0, 0, 0); | |
477 | |
478 return TRUE; | |
479 } | |
480 | |
481 static gboolean | |
482 __iln_cmd(MsnServConn *servconn, const char *command, const char **params, | |
483 size_t param_count) | |
484 { | |
485 struct gaim_connection *gc = servconn->session->account->gc; | |
486 int status = 0; | |
487 const char *state, *passport, *friend; | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
488 struct buddy *b; |
5309 | 489 |
490 state = params[1]; | |
491 passport = params[2]; | |
492 friend = msn_url_decode(params[3]); | |
493 | |
494 serv_got_alias(gc, (char *)passport, (char *)friend); | |
495 | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
496 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
497 status |= ((((b->uc) >> 1) & 0xF0) << 1); |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
498 |
5309 | 499 if (!g_ascii_strcasecmp(state, "BSY")) |
500 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
501 else if (!g_ascii_strcasecmp(state, "IDL")) | |
502 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
503 else if (!g_ascii_strcasecmp(state, "BRB")) | |
504 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
505 else if (!g_ascii_strcasecmp(state, "AWY")) | |
506 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
507 else if (!g_ascii_strcasecmp(state, "PHN")) | |
508 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
509 else if (!g_ascii_strcasecmp(state, "LUN")) | |
510 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
511 | |
512 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
513 | |
514 return TRUE; | |
515 } | |
516 | |
517 static gboolean | |
518 __lsg_cmd(MsnServConn *servconn, const char *command, const char **params, | |
519 size_t param_count) | |
520 { | |
521 MsnSession *session = servconn->session; | |
522 struct group *g; | |
523 const char *name; | |
524 int group_num, num_groups, group_id; | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
525 gint *group_id_1, *group_id_2; |
5309 | 526 |
527 group_num = atoi(params[2]); | |
528 num_groups = atoi(params[3]); | |
529 group_id = atoi(params[4]); | |
530 name = msn_url_decode(params[5]); | |
531 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
532 if (num_groups == 0) |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
533 return TRUE; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
534 |
5309 | 535 if (group_num == 1) { |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
536 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
|
537 g_free, g_free); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
538 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
|
539 g_free, g_free); |
5309 | 540 } |
541 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
542 group_id_1 = g_new(gint, 1); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
543 group_id_2 = g_new(gint, 1); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
544 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
545 *group_id_1 = group_id; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
546 *group_id_2 = group_id; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
547 |
5323
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
548 if (!strcmp(name, "~")) |
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
549 name = _("Buddies"); |
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
550 |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
551 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
|
552 g_hash_table_insert(session->group_ids, g_strdup(name), group_id_2); |
5309 | 553 |
554 if ((g = gaim_find_group(name)) == NULL) { | |
555 g = gaim_group_new(name); | |
556 gaim_blist_add_group(g, NULL); | |
557 } | |
558 | |
559 return TRUE; | |
560 } | |
561 | |
562 static gboolean | |
563 __lst_cmd(MsnServConn *servconn, const char *command, const char **params, | |
564 size_t param_count) | |
565 { | |
566 MsnSession *session = servconn->session; | |
567 struct gaim_connection *gc = session->account->gc; | |
568 int user_num; | |
569 int num_users; | |
570 const char *type; | |
571 const char *passport; | |
572 const char *friend; | |
573 | |
574 user_num = atoi(params[3]); | |
575 num_users = atoi(params[4]); | |
576 | |
577 if (user_num == 0 && num_users == 0) | |
578 return TRUE; /* There are no users on this list. */ | |
579 | |
580 type = params[1]; | |
581 passport = params[5]; | |
582 friend = msn_url_decode(params[6]); | |
583 | |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
584 if (session->lists_synced) |
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
585 return TRUE; |
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
586 |
5309 | 587 if (!g_ascii_strcasecmp(type, "FL") && user_num != 0) { |
588 /* These are users on our contact list. */ | |
589 MsnUser *user; | |
590 | |
591 user = msn_user_new(session, passport, friend); | |
592 | |
593 if (param_count == 8) | |
594 msn_user_set_group_id(user, atoi(params[7])); | |
595 | |
596 session->lists.forward = g_slist_append(session->lists.forward, user); | |
597 } | |
598 else if (!g_ascii_strcasecmp(type, "AL") && user_num != 0) { | |
599 /* These are users who are allowed to see our status. */ | |
600 if (g_slist_find_custom(gc->account->deny, passport, | |
601 (GCompareFunc)strcmp)) { | |
602 | |
603 gaim_debug(GAIM_DEBUG_INFO, "msn", | |
604 "Moving user from deny list to permit: %s (%s)\n", | |
605 passport, friend); | |
606 | |
607 gaim_privacy_deny_remove(gc->account, passport); | |
608 } | |
609 | |
610 gaim_privacy_permit_add(gc->account, passport); | |
611 } | |
612 else if (!g_ascii_strcasecmp(type, "BL") && user_num != 0) { | |
613 /* These are users who are not allowed to see our status. */ | |
614 gaim_privacy_deny_add(gc->account, passport); | |
615 } | |
616 else if (!g_ascii_strcasecmp(type, "RL")) { | |
617 /* These are users who have us on their contact list. */ | |
618 if (user_num > 0) { | |
619 gboolean new_entry = TRUE; | |
620 | |
621 if (g_slist_find_custom(gc->account->permit, passport, | |
622 (GCompareFunc)g_ascii_strcasecmp)) { | |
623 new_entry = FALSE; | |
624 } | |
625 | |
626 if (g_slist_find_custom(gc->account->deny, passport, | |
627 (GCompareFunc)g_ascii_strcasecmp)) { | |
628 new_entry = FALSE; | |
629 } | |
630 | |
631 if (new_entry) { | |
632 MsnPermitAdd *pa; | |
633 char msg[MSN_BUF_LEN]; | |
634 | |
635 gaim_debug(GAIM_DEBUG_WARNING, "msn", | |
636 "Unresolved MSN RL entry: %s\n", passport); | |
637 | |
638 pa = g_new0(MsnPermitAdd, 1); | |
639 pa->user = msn_user_new(session, passport, friend); | |
640 pa->gc = gc; | |
641 | |
642 g_snprintf(msg, sizeof(msg), | |
643 _("The user %s (%s) wants to add you to their " | |
644 "buddy list."), | |
645 msn_user_get_passport(pa->user), | |
646 msn_user_get_name(pa->user)); | |
647 | |
648 do_ask_dialog(msg, NULL, pa, | |
649 _("Authorize"), msn_accept_add_cb, | |
650 _("Deny"), msn_cancel_add_cb, | |
651 session->prpl->handle, FALSE); | |
652 } | |
653 } | |
654 | |
655 if (user_num != num_users) | |
656 return TRUE; /* This isn't the last one in the RL. */ | |
657 | |
658 if (!msn_servconn_send_command(servconn, "CHG", "NLN")) { | |
659 hide_login_progress(gc, _("Unable to write")); | |
660 signoff(gc); | |
661 | |
662 return FALSE; | |
663 } | |
664 | |
665 account_online(gc); | |
666 serv_finish_login(gc); | |
667 | |
668 session->lists.allow = g_slist_copy(gc->account->permit); | |
669 session->lists.block = g_slist_copy(gc->account->deny); | |
670 | |
671 while (session->lists.forward != NULL) { | |
672 MsnUser *user = session->lists.forward->data; | |
673 struct buddy *b; | |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
674 |
5309 | 675 b = gaim_find_buddy(gc->account, msn_user_get_passport(user)); |
676 | |
677 session->lists.forward = g_slist_remove(session->lists.forward, | |
678 user); | |
679 | |
680 if (b == NULL) { | |
681 struct group *g = NULL; | |
682 const char *group_name = NULL; | |
683 int group_id; | |
684 | |
685 group_id = msn_user_get_group_id(user); | |
686 | |
687 if (group_id > -1) { | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
688 group_name = g_hash_table_lookup(session->group_names, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
689 &group_id); |
5309 | 690 } |
691 | |
692 if (group_name == NULL) { | |
693 gaim_debug(GAIM_DEBUG_WARNING, "msn", | |
694 "Group ID %d for user %s was not defined.\n", | |
695 group_id, passport); | |
696 } | |
697 else if ((g = gaim_find_group(group_name)) == NULL) { | |
698 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
699 "Group '%s' appears in server-side " | |
700 "buddy list, but not here!", | |
701 group_name); | |
702 } | |
703 | |
704 if (g == NULL) { | |
705 if ((g = gaim_find_group(_("Buddies"))) == NULL) { | |
706 g = gaim_group_new(_("Buddies")); | |
707 gaim_blist_add_group(g, NULL); | |
708 } | |
709 } | |
710 | |
711 b = gaim_buddy_new(gc->account, | |
712 msn_user_get_passport(user), NULL); | |
713 | |
714 gaim_blist_add_buddy(b, g, NULL); | |
715 } | |
716 | |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
717 b->proto_data = user; |
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
718 |
5309 | 719 serv_got_alias(gc, (char *)msn_user_get_passport(user), |
720 (char *)msn_user_get_name(user)); | |
721 } | |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
722 |
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
723 session->lists_synced = TRUE; |
5309 | 724 } |
725 | |
726 return TRUE; | |
727 } | |
728 | |
729 static gboolean | |
730 __nln_cmd(MsnServConn *servconn, const char *command, const char **params, | |
731 size_t param_count) | |
732 { | |
733 MsnSession *session = servconn->session; | |
734 struct gaim_connection *gc = session->account->gc; | |
735 const char *state; | |
736 const char *passport; | |
737 const char *friend; | |
738 int status = 0; | |
739 | |
740 state = params[0]; | |
741 passport = params[1]; | |
742 friend = msn_url_decode(params[2]); | |
743 | |
744 serv_got_alias(gc, (char *)passport, (char *)friend); | |
745 | |
746 if (!g_ascii_strcasecmp(state, "BSY")) | |
747 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
748 else if (!g_ascii_strcasecmp(state, "IDL")) | |
749 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
750 else if (!g_ascii_strcasecmp(state, "BRB")) | |
751 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
752 else if (!g_ascii_strcasecmp(state, "AWY")) | |
753 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
754 else if (!g_ascii_strcasecmp(state, "PHN")) | |
755 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
756 else if (!g_ascii_strcasecmp(state, "LUN")) | |
757 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
758 | |
759 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
760 | |
761 return TRUE; | |
762 } | |
763 | |
764 static gboolean | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
765 __prp_cmd(MsnServConn *servconn, const char *command, const char **params, |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
766 size_t param_count) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
767 { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
768 MsnSession *session = servconn->session; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
769 const char *type, *value; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
770 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
771 type = params[2]; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
772 value = params[3]; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
773 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
774 if (param_count == 4) { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
775 if (!strcmp(type, "PHH")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
776 msn_user_set_home_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
777 else if (!strcmp(type, "PHW")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
778 msn_user_set_work_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
779 else if (!strcmp(type, "PHM")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
780 msn_user_set_mobile_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
781 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
782 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
783 return TRUE; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
784 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
785 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
786 static gboolean |
5309 | 787 __rea_cmd(MsnServConn *servconn, const char *command, const char **params, |
788 size_t param_count) | |
789 { | |
790 MsnSession *session = servconn->session; | |
791 struct gaim_connection *gc = session->account->gc; | |
792 char *friend; | |
793 | |
794 friend = msn_url_decode(params[2]); | |
795 | |
796 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); | |
797 | |
798 return TRUE; | |
799 } | |
800 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
801 static gboolean |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
802 __reg_cmd(MsnServConn *servconn, const char *command, const char **params, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
803 size_t param_count) |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
804 { |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
805 MsnSession *session = servconn->session; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
806 gint *group_id; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
807 char *group_name; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
808 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
809 group_id = g_new(gint, 1); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
810 *group_id = atoi(params[2]); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
811 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
812 group_name = msn_url_decode(params[3]); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
813 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
814 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
|
815 g_hash_table_lookup(session->group_names, group_id), |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
816 group_name); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
817 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
818 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
|
819 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
820 g_hash_table_remove(session->group_ids, group_name); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
821 g_hash_table_insert(session->group_ids, group_name, group_id); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
822 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
823 return TRUE; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
824 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
825 |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
826 static gboolean |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
827 __rem_cmd(MsnServConn *servconn, const char *command, const char **params, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
828 size_t param_count) |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
829 { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
830 MsnSession *session = servconn->session; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
831 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
832 /* I hate this. */ |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
833 if (session->moving_buddy) { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
834 struct gaim_connection *gc = session->account->gc; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
835 const char *passport = params[3]; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
836 char outparams[MSN_BUF_LEN]; |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
837 int *group_id; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
838 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
839 group_id = g_hash_table_lookup(session->group_ids, |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
840 session->dest_group_name); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
841 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
842 g_free(session->dest_group_name); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
843 session->dest_group_name = NULL; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
844 session->moving_buddy = FALSE; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
845 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
846 if (group_id == NULL) { |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
847 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
848 "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
|
849 session->dest_group_name, passport); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
850 return TRUE; |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
851 } |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
852 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
853 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
854 passport, passport, *group_id); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
855 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
856 if (!msn_servconn_send_command(session->notification_conn, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
857 "ADD", outparams)) { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
858 hide_login_progress(gc, _("Write error")); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
859 signoff(gc); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
860 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
861 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
862 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
863 return TRUE; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
864 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
865 |
5309 | 866 /************************************************************************** |
867 * Misc commands | |
868 **************************************************************************/ | |
869 static gboolean | |
870 __url_cmd(MsnServConn *servconn, const char *command, const char **params, | |
871 size_t param_count) | |
872 { | |
873 MsnSession *session = servconn->session; | |
874 struct gaim_connection *gc = session->account->gc; | |
875 const char *rru; | |
876 const char *url; | |
877 md5_state_t st; | |
878 md5_byte_t di[16]; | |
879 FILE *fd; | |
880 char buf[2048]; | |
881 char buf2[3]; | |
882 char sendbuf[64]; | |
883 int i; | |
884 | |
885 rru = params[1]; | |
886 url = params[2]; | |
887 | |
888 g_snprintf(buf, sizeof(buf), "%s%lu%s", | |
889 session->passport_info.mspauth, | |
890 time(NULL) - session->passport_info.sl, gc->password); | |
891 | |
892 md5_init(&st); | |
893 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
894 md5_finish(&st, di); | |
895 | |
896 memset(sendbuf, 0, sizeof(sendbuf)); | |
897 | |
898 for (i = 0; i < 16; i++) { | |
899 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); | |
900 strcat(sendbuf, buf2); | |
901 } | |
902 | |
903 if (session->passport_info.file != NULL) { | |
904 unlink(session->passport_info.file); | |
905 g_free(session->passport_info.file); | |
906 } | |
907 | |
908 if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL) { | |
909 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
910 "Error opening temp passport file: %s\n", | |
911 strerror(errno)); | |
912 } | |
913 else { | |
914 fputs("<html>\n" | |
915 "<head>\n" | |
916 "<noscript>\n" | |
917 "<meta http-equiv=\"Refresh\" content=\"0; " | |
918 "url=http://www.hotmail.com\">\n" | |
919 "</noscript>\n" | |
920 "</head>\n\n", | |
921 fd); | |
922 | |
923 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); | |
924 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", | |
925 url); | |
926 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); | |
927 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", | |
928 gc->username); | |
929 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", | |
930 gc->username); | |
931 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", | |
932 session->passport_info.sid); | |
933 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", | |
934 session->passport_info.kv); | |
935 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); | |
936 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", | |
937 time(NULL) - session->passport_info.sl); | |
938 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", | |
939 rru); | |
940 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", | |
941 session->passport_info.mspauth); | |
942 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", | |
943 sendbuf); /* TODO Digest me (huh? -- ChipX86) */ | |
944 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); | |
945 fprintf(fd, "<input type=\"hiden\" name=\"js\" value=\"yes\">\n"); | |
946 fprintf(fd, "</form></body>\n"); | |
947 fprintf(fd, "</html>\n"); | |
948 | |
949 if (fclose(fd)) { | |
950 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
951 "Error closing temp passport file: %s\n", | |
952 strerror(errno)); | |
953 | |
954 unlink(session->passport_info.file); | |
955 g_free(session->passport_info.file); | |
956 } | |
957 else { | |
958 /* | |
959 * Renaming file with .html extension, so that the | |
960 * win32 open_url will work. | |
961 */ | |
962 char *tmp; | |
963 | |
964 if ((tmp = g_strdup_printf("%s.html", | |
965 session->passport_info.file)) != NULL) { | |
966 | |
967 if (rename(session->passport_info.file, tmp) == 0) { | |
968 g_free(session->passport_info.file); | |
969 session->passport_info.file = tmp; | |
970 } | |
971 else | |
972 g_free(tmp); | |
973 } | |
974 } | |
975 } | |
976 | |
977 return TRUE; | |
978 } | |
979 /************************************************************************** | |
980 * Switchboards | |
981 **************************************************************************/ | |
982 static gboolean | |
983 __rng_cmd(MsnServConn *servconn, const char *command, const char **params, | |
984 size_t param_count) | |
985 { | |
986 MsnSession *session = servconn->session; | |
987 MsnSwitchBoard *swboard; | |
988 MsnUser *user; | |
989 const char *session_id; | |
990 char *host, *c; | |
991 int port; | |
992 | |
993 session_id = params[0]; | |
994 | |
995 host = g_strdup(params[1]); | |
996 | |
997 if ((c = strchr(host, ':')) != NULL) { | |
998 *c = '\0'; | |
999 port = atoi(c + 1); | |
1000 } | |
1001 else | |
1002 port = 1863; | |
1003 | |
1004 swboard = msn_switchboard_new(session); | |
1005 | |
1006 user = msn_user_new(session, params[4], NULL); | |
1007 | |
1008 msn_switchboard_set_invited(swboard, TRUE); | |
1009 msn_switchboard_set_session_id(swboard, params[0]); | |
1010 msn_switchboard_set_auth_key(swboard, params[3]); | |
1011 msn_switchboard_set_user(swboard, user); | |
1012 | |
1013 if (!msn_switchboard_connect(swboard, host, port)) { | |
1014 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
1015 "Unable to connect to switchboard on %s, port %d\n", | |
1016 host, port); | |
1017 | |
1018 g_free(host); | |
1019 | |
1020 return FALSE; | |
1021 } | |
1022 | |
1023 g_free(host); | |
1024 | |
1025 return TRUE; | |
1026 } | |
1027 | |
1028 static gboolean | |
1029 __xfr_cmd(MsnServConn *servconn, const char *command, const char **params, | |
1030 size_t param_count) | |
1031 { | |
1032 MsnSession *session = servconn->session; | |
1033 MsnSwitchBoard *swboard; | |
1034 struct gaim_connection *gc = session->account->gc; | |
1035 char *host; | |
1036 char *c; | |
1037 int port; | |
1038 | |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1039 if (strcmp(params[1], "SB") && strcmp(params[1], "NS")) { |
5309 | 1040 hide_login_progress(gc, _("Got invalid XFR")); |
1041 signoff(gc); | |
1042 | |
1043 return FALSE; | |
1044 } | |
1045 | |
1046 host = g_strdup(params[2]); | |
1047 | |
1048 if ((c = strchr(host, ':')) != NULL) { | |
1049 *c = '\0'; | |
1050 port = atoi(c + 1); | |
1051 } | |
1052 else | |
1053 port = 1863; | |
1054 | |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1055 if (!strcmp(params[1], "SB")) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1056 swboard = msn_session_find_unused_switch(session); |
5309 | 1057 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1058 if (swboard == NULL) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1059 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1060 "Received an XFR SB request when there's no unused " |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1061 "switchboards!\n"); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1062 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1063 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1064 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1065 msn_switchboard_set_auth_key(swboard, params[4]); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1066 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1067 if (!msn_switchboard_connect(swboard, host, port)) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1068 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1069 "Unable to connect to switchboard on %s, port %d\n", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1070 host, port); |
5309 | 1071 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1072 g_free(host); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1073 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1074 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1075 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1076 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1077 else if (!strcmp(params[1], "NS")) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1078 msn_servconn_destroy(session->notification_conn); |
5309 | 1079 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1080 session->notification_conn = msn_notification_new(session, host, port); |
5309 | 1081 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1082 if (!msn_servconn_connect(session->notification_conn)) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1083 hide_login_progress(gc, _("Unable to transfer to " |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1084 "notification server")); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1085 signoff(gc); |
5309 | 1086 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1087 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1088 } |
5309 | 1089 } |
1090 | |
1091 g_free(host); | |
1092 | |
1093 return TRUE; | |
1094 } | |
1095 | |
1096 /************************************************************************** | |
1097 * Message Types | |
1098 **************************************************************************/ | |
1099 static gboolean | |
1100 __profile_msg(MsnServConn *servconn, const MsnMessage *msg) | |
1101 { | |
1102 MsnSession *session = servconn->session; | |
1103 const char *value; | |
1104 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1105 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1106 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1107 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1108 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1109 |
5309 | 1110 if ((value = msn_message_get_attr(msg, "kv")) != NULL) |
1111 session->passport_info.kv = g_strdup(value); | |
1112 | |
1113 if ((value = msn_message_get_attr(msg, "sid")) != NULL) | |
1114 session->passport_info.sid = g_strdup(value); | |
1115 | |
1116 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) | |
1117 session->passport_info.mspauth = g_strdup(value); | |
1118 | |
1119 return TRUE; | |
1120 } | |
1121 | |
1122 static gboolean | |
1123 __initial_email_msg(MsnServConn *servconn, const MsnMessage *msg) | |
1124 { | |
1125 MsnSession *session = servconn->session; | |
1126 struct gaim_connection *gc = session->account->gc; | |
1127 GHashTable *table; | |
1128 const char *unread; | |
1129 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1130 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1131 /* This isn't an official message. */ |
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 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1135 if (session->passport_info.file == NULL) { |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1136 msn_servconn_send_command(servconn, "URL", "INBOX"); |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1137 return TRUE; |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1138 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1139 |
5309 | 1140 table = msn_message_get_hashtable_from_body(msg); |
1141 | |
1142 unread = g_hash_table_lookup(table, "Inbox-Unread"); | |
1143 | |
1144 if (unread != NULL) | |
1145 connection_has_mail(gc, atoi(unread), NULL, NULL, | |
1146 session->passport_info.file); | |
1147 | |
1148 g_hash_table_destroy(table); | |
1149 | |
1150 return TRUE; | |
1151 } | |
1152 | |
1153 static gboolean | |
1154 __email_msg(MsnServConn *servconn, const MsnMessage *msg) | |
1155 { | |
1156 MsnSession *session = servconn->session; | |
1157 struct gaim_connection *gc = session->account->gc; | |
1158 GHashTable *table; | |
1159 const char *from, *subject; | |
1160 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1161 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1162 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1163 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1164 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1165 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1166 if (session->passport_info.file == NULL) { |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1167 msn_servconn_send_command(servconn, "URL", "INBOX"); |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1168 return TRUE; |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1169 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1170 |
5309 | 1171 table = msn_message_get_hashtable_from_body(msg); |
1172 | |
1173 from = g_hash_table_lookup(table, "From"); | |
1174 subject = g_hash_table_lookup(table, "Subject"); | |
1175 | |
1176 if (from == NULL || subject == NULL) { | |
1177 connection_has_mail(gc, 1, NULL, NULL, session->passport_info.file); | |
1178 } | |
1179 else { | |
1180 connection_has_mail(gc, -1, from, subject, | |
1181 session->passport_info.file); | |
1182 } | |
1183 | |
1184 g_hash_table_destroy(table); | |
1185 | |
1186 return TRUE; | |
1187 } | |
1188 | |
1189 static gboolean | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1190 __system_msg(MsnServConn *servconn, const MsnMessage *msg) |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1191 { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1192 GHashTable *table; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1193 const char *type_s; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1194 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1195 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1196 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1197 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1198 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1199 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1200 table = msn_message_get_hashtable_from_body(msg); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1201 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1202 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1203 int type = atoi(type_s); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1204 char buf[MSN_BUF_LEN]; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1205 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1206 switch (type) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1207 case 1: |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1208 g_snprintf(buf, sizeof(buf), |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1209 _("The MSN server will shut down for maintenance " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1210 "in %d minute(s). You will automatically be " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1211 "signed out at that time. Please finish any " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1212 "conversations in progress.\n\n" |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1213 "After the maintenance has been completed, you " |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1214 "will be able to successfully sign in."), |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1215 atoi(g_hash_table_lookup(table, "Arg1"))); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1216 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1217 default: |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1218 break; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1219 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1220 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1221 if (*buf != '\0') { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1222 do_error_dialog(buf, NULL, GAIM_INFO); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1223 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1224 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1225 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1226 g_hash_table_destroy(table); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1227 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1228 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1229 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1230 static gboolean |
5309 | 1231 __connect_cb(gpointer data, gint source, GaimInputCondition cond) |
1232 { | |
1233 MsnServConn *notification = data; | |
1234 MsnSession *session = notification->session; | |
1235 struct gaim_connection *gc = session->account->gc; | |
1236 | |
1237 if (source == -1) { | |
1238 hide_login_progress(session->account->gc, _("Unable to connect")); | |
1239 signoff(session->account->gc); | |
1240 return FALSE; | |
1241 } | |
1242 | |
1243 if (notification->fd != source) | |
1244 notification->fd = source; | |
1245 | |
1246 if (!msn_servconn_send_command(notification, "VER", | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1247 "MSNP7 MSNP6 MSNP5 MSNP4 CVR0")) { |
5309 | 1248 hide_login_progress(gc, _("Unable to write to server")); |
1249 signoff(gc); | |
1250 return FALSE; | |
1251 } | |
1252 | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1253 session->user = msn_user_new(session, gc->username, NULL); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1254 |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
1255 set_login_progress(session->account->gc, 4, _("Syncing with server")); |
5309 | 1256 |
1257 return TRUE; | |
1258 } | |
1259 | |
1260 static void | |
1261 __failed_read_cb(gpointer data, gint source, GaimInputCondition cond) | |
1262 { | |
1263 MsnServConn *notification = data; | |
1264 struct gaim_connection *gc; | |
1265 | |
1266 gc = notification->session->account->gc; | |
1267 | |
1268 hide_login_progress(gc, _("Error reading from server")); | |
1269 signoff(gc); | |
1270 } | |
1271 | |
1272 MsnServConn * | |
1273 msn_notification_new(MsnSession *session, const char *server, int port) | |
1274 { | |
1275 MsnServConn *notification; | |
1276 | |
1277 notification = msn_servconn_new(session); | |
1278 | |
1279 msn_servconn_set_server(notification, server, port); | |
1280 msn_servconn_set_connect_cb(notification, __connect_cb); | |
1281 msn_servconn_set_failed_read_cb(notification, __failed_read_cb); | |
1282 | |
1283 if (notification_commands == NULL) { | |
1284 /* Register the command callbacks. */ | |
1285 msn_servconn_register_command(notification, "ADD", __add_cmd); | |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1286 msn_servconn_register_command(notification, "ADG", __adg_cmd); |
5309 | 1287 msn_servconn_register_command(notification, "BLP", __blp_cmd); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1288 msn_servconn_register_command(notification, "BPR", __bpr_cmd); |
5309 | 1289 msn_servconn_register_command(notification, "CHG", __blank_cmd); |
1290 msn_servconn_register_command(notification, "CHL", __chl_cmd); | |
1291 msn_servconn_register_command(notification, "FLN", __fln_cmd); | |
1292 msn_servconn_register_command(notification, "GTC", __blank_cmd); | |
1293 msn_servconn_register_command(notification, "ILN", __iln_cmd); | |
1294 msn_servconn_register_command(notification, "INF", __inf_cmd); | |
1295 msn_servconn_register_command(notification, "LSG", __lsg_cmd); | |
1296 msn_servconn_register_command(notification, "LST", __lst_cmd); | |
1297 msn_servconn_register_command(notification, "MSG", __msg_cmd); | |
1298 msn_servconn_register_command(notification, "NLN", __nln_cmd); | |
1299 msn_servconn_register_command(notification, "OUT", __out_cmd); | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1300 msn_servconn_register_command(notification, "PRP", __prp_cmd); |
5309 | 1301 msn_servconn_register_command(notification, "QNG", __blank_cmd); |
1302 msn_servconn_register_command(notification, "QRY", __blank_cmd); | |
1303 msn_servconn_register_command(notification, "REA", __rea_cmd); | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1304 msn_servconn_register_command(notification, "REG", __reg_cmd); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1305 msn_servconn_register_command(notification, "REM", __rem_cmd); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1306 msn_servconn_register_command(notification, "RMG", __blank_cmd); |
5309 | 1307 msn_servconn_register_command(notification, "RNG", __rng_cmd); |
1308 msn_servconn_register_command(notification, "SYN", __blank_cmd); | |
1309 msn_servconn_register_command(notification, "URL", __url_cmd); | |
1310 msn_servconn_register_command(notification, "USR", __usr_cmd); | |
1311 msn_servconn_register_command(notification, "VER", __ver_cmd); | |
1312 msn_servconn_register_command(notification, "XFR", __xfr_cmd); | |
1313 msn_servconn_register_command(notification, "_unknown_", __unknown_cmd); | |
1314 | |
1315 /* Register the message type callbacks. */ | |
1316 msn_servconn_register_msg_type(notification, "text/x-msmsgsprofile", | |
1317 __profile_msg); | |
1318 msn_servconn_register_msg_type(notification, | |
1319 "text/x-msmsgsinitialemailnotification", | |
1320 __initial_email_msg); | |
1321 msn_servconn_register_msg_type(notification, | |
1322 "text/x-msmsgsemailnotification", | |
1323 __email_msg); | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1324 msn_servconn_register_msg_type(notification, |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1325 "application/x-msmsgssystemmessage", |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1326 __system_msg); |
5309 | 1327 |
1328 /* Save these for future use. */ | |
1329 notification_commands = notification->commands; | |
1330 notification_msg_types = notification->msg_types; | |
1331 } | |
1332 else { | |
1333 g_hash_table_destroy(notification->commands); | |
1334 g_hash_table_destroy(notification->msg_types); | |
1335 | |
1336 notification->commands = notification_commands; | |
1337 notification->msg_types = notification_msg_types; | |
1338 } | |
1339 | |
1340 return notification; | |
1341 } |