Mercurial > pidgin.yaz
annotate src/protocols/msn/notification.c @ 6371:8f94cce8faa5
[gaim-migrate @ 6876]
I think I touched almost every file. Here's what happened.
I started off fixing up the Makefile.am and configure.ac files to help with
the core/UI split some. Then I got annoyed with the
build_{allow,deny}_list() functions that everything used, and decided to
core/UI split privacy. While doing that, I decided to redesign the dialog.
So now, a lot has changed, but not really so much. Just that most files
got affected.
Oh yeah, and the UI stuff was taken out of internal.h and moved to
gtkinternal.h. If you use this, please be aware of this change.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 05 Aug 2003 10:55:04 +0000 |
parents | 3613007cbb6e |
children | 0f0b34c72e69 |
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 { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
30 GaimConnection *gc; |
5309 | 31 MsnUser *user; |
32 | |
33 } MsnPermitAdd; | |
34 | |
35 static GHashTable *notification_commands = NULL; | |
36 static GHashTable *notification_msg_types = NULL; | |
37 | |
38 /************************************************************************** | |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
39 * Utility functions |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
40 **************************************************************************/ |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
41 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
42 add_buddy(MsnServConn *servconn, MsnUser *user) |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
43 { |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
44 MsnSession *session = servconn->session; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
45 GaimConnection *gc = session->account->gc; |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
46 struct buddy *b; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
47 MsnGroup *group = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
48 struct group *g = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
49 int group_id; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
50 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
51 group_id = msn_user_get_group_id(user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
52 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
53 if (group_id > -1) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
54 group = msn_groups_find_with_id(session->groups, group_id); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
55 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
56 if (group == NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
57 GList *l; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
58 gaim_debug(GAIM_DEBUG_WARNING, "msn", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
59 "Group ID %d for user %s was not defined.\n", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
60 group_id, msn_user_get_passport(user)); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
61 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
62 /* Find a group that we can stick this guy into. Lamer. */ |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
63 l = msn_groups_get_list(session->groups); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
64 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
65 if (l != NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
66 group = l->data; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
67 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
68 msn_user_set_group_id(user, msn_group_get_id(group)); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
69 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
70 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
71 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
72 if (group == NULL || |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
73 (g = gaim_find_group(msn_group_get_name(group))) == NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
74 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
75 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
76 "Group '%s' appears in server-side " |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
77 "buddy list, but not here!", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
78 msn_group_get_name(group)); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
79 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
80 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
81 if (group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
82 msn_group_add_user(group, user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
83 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
84 if (g == NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
85 /* Should never happen. */ |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
86 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
87 if ((g = gaim_find_group(_("Buddies"))) == NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
88 g = gaim_group_new(_("Buddies")); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
89 gaim_blist_add_group(g, NULL); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
90 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
91 } |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
92 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
93 b = gaim_find_buddy(gc->account, msn_user_get_passport(user)); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
94 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
95 if (b == NULL) { |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
96 b = gaim_buddy_new(gc->account, |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
97 msn_user_get_passport(user), NULL); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
98 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
99 gaim_blist_add_buddy(b, g, NULL); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
100 } |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
101 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
102 b->proto_data = user; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
103 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
104 serv_got_alias(gc, (char *)msn_user_get_passport(user), |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
105 (char *)msn_user_get_name(user)); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
106 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
107 return TRUE; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
108 } |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
109 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
110 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
111 /************************************************************************** |
5309 | 112 * Callbacks |
113 **************************************************************************/ | |
114 static void | |
115 msn_accept_add_cb(MsnPermitAdd *pa) | |
116 { | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5566
diff
changeset
|
117 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL) { |
5309 | 118 MsnSession *session = pa->gc->proto_data; |
119 char outparams[MSN_BUF_LEN]; | |
120 | |
121 g_snprintf(outparams, sizeof(outparams), "AL %s %s", | |
122 msn_user_get_passport(pa->user), | |
123 msn_url_encode(msn_user_get_name(pa->user))); | |
124 | |
125 if (msn_servconn_send_command(session->notification_conn, | |
126 "ADD", outparams) <= 0) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
127 gaim_connection_error(pa->gc, _("Write error")); |
5309 | 128 return; |
129 } | |
130 | |
131 gaim_privacy_permit_add(pa->gc->account, | |
132 msn_user_get_passport(pa->user)); | |
133 show_got_added(pa->gc, NULL, msn_user_get_passport(pa->user), | |
134 msn_user_get_name(pa->user), NULL); | |
135 } | |
136 | |
137 msn_user_destroy(pa->user); | |
138 g_free(pa); | |
139 } | |
140 | |
141 static void | |
142 msn_cancel_add_cb(MsnPermitAdd *pa) | |
143 { | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5566
diff
changeset
|
144 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL) { |
5309 | 145 MsnSession *session = pa->gc->proto_data; |
146 char outparams[MSN_BUF_LEN]; | |
147 | |
148 g_snprintf(outparams, sizeof(outparams), "BL %s %s", | |
149 msn_user_get_passport(pa->user), | |
150 msn_url_encode(msn_user_get_name(pa->user))); | |
151 | |
152 if (msn_servconn_send_command(session->notification_conn, | |
153 "ADD", outparams) <= 0) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
154 gaim_connection_error(pa->gc, _("Write error")); |
5309 | 155 return; |
156 } | |
157 | |
158 gaim_privacy_deny_add(pa->gc->account, | |
159 msn_user_get_passport(pa->user)); | |
160 } | |
161 | |
162 msn_user_destroy(pa->user); | |
163 g_free(pa); | |
164 } | |
165 | |
166 /************************************************************************** | |
167 * Catch-all commands | |
168 **************************************************************************/ | |
169 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
170 blank_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
171 size_t param_count) |
5309 | 172 { |
173 return TRUE; | |
174 } | |
175 | |
176 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
177 unknown_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
178 size_t param_count) |
5309 | 179 { |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
180 char buf[MSN_BUF_LEN]; |
5309 | 181 |
5334
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
182 if (isdigit(*command)) { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
183 int errnum = atoi(command); |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
184 |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
185 if (errnum == 225) { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
186 /* |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
187 * 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
|
188 * 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
|
189 * 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
|
190 */ |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
191 return TRUE; |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
192 } |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
193 |
6321 | 194 g_snprintf(buf, sizeof(buf), _("MSN Error: %s\n"), |
5334
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
195 msn_error_get_text(errnum)); |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
196 } |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
197 else { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
198 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
|
199 } |
5309 | 200 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
201 gaim_notify_error(servconn->session->account->gc, NULL, buf, NULL); |
5309 | 202 |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
203 return TRUE; |
5309 | 204 } |
205 | |
206 | |
207 /************************************************************************** | |
208 * Login | |
209 **************************************************************************/ | |
210 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
211 ver_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
212 size_t param_count) |
5309 | 213 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
214 GaimConnection *gc = servconn->session->account->gc; |
5309 | 215 size_t i; |
216 gboolean msnp5_found = FALSE; | |
217 | |
218 for (i = 1; i < param_count; i++) { | |
219 if (!strcmp(params[i], "MSNP5")) { | |
220 msnp5_found = TRUE; | |
221 break; | |
222 } | |
223 } | |
224 | |
225 if (!msnp5_found) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
226 gaim_connection_error(gc, _("Protocol not supported")); |
5309 | 227 |
228 return FALSE; | |
229 } | |
230 | |
231 if (!msn_servconn_send_command(servconn, "INF", NULL)) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
232 gaim_connection_error(gc, _("Unable to request INF")); |
5309 | 233 |
234 return FALSE; | |
235 } | |
236 | |
237 return TRUE; | |
238 } | |
239 | |
240 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
241 inf_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
242 size_t param_count) |
5309 | 243 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
244 GaimAccount *account = servconn->session->account; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
245 GaimConnection *gc = gaim_account_get_connection(account); |
5309 | 246 char outparams[MSN_BUF_LEN]; |
247 | |
248 if (strcmp(params[1], "MD5")) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
249 gaim_connection_error(gc, _("Unable to login using MD5")); |
5309 | 250 |
251 return FALSE; | |
252 } | |
253 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
254 g_snprintf(outparams, sizeof(outparams), "MD5 I %s", |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
255 gaim_account_get_username(account)); |
5309 | 256 |
257 if (!msn_servconn_send_command(servconn, "USR", outparams)) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
258 gaim_connection_error(gc, _("Unable to send USR")); |
5309 | 259 |
260 return FALSE; | |
261 } | |
262 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
263 gaim_connection_update_progress(gc, _("Requesting to send password"), |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
264 5, MSN_CONNECT_STEPS); |
5309 | 265 |
266 return TRUE; | |
267 } | |
268 | |
269 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
270 usr_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
271 size_t param_count) |
5309 | 272 { |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
273 MsnSession *session = servconn->session; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
274 GaimAccount *account = session->account; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
275 GaimConnection *gc = gaim_account_get_connection(account); |
5309 | 276 char outparams[MSN_BUF_LEN]; |
277 | |
278 /* We're either getting the challenge or the OK. Let's find out. */ | |
279 if (!g_ascii_strcasecmp(params[1], "OK")) { | |
5652
4fa26acb4cd3
[gaim-migrate @ 6066]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
280 const char *friendly = msn_url_decode(params[3]); |
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
281 |
5309 | 282 /* OK */ |
283 | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
284 gaim_connection_set_display_name(gc, friendly); |
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
285 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
286 session->syncing_lists = TRUE; |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
287 |
5309 | 288 if (!msn_servconn_send_command(servconn, "SYN", "0")) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
289 gaim_connection_error(gc, _("Unable to write")); |
5309 | 290 |
291 return FALSE; | |
292 } | |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
293 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
294 gaim_connection_update_progress(gc, _("Retrieving buddy list"), |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
295 7, MSN_CONNECT_STEPS); |
5309 | 296 } |
297 else { | |
298 /* Challenge */ | |
299 const char *challenge = params[3]; | |
300 char buf[MSN_BUF_LEN]; | |
301 md5_state_t st; | |
302 md5_byte_t di[16]; | |
303 int i; | |
304 | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
305 g_snprintf(buf, sizeof(buf), "%s%s", challenge, |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
306 gaim_account_get_password(account)); |
5309 | 307 |
308 md5_init(&st); | |
309 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
310 md5_finish(&st, di); | |
311 | |
312 g_snprintf(outparams, sizeof(outparams), "MD5 S "); | |
313 | |
314 for (i = 0; i < 16; i++) { | |
315 g_snprintf(buf, sizeof(buf), "%02x", di[i]); | |
316 strcat(outparams, buf); | |
317 } | |
318 | |
319 if (!msn_servconn_send_command(servconn, "USR", outparams)) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
320 gaim_connection_error(gc, _("Unable to send password")); |
5309 | 321 |
322 return FALSE; | |
323 } | |
324 | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
325 gaim_connection_update_progress(gc, _("Password sent"), |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
326 6, MSN_CONNECT_STEPS); |
5309 | 327 } |
328 | |
329 return TRUE; | |
330 } | |
331 | |
332 /************************************************************************** | |
333 * Log out | |
334 **************************************************************************/ | |
335 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
336 out_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
337 size_t param_count) |
5309 | 338 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
339 GaimConnection *gc = servconn->session->account->gc; |
5309 | 340 |
341 if (!g_ascii_strcasecmp(params[0], "OTH")) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
342 gaim_connection_error(gc, |
5309 | 343 _("You have been disconnected. You have " |
344 "signed on from another location.")); | |
345 } | |
346 else if (!g_ascii_strcasecmp(params[0], "SSD")) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
347 gaim_connection_error(gc, |
5309 | 348 _("You have been disconnected. The MSN servers " |
349 "are going down temporarily.")); | |
350 } | |
351 | |
352 return FALSE; | |
353 } | |
354 | |
355 /************************************************************************** | |
356 * Messages | |
357 **************************************************************************/ | |
358 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
359 msg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
360 size_t param_count) |
5309 | 361 { |
362 gaim_debug(GAIM_DEBUG_INFO, "msn", "Found message. Parsing.\n"); | |
363 | |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
364 servconn->parsing_multiline = TRUE; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
365 servconn->multiline_type = MSN_MULTILINE_MSG; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
366 servconn->multiline_len = atoi(params[2]); |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
367 |
5309 | 368 servconn->msg_passport = g_strdup(params[0]); |
369 servconn->msg_friendly = g_strdup(params[1]); | |
370 | |
371 return TRUE; | |
372 } | |
373 | |
374 /************************************************************************** | |
375 * Challenges | |
376 **************************************************************************/ | |
377 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
378 chl_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
379 size_t param_count) |
5309 | 380 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
381 GaimConnection *gc = servconn->session->account->gc; |
5309 | 382 char buf[MSN_BUF_LEN]; |
383 char buf2[3]; | |
384 md5_state_t st; | |
385 md5_byte_t di[16]; | |
386 int i; | |
387 | |
388 md5_init(&st); | |
389 md5_append(&st, (const md5_byte_t *)params[1], strlen(params[1])); | |
390 md5_append(&st, (const md5_byte_t *)"Q1P7W2E4J9R8U3S5", | |
391 strlen("Q1P7W2E4J9R8U3S5")); | |
392 md5_finish(&st, di); | |
393 | |
394 g_snprintf(buf, sizeof(buf), | |
395 "QRY %u msmsgs@msnmsgr.com 32\r\n", | |
396 servconn->session->trId++); | |
397 | |
398 for (i = 0; i < 16; i++) { | |
399 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); | |
400 strcat(buf, buf2); | |
401 } | |
402 | |
403 if (msn_servconn_write(servconn, buf, strlen(buf)) <= 0) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
404 gaim_connection_error(gc, _("Unable to write to server")); |
5309 | 405 } |
406 | |
407 return TRUE; | |
408 } | |
409 | |
410 /************************************************************************** | |
411 * Buddy Lists | |
412 **************************************************************************/ | |
413 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
414 add_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
415 size_t param_count) |
5309 | 416 { |
417 MsnSession *session = servconn->session; | |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
418 MsnUser *user; |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
419 GaimAccount *account = session->account; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
420 GaimConnection *gc = gaim_account_get_connection(account); |
5309 | 421 MsnPermitAdd *pa; |
422 GSList *sl; | |
5890
1a2fcda8a5e7
[gaim-migrate @ 6322]
Christian Hammond <chipx86@chipx86.com>
parents:
5887
diff
changeset
|
423 const char *list, *passport, *group_id = NULL; |
5309 | 424 char *friend; |
425 char msg[MSN_BUF_LEN]; | |
426 | |
5918
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
427 list = params[1]; |
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
428 passport = params[3]; |
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
429 friend = msn_url_decode(params[4]); |
5309 | 430 |
5918
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
431 if (param_count >= 6) |
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
432 group_id = params[5]; |
5309 | 433 |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
434 if (!g_ascii_strcasecmp(list, "FL")) { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
435 user = msn_user_new(session, passport, NULL); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
436 |
5933
44eb6d75a5c6
[gaim-migrate @ 6373]
Christian Hammond <chipx86@chipx86.com>
parents:
5918
diff
changeset
|
437 if (group_id != NULL) |
44eb6d75a5c6
[gaim-migrate @ 6373]
Christian Hammond <chipx86@chipx86.com>
parents:
5918
diff
changeset
|
438 msn_user_set_group_id(user, atoi(group_id)); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
439 |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
440 add_buddy(servconn, user); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
441 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
442 return TRUE; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
443 } |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
444 else if (g_ascii_strcasecmp(list, "RL")) |
5309 | 445 return TRUE; |
446 | |
447 for (sl = gc->account->permit; sl != NULL; sl = sl->next) { | |
448 if (!gaim_utf8_strcasecmp(sl->data, passport)) | |
449 return TRUE; | |
450 } | |
451 | |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
452 user = msn_user_new(session, passport, friend); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
453 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
454 pa = g_new0(MsnPermitAdd, 1); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
455 pa->user = user; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
456 pa->gc = gc; |
5309 | 457 |
458 g_snprintf(msg, sizeof(msg), | |
459 _("The user %s (%s) wants to add %s to his or her buddy list."), | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
460 passport, friend, gaim_account_get_username(account)); |
5309 | 461 |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
462 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
463 _("Authorize"), G_CALLBACK(msn_accept_add_cb), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
464 _("Deny"), G_CALLBACK(msn_cancel_add_cb)); |
5309 | 465 |
466 return TRUE; | |
467 } | |
468 | |
469 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
470 adg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
471 size_t param_count) |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
472 { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
473 MsnGroup *group; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
474 MsnSession *session = servconn->session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
475 gint group_id; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
476 char *group_name; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
477 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
478 group_id = atoi(params[3]); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
479 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
480 group_name = msn_url_decode(params[2]); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
481 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
482 group = msn_group_new(session, group_id, group_name); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
483 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
484 msn_groups_add(session->groups, group); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
485 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
486 return TRUE; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
487 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
488 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
489 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
490 blp_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
491 size_t param_count) |
5309 | 492 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
493 GaimConnection *gc = servconn->session->account->gc; |
5309 | 494 |
495 if (!g_ascii_strcasecmp(params[2], "AL")) { | |
496 /* | |
497 * If the current setting is AL, messages from users who | |
498 * are not in BL will be delivered. | |
499 * | |
500 * In other words, deny some. | |
501 */ | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
502 gc->account->perm_deny = DENY_SOME; |
5309 | 503 } |
504 else { | |
505 /* If the current setting is BL, only messages from people | |
506 * who are in the AL will be delivered. | |
507 * | |
508 * In other words, permit some. | |
509 */ | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
510 gc->account->perm_deny = PERMIT_SOME; |
5309 | 511 } |
512 | |
513 return TRUE; | |
514 } | |
515 | |
516 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
517 bpr_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
518 size_t param_count) |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
519 { |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
520 MsnSession *session = servconn->session; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
521 GaimConnection *gc = session->account->gc; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
522 const char *passport, *type, *value; |
5375
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
523 struct buddy *b; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
524 MsnUser *user; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
525 |
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
526 if (param_count < 4) |
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
527 return TRUE; |
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
528 |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
529 passport = params[1]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
530 type = params[2]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
531 value = params[3]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
532 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
533 user = msn_users_find_with_passport(session->users, passport); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
534 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
535 if (value != NULL) { |
5375
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
536 if (!strcmp(type, "MOB")) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
537 if (!strcmp(value, "Y")) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
538 user->mobile = TRUE; |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
539 |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
540 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
541 if (GAIM_BUDDY_IS_ONLINE(b)) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
542 serv_got_update(gc, (char *)passport, |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
543 1, 0, 0, 0, b->uc); |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
544 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
545 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
546 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
547 } |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
548 else if (!strcmp(type, "PHH")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
549 msn_user_set_home_phone(user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
550 else if (!strcmp(type, "PHW")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
551 msn_user_set_work_phone(user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
552 else if (!strcmp(type, "PHM")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
553 msn_user_set_mobile_phone(user, msn_url_decode(value)); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
554 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
555 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
556 return TRUE; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
557 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
558 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
559 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
560 fln_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
561 size_t param_count) |
5309 | 562 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
563 GaimConnection *gc = servconn->session->account->gc; |
5309 | 564 |
565 serv_got_update(gc, (char *)params[0], 0, 0, 0, 0, 0); | |
566 | |
567 return TRUE; | |
568 } | |
569 | |
570 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
571 iln_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
572 size_t param_count) |
5309 | 573 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
574 GaimConnection *gc = servconn->session->account->gc; |
5309 | 575 int status = 0; |
576 const char *state, *passport, *friend; | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
577 struct buddy *b; |
5309 | 578 |
579 state = params[1]; | |
580 passport = params[2]; | |
581 friend = msn_url_decode(params[3]); | |
582 | |
583 serv_got_alias(gc, (char *)passport, (char *)friend); | |
584 | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
585 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
586 status |= ((((b->uc) >> 1) & 0xF0) << 1); |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
587 |
5309 | 588 if (!g_ascii_strcasecmp(state, "BSY")) |
589 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
590 else if (!g_ascii_strcasecmp(state, "IDL")) | |
591 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
592 else if (!g_ascii_strcasecmp(state, "BRB")) | |
593 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
594 else if (!g_ascii_strcasecmp(state, "AWY")) | |
595 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
596 else if (!g_ascii_strcasecmp(state, "PHN")) | |
597 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
598 else if (!g_ascii_strcasecmp(state, "LUN")) | |
599 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
600 | |
601 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
602 | |
603 return TRUE; | |
604 } | |
605 | |
606 static gboolean | |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
607 ipg_cmd(MsnServConn *servconn, const char *command, const char **params, |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
608 size_t param_count) |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
609 { |
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
610 /* GaimConnection *gc = servconn->session->account->gc; */ |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
611 |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
612 servconn->parsing_multiline = TRUE; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
613 servconn->multiline_type = MSN_MULTILINE_IPG; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
614 servconn->multiline_len = atoi(params[0]); |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
615 |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
616 servconn->msg_passport = NULL; |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
617 servconn->msg_friendly = NULL; |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
618 |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
619 return TRUE; |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
620 } |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
621 |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
622 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
623 lsg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
624 size_t param_count) |
5309 | 625 { |
626 MsnSession *session = servconn->session; | |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
627 MsnGroup *group; |
5309 | 628 struct group *g; |
629 const char *name; | |
630 int group_num, num_groups, group_id; | |
631 | |
632 group_num = atoi(params[2]); | |
633 num_groups = atoi(params[3]); | |
634 group_id = atoi(params[4]); | |
635 name = msn_url_decode(params[5]); | |
636 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
637 if (num_groups == 0) |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
638 return TRUE; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
639 |
5323
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
640 if (!strcmp(name, "~")) |
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
641 name = _("Buddies"); |
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
642 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
643 group = msn_group_new(session, group_id, name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
644 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
645 msn_groups_add(session->groups, group); |
5309 | 646 |
647 if ((g = gaim_find_group(name)) == NULL) { | |
648 g = gaim_group_new(name); | |
649 gaim_blist_add_group(g, NULL); | |
650 } | |
651 | |
652 return TRUE; | |
653 } | |
654 | |
655 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
656 lst_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
657 size_t param_count) |
5309 | 658 { |
659 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
660 GaimConnection *gc = session->account->gc; |
5309 | 661 int user_num; |
662 int num_users; | |
663 const char *type; | |
5768 | 664 const char *passport = NULL; |
665 const char *friend = NULL; | |
5309 | 666 |
5509
f6ef1871cfcc
[gaim-migrate @ 5908]
Christian Hammond <chipx86@chipx86.com>
parents:
5508
diff
changeset
|
667 type = params[1]; |
5309 | 668 user_num = atoi(params[3]); |
669 num_users = atoi(params[4]); | |
670 | |
5509
f6ef1871cfcc
[gaim-migrate @ 5908]
Christian Hammond <chipx86@chipx86.com>
parents:
5508
diff
changeset
|
671 if (g_ascii_strcasecmp(type, "RL") && user_num == 0 && num_users == 0) |
5309 | 672 return TRUE; /* There are no users on this list. */ |
673 | |
5762
331295fb349e
[gaim-migrate @ 6187]
Christian Hammond <chipx86@chipx86.com>
parents:
5652
diff
changeset
|
674 if (num_users > 0) { |
331295fb349e
[gaim-migrate @ 6187]
Christian Hammond <chipx86@chipx86.com>
parents:
5652
diff
changeset
|
675 passport = params[5]; |
331295fb349e
[gaim-migrate @ 6187]
Christian Hammond <chipx86@chipx86.com>
parents:
5652
diff
changeset
|
676 friend = msn_url_decode(params[6]); |
331295fb349e
[gaim-migrate @ 6187]
Christian Hammond <chipx86@chipx86.com>
parents:
5652
diff
changeset
|
677 } |
5309 | 678 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
679 if (session->syncing_lists && session->lists_synced) |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
680 return TRUE; |
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
681 |
5309 | 682 if (!g_ascii_strcasecmp(type, "FL") && user_num != 0) { |
683 /* These are users on our contact list. */ | |
684 MsnUser *user; | |
685 | |
686 user = msn_user_new(session, passport, friend); | |
687 | |
688 if (param_count == 8) | |
689 msn_user_set_group_id(user, atoi(params[7])); | |
690 | |
691 session->lists.forward = g_slist_append(session->lists.forward, user); | |
692 } | |
693 else if (!g_ascii_strcasecmp(type, "AL") && user_num != 0) { | |
694 /* These are users who are allowed to see our status. */ | |
695 if (g_slist_find_custom(gc->account->deny, passport, | |
696 (GCompareFunc)strcmp)) { | |
697 | |
698 gaim_debug(GAIM_DEBUG_INFO, "msn", | |
699 "Moving user from deny list to permit: %s (%s)\n", | |
700 passport, friend); | |
701 | |
702 gaim_privacy_deny_remove(gc->account, passport); | |
703 } | |
704 | |
705 gaim_privacy_permit_add(gc->account, passport); | |
706 } | |
707 else if (!g_ascii_strcasecmp(type, "BL") && user_num != 0) { | |
708 /* These are users who are not allowed to see our status. */ | |
709 gaim_privacy_deny_add(gc->account, passport); | |
710 } | |
711 else if (!g_ascii_strcasecmp(type, "RL")) { | |
712 /* These are users who have us on their contact list. */ | |
713 if (user_num > 0) { | |
714 gboolean new_entry = TRUE; | |
715 | |
716 if (g_slist_find_custom(gc->account->permit, passport, | |
717 (GCompareFunc)g_ascii_strcasecmp)) { | |
718 new_entry = FALSE; | |
719 } | |
720 | |
721 if (g_slist_find_custom(gc->account->deny, passport, | |
722 (GCompareFunc)g_ascii_strcasecmp)) { | |
723 new_entry = FALSE; | |
724 } | |
725 | |
726 if (new_entry) { | |
727 MsnPermitAdd *pa; | |
728 char msg[MSN_BUF_LEN]; | |
729 | |
730 gaim_debug(GAIM_DEBUG_WARNING, "msn", | |
731 "Unresolved MSN RL entry: %s\n", passport); | |
732 | |
733 pa = g_new0(MsnPermitAdd, 1); | |
734 pa->user = msn_user_new(session, passport, friend); | |
735 pa->gc = gc; | |
736 | |
737 g_snprintf(msg, sizeof(msg), | |
738 _("The user %s (%s) wants to add you to their " | |
739 "buddy list."), | |
740 msn_user_get_passport(pa->user), | |
741 msn_user_get_name(pa->user)); | |
742 | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
743 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
744 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
745 G_CALLBACK(msn_accept_add_cb), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
746 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
747 G_CALLBACK(msn_cancel_add_cb)); |
5309 | 748 } |
749 } | |
750 | |
751 if (user_num != num_users) | |
752 return TRUE; /* This isn't the last one in the RL. */ | |
753 | |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
754 /* Now we're at the last one, so we can do final work. */ |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
755 if (!session->lists_synced) { |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
756 if (!msn_servconn_send_command(servconn, "CHG", "NLN")) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
757 gaim_connection_error(gc, _("Unable to write")); |
5309 | 758 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
759 return FALSE; |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
760 } |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
761 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
762 gaim_connection_set_state(gc, GAIM_CONNECTED); |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
763 serv_finish_login(gc); |
5309 | 764 } |
765 | |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
766 if (session->lists.allow == NULL) |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
767 session->lists.allow = g_slist_copy(gc->account->permit); |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
768 else |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
769 session->lists.allow = g_slist_concat(session->lists.allow, |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
770 gc->account->permit); |
5309 | 771 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
772 if (session->lists.block == NULL) |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
773 session->lists.block = g_slist_copy(gc->account->deny); |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
774 else |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
775 session->lists.block = g_slist_concat(session->lists.block, |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
776 gc->account->deny); |
5309 | 777 |
778 while (session->lists.forward != NULL) { | |
779 MsnUser *user = session->lists.forward->data; | |
780 | |
781 session->lists.forward = g_slist_remove(session->lists.forward, | |
782 user); | |
783 | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
784 add_buddy(servconn, user); |
5309 | 785 } |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
786 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
787 session->syncing_lists = FALSE; |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
788 session->lists_synced = TRUE; |
5309 | 789 } |
790 | |
791 return TRUE; | |
792 } | |
793 | |
794 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
795 nln_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
796 size_t param_count) |
5309 | 797 { |
798 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
799 GaimConnection *gc = session->account->gc; |
5309 | 800 const char *state; |
801 const char *passport; | |
802 const char *friend; | |
803 int status = 0; | |
804 | |
805 state = params[0]; | |
806 passport = params[1]; | |
807 friend = msn_url_decode(params[2]); | |
808 | |
809 serv_got_alias(gc, (char *)passport, (char *)friend); | |
810 | |
811 if (!g_ascii_strcasecmp(state, "BSY")) | |
812 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
813 else if (!g_ascii_strcasecmp(state, "IDL")) | |
814 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
815 else if (!g_ascii_strcasecmp(state, "BRB")) | |
816 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
817 else if (!g_ascii_strcasecmp(state, "AWY")) | |
818 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
819 else if (!g_ascii_strcasecmp(state, "PHN")) | |
820 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
821 else if (!g_ascii_strcasecmp(state, "LUN")) | |
822 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
823 | |
824 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
825 | |
826 return TRUE; | |
827 } | |
828 | |
829 static gboolean | |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
830 not_cmd(MsnServConn *servconn, const char *command, const char **params, |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
831 size_t param_count) |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
832 { |
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
833 /* GaimConnection *gc = servconn->session->account->gc; */ |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
834 |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
835 servconn->parsing_multiline = TRUE; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
836 servconn->multiline_type = MSN_MULTILINE_NOT; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
837 servconn->multiline_len = atoi(params[0]); |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
838 |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
839 servconn->msg_passport = NULL; |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
840 servconn->msg_friendly = NULL; |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
841 |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
842 return TRUE; |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
843 } |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
844 |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
845 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
846 prp_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
847 size_t param_count) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
848 { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
849 MsnSession *session = servconn->session; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
850 const char *type, *value; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
851 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
852 type = params[2]; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
853 value = params[3]; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
854 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
855 if (param_count == 4) { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
856 if (!strcmp(type, "PHH")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
857 msn_user_set_home_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
858 else if (!strcmp(type, "PHW")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
859 msn_user_set_work_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
860 else if (!strcmp(type, "PHM")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
861 msn_user_set_mobile_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
862 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
863 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
864 return TRUE; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
865 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
866 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
867 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
868 rea_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
869 size_t param_count) |
5309 | 870 { |
871 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
872 GaimConnection *gc = session->account->gc; |
5309 | 873 char *friend; |
874 | |
5479
175de59cd1c5
[gaim-migrate @ 5875]
Christian Hammond <chipx86@chipx86.com>
parents:
5457
diff
changeset
|
875 friend = msn_url_decode(params[3]); |
5309 | 876 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
877 gaim_connection_set_display_name(gc, friend); |
5309 | 878 |
879 return TRUE; | |
880 } | |
881 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
882 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
883 reg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
884 size_t param_count) |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
885 { |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
886 MsnSession *session = servconn->session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
887 MsnGroup *group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
888 int group_id; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
889 char *group_name; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
890 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
891 group_id = atoi(params[2]); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
892 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
893 group_name = msn_url_decode(params[3]); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
894 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
895 group = msn_groups_find_with_id(session->groups, group_id); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
896 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
897 gaim_debug(GAIM_DEBUG_INFO, "msn", "Renamed group %s to %s\n", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
898 msn_group_get_name(group), group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
899 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
900 if (group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
901 msn_group_set_name(group, group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
902 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
903 return TRUE; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
904 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
905 |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
906 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
907 rem_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
908 size_t param_count) |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
909 { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
910 MsnSession *session = servconn->session; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
911 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
912 /* I hate this. */ |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
913 if (session->moving_buddy) { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
914 MsnGroup *group, *old_group; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
915 GaimConnection *gc = session->account->gc; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
916 const char *passport = params[3]; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
917 char outparams[MSN_BUF_LEN]; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
918 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
919 group = msn_groups_find_with_name(session->groups, |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
920 session->dest_group_name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
921 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
922 old_group = session->old_group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
923 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
924 session->moving_buddy = FALSE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
925 session->old_group = NULL; |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
926 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
927 if (group == NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
928 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
929 "Still don't have a group ID for %s while moving %s!\n", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
930 session->dest_group_name, passport); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
931 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
932 g_free(session->dest_group_name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
933 session->dest_group_name = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
934 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
935 return TRUE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
936 } |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
937 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
938 g_free(session->dest_group_name); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
939 session->dest_group_name = NULL; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
940 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
941 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
942 passport, passport, msn_group_get_id(group)); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
943 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
944 if (!msn_servconn_send_command(session->notification_conn, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
945 "ADD", outparams)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
946 gaim_connection_error(gc, _("Write error")); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
947 return FALSE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
948 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
949 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
950 if (old_group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
951 msn_group_remove_user(old_group, session->moving_user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
952 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
953 msn_user_unref(session->moving_user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
954 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
955 session->moving_user = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
956 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
957 if (old_group != NULL && |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
958 msn_users_get_count(msn_group_get_users(old_group)) <= 0) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
959 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
960 g_snprintf(outparams, sizeof(outparams), "%d", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
961 msn_group_get_id(old_group)); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
962 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
963 if (!msn_servconn_send_command(session->notification_conn, |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
964 "RMG", outparams)) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
965 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
966 gaim_connection_error(gc, _("Write error")); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
967 return FALSE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
968 } |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
969 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
970 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
971 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
972 return TRUE; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
973 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
974 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
975 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
976 rmg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
977 size_t param_count) |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
978 { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
979 MsnSession *session = servconn->session; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
980 MsnGroup *group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
981 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
982 group = msn_groups_find_with_id(session->groups, atoi(params[2])); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
983 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
984 if (group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
985 msn_groups_remove(session->groups, group); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
986 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
987 return TRUE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
988 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
989 |
5309 | 990 /************************************************************************** |
991 * Misc commands | |
992 **************************************************************************/ | |
993 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
994 url_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
995 size_t param_count) |
5309 | 996 { |
997 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
998 GaimAccount *account = session->account; |
5309 | 999 const char *rru; |
1000 const char *url; | |
1001 md5_state_t st; | |
1002 md5_byte_t di[16]; | |
1003 FILE *fd; | |
1004 char buf[2048]; | |
1005 char buf2[3]; | |
1006 char sendbuf[64]; | |
1007 int i; | |
1008 | |
1009 rru = params[1]; | |
1010 url = params[2]; | |
1011 | |
1012 g_snprintf(buf, sizeof(buf), "%s%lu%s", | |
1013 session->passport_info.mspauth, | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1014 time(NULL) - session->passport_info.sl, |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1015 gaim_account_get_password(account)); |
5309 | 1016 |
1017 md5_init(&st); | |
1018 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
1019 md5_finish(&st, di); | |
1020 | |
1021 memset(sendbuf, 0, sizeof(sendbuf)); | |
1022 | |
1023 for (i = 0; i < 16; i++) { | |
1024 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); | |
1025 strcat(sendbuf, buf2); | |
1026 } | |
1027 | |
1028 if (session->passport_info.file != NULL) { | |
1029 unlink(session->passport_info.file); | |
1030 g_free(session->passport_info.file); | |
1031 } | |
1032 | |
1033 if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL) { | |
1034 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
1035 "Error opening temp passport file: %s\n", | |
1036 strerror(errno)); | |
1037 } | |
1038 else { | |
1039 fputs("<html>\n" | |
1040 "<head>\n" | |
1041 "<noscript>\n" | |
1042 "<meta http-equiv=\"Refresh\" content=\"0; " | |
1043 "url=http://www.hotmail.com\">\n" | |
1044 "</noscript>\n" | |
1045 "</head>\n\n", | |
1046 fd); | |
1047 | |
1048 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); | |
1049 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", | |
1050 url); | |
1051 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); | |
1052 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1053 gaim_account_get_username(account)); |
5309 | 1054 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1055 gaim_account_get_username(account)); |
5309 | 1056 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", |
1057 session->passport_info.sid); | |
1058 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", | |
1059 session->passport_info.kv); | |
1060 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); | |
1061 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", | |
1062 time(NULL) - session->passport_info.sl); | |
1063 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", | |
1064 rru); | |
1065 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", | |
1066 session->passport_info.mspauth); | |
1067 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", | |
1068 sendbuf); /* TODO Digest me (huh? -- ChipX86) */ | |
1069 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); | |
1070 fprintf(fd, "<input type=\"hiden\" name=\"js\" value=\"yes\">\n"); | |
1071 fprintf(fd, "</form></body>\n"); | |
1072 fprintf(fd, "</html>\n"); | |
1073 | |
1074 if (fclose(fd)) { | |
1075 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
1076 "Error closing temp passport file: %s\n", | |
1077 strerror(errno)); | |
1078 | |
1079 unlink(session->passport_info.file); | |
1080 g_free(session->passport_info.file); | |
1081 } | |
1082 else { | |
1083 /* | |
1084 * Renaming file with .html extension, so that the | |
1085 * win32 open_url will work. | |
1086 */ | |
1087 char *tmp; | |
1088 | |
1089 if ((tmp = g_strdup_printf("%s.html", | |
1090 session->passport_info.file)) != NULL) { | |
1091 | |
1092 if (rename(session->passport_info.file, tmp) == 0) { | |
1093 g_free(session->passport_info.file); | |
1094 session->passport_info.file = tmp; | |
1095 } | |
1096 else | |
1097 g_free(tmp); | |
1098 } | |
1099 } | |
1100 } | |
1101 | |
1102 return TRUE; | |
1103 } | |
1104 /************************************************************************** | |
1105 * Switchboards | |
1106 **************************************************************************/ | |
1107 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1108 rng_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1109 size_t param_count) |
5309 | 1110 { |
1111 MsnSession *session = servconn->session; | |
1112 MsnSwitchBoard *swboard; | |
1113 MsnUser *user; | |
1114 const char *session_id; | |
1115 char *host, *c; | |
1116 int port; | |
1117 | |
1118 session_id = params[0]; | |
1119 | |
1120 host = g_strdup(params[1]); | |
1121 | |
1122 if ((c = strchr(host, ':')) != NULL) { | |
1123 *c = '\0'; | |
1124 port = atoi(c + 1); | |
1125 } | |
1126 else | |
1127 port = 1863; | |
1128 | |
1129 swboard = msn_switchboard_new(session); | |
1130 | |
1131 user = msn_user_new(session, params[4], NULL); | |
1132 | |
1133 msn_switchboard_set_invited(swboard, TRUE); | |
1134 msn_switchboard_set_session_id(swboard, params[0]); | |
1135 msn_switchboard_set_auth_key(swboard, params[3]); | |
1136 msn_switchboard_set_user(swboard, user); | |
1137 | |
1138 if (!msn_switchboard_connect(swboard, host, port)) { | |
1139 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
1140 "Unable to connect to switchboard on %s, port %d\n", | |
1141 host, port); | |
1142 | |
1143 g_free(host); | |
1144 | |
1145 return FALSE; | |
1146 } | |
1147 | |
1148 g_free(host); | |
1149 | |
1150 return TRUE; | |
1151 } | |
1152 | |
1153 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1154 xfr_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1155 size_t param_count) |
5309 | 1156 { |
1157 MsnSession *session = servconn->session; | |
1158 MsnSwitchBoard *swboard; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1159 GaimConnection *gc = session->account->gc; |
5309 | 1160 char *host; |
1161 char *c; | |
1162 int port; | |
1163 | |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1164 if (strcmp(params[1], "SB") && strcmp(params[1], "NS")) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1165 gaim_connection_error(gc, _("Got invalid XFR")); |
5309 | 1166 |
1167 return FALSE; | |
1168 } | |
1169 | |
1170 host = g_strdup(params[2]); | |
1171 | |
1172 if ((c = strchr(host, ':')) != NULL) { | |
1173 *c = '\0'; | |
1174 port = atoi(c + 1); | |
1175 } | |
1176 else | |
1177 port = 1863; | |
1178 | |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1179 if (!strcmp(params[1], "SB")) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1180 swboard = msn_session_find_unused_switch(session); |
5309 | 1181 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1182 if (swboard == NULL) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1183 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1184 "Received an XFR SB request when there's no unused " |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1185 "switchboards!\n"); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1186 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1187 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1188 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1189 msn_switchboard_set_auth_key(swboard, params[4]); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1190 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1191 if (!msn_switchboard_connect(swboard, host, port)) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1192 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1193 "Unable to connect to switchboard on %s, port %d\n", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1194 host, port); |
5309 | 1195 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1196 g_free(host); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1197 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1198 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1199 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1200 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1201 else if (!strcmp(params[1], "NS")) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1202 msn_servconn_destroy(session->notification_conn); |
5309 | 1203 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1204 session->notification_conn = msn_notification_new(session, host, port); |
5309 | 1205 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1206 if (!msn_servconn_connect(session->notification_conn)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1207 gaim_connection_error(gc, _("Unable to transfer to " |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1208 "notification server")); |
5309 | 1209 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1210 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1211 } |
5309 | 1212 } |
1213 | |
1214 g_free(host); | |
1215 | |
1216 return TRUE; | |
1217 } | |
1218 | |
1219 /************************************************************************** | |
1220 * Message Types | |
1221 **************************************************************************/ | |
1222 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1223 profile_msg(MsnServConn *servconn, MsnMessage *msg) |
5309 | 1224 { |
1225 MsnSession *session = servconn->session; | |
1226 const char *value; | |
1227 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1228 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1229 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1230 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1231 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1232 |
5309 | 1233 if ((value = msn_message_get_attr(msg, "kv")) != NULL) |
1234 session->passport_info.kv = g_strdup(value); | |
1235 | |
1236 if ((value = msn_message_get_attr(msg, "sid")) != NULL) | |
1237 session->passport_info.sid = g_strdup(value); | |
1238 | |
1239 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) | |
1240 session->passport_info.mspauth = g_strdup(value); | |
1241 | |
1242 return TRUE; | |
1243 } | |
1244 | |
1245 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1246 initial_email_msg(MsnServConn *servconn, MsnMessage *msg) |
5309 | 1247 { |
1248 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1249 GaimConnection *gc = session->account->gc; |
5309 | 1250 GHashTable *table; |
1251 const char *unread; | |
1252 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1253 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1254 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1255 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1256 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1257 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1258 if (!gaim_account_get_check_mail(session->account)) |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1259 return TRUE; |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1260 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1261 if (session->passport_info.file == NULL) { |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1262 msn_servconn_send_command(servconn, "URL", "INBOX"); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1263 |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1264 msn_servconn_queue_message(servconn, "URL", msg); |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1265 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1266 return TRUE; |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1267 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1268 |
5309 | 1269 table = msn_message_get_hashtable_from_body(msg); |
1270 | |
1271 unread = g_hash_table_lookup(table, "Inbox-Unread"); | |
1272 | |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1273 if (unread != NULL) { |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1274 const char *passport = msn_user_get_passport(session->user); |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1275 const char *url = session->passport_info.file; |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1276 |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1277 gaim_notify_emails(gc, atoi(unread), FALSE, NULL, NULL, |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1278 &passport, &url, NULL, NULL); |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1279 } |
5309 | 1280 |
1281 g_hash_table_destroy(table); | |
1282 | |
1283 return TRUE; | |
1284 } | |
1285 | |
1286 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1287 email_msg(MsnServConn *servconn, MsnMessage *msg) |
5309 | 1288 { |
1289 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1290 GaimConnection *gc = session->account->gc; |
5309 | 1291 GHashTable *table; |
1292 const char *from, *subject; | |
1293 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1294 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1295 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1296 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1297 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1298 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1299 if (!gaim_account_get_check_mail(session->account)) |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1300 return TRUE; |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1301 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1302 if (session->passport_info.file == NULL) { |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1303 msn_servconn_send_command(servconn, "URL", "INBOX"); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1304 |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1305 msn_servconn_queue_message(servconn, "URL", msg); |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1306 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1307 return TRUE; |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1308 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1309 |
5309 | 1310 table = msn_message_get_hashtable_from_body(msg); |
1311 | |
1312 from = g_hash_table_lookup(table, "From"); | |
1313 subject = g_hash_table_lookup(table, "Subject"); | |
1314 | |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1315 gaim_notify_email(gc, subject, from, msn_user_get_passport(session->user), |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1316 session->passport_info.file, NULL, NULL); |
5309 | 1317 |
1318 g_hash_table_destroy(table); | |
1319 | |
1320 return TRUE; | |
1321 } | |
1322 | |
1323 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1324 system_msg(MsnServConn *servconn, MsnMessage *msg) |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1325 { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1326 GHashTable *table; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1327 const char *type_s; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1328 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1329 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1330 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1331 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1332 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1333 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1334 table = msn_message_get_hashtable_from_body(msg); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1335 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1336 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1337 int type = atoi(type_s); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1338 char buf[MSN_BUF_LEN]; |
6308 | 1339 int minutes; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1340 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1341 switch (type) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1342 case 1: |
6308 | 1343 minutes = atoi(g_hash_table_lookup(table, "Arg1")); |
1344 g_snprintf(buf, sizeof(buf), ngettext( | |
1345 "The MSN server will shut down for maintenance " | |
1346 "in %d minute. You will automatically be " | |
1347 "signed out at that time. Please finish any " | |
1348 "conversations in progress.\n\nAfter the " | |
1349 "maintenance has been completed, you will be " | |
1350 "able to successfully sign in.", | |
1351 "The MSN server will shut down for maintenance " | |
1352 "in %d minutes. You will automatically be " | |
1353 "signed out at that time. Please finish any " | |
1354 "conversations in progress.\n\nAfter the " | |
1355 "maintenance has been completed, you will be " | |
1356 "able to successfully sign in.", minutes), | |
1357 minutes); | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1358 default: |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1359 break; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1360 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1361 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
1362 if (*buf != '\0') |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
1363 gaim_notify_info(servconn->session->account->gc, NULL, buf, NULL); |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1364 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1365 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1366 g_hash_table_destroy(table); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1367 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1368 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1369 } |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1370 |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1371 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1372 connect_cb(gpointer data, gint source, GaimInputCondition cond) |
5309 | 1373 { |
1374 MsnServConn *notification = data; | |
1375 MsnSession *session = notification->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1376 GaimAccount *account = session->account; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1377 GaimConnection *gc = gaim_account_get_connection(account); |
5309 | 1378 |
1379 if (source == -1) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1380 gaim_connection_error(session->account->gc, _("Unable to connect")); |
5309 | 1381 return FALSE; |
1382 } | |
1383 | |
1384 if (notification->fd != source) | |
1385 notification->fd = source; | |
1386 | |
1387 if (!msn_servconn_send_command(notification, "VER", | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1388 "MSNP7 MSNP6 MSNP5 MSNP4 CVR0")) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1389 gaim_connection_error(gc, _("Unable to write to server")); |
5309 | 1390 return FALSE; |
1391 } | |
1392 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1393 session->user = msn_user_new(session, |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1394 gaim_account_get_username(account), NULL); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1395 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1396 gaim_connection_update_progress(gc, _("Syncing with server"), |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1397 4, MSN_CONNECT_STEPS); |
5309 | 1398 |
1399 return TRUE; | |
1400 } | |
1401 | |
1402 static void | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1403 failed_read_cb(gpointer data, gint source, GaimInputCondition cond) |
5309 | 1404 { |
1405 MsnServConn *notification = data; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1406 GaimConnection *gc; |
5309 | 1407 |
1408 gc = notification->session->account->gc; | |
1409 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1410 gaim_connection_error(gc, _("Error reading from server")); |
5309 | 1411 } |
1412 | |
1413 MsnServConn * | |
1414 msn_notification_new(MsnSession *session, const char *server, int port) | |
1415 { | |
1416 MsnServConn *notification; | |
1417 | |
1418 notification = msn_servconn_new(session); | |
1419 | |
1420 msn_servconn_set_server(notification, server, port); | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1421 msn_servconn_set_connect_cb(notification, connect_cb); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1422 msn_servconn_set_failed_read_cb(notification, failed_read_cb); |
5309 | 1423 |
1424 if (notification_commands == NULL) { | |
1425 /* Register the command callbacks. */ | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1426 msn_servconn_register_command(notification, "ADD", add_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1427 msn_servconn_register_command(notification, "ADG", adg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1428 msn_servconn_register_command(notification, "BLP", blp_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1429 msn_servconn_register_command(notification, "BPR", bpr_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1430 msn_servconn_register_command(notification, "CHG", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1431 msn_servconn_register_command(notification, "CHL", chl_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1432 msn_servconn_register_command(notification, "FLN", fln_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1433 msn_servconn_register_command(notification, "GTC", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1434 msn_servconn_register_command(notification, "ILN", iln_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1435 msn_servconn_register_command(notification, "INF", inf_cmd); |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1436 msn_servconn_register_command(notification, "IPG", ipg_cmd); |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1437 msn_servconn_register_command(notification, "LSG", lsg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1438 msn_servconn_register_command(notification, "LST", lst_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1439 msn_servconn_register_command(notification, "MSG", msg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1440 msn_servconn_register_command(notification, "NLN", nln_cmd); |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1441 msn_servconn_register_command(notification, "NOT", not_cmd); |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1442 msn_servconn_register_command(notification, "OUT", out_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1443 msn_servconn_register_command(notification, "PRP", prp_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1444 msn_servconn_register_command(notification, "QNG", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1445 msn_servconn_register_command(notification, "QRY", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1446 msn_servconn_register_command(notification, "REA", rea_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1447 msn_servconn_register_command(notification, "REG", reg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1448 msn_servconn_register_command(notification, "REM", rem_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1449 msn_servconn_register_command(notification, "RMG", rmg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1450 msn_servconn_register_command(notification, "RNG", rng_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1451 msn_servconn_register_command(notification, "SYN", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1452 msn_servconn_register_command(notification, "URL", url_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1453 msn_servconn_register_command(notification, "USR", usr_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1454 msn_servconn_register_command(notification, "VER", ver_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1455 msn_servconn_register_command(notification, "XFR", xfr_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1456 msn_servconn_register_command(notification, "_unknown_", unknown_cmd); |
5309 | 1457 |
1458 /* Register the message type callbacks. */ | |
1459 msn_servconn_register_msg_type(notification, "text/x-msmsgsprofile", | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1460 profile_msg); |
5309 | 1461 msn_servconn_register_msg_type(notification, |
1462 "text/x-msmsgsinitialemailnotification", | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1463 initial_email_msg); |
5309 | 1464 msn_servconn_register_msg_type(notification, |
1465 "text/x-msmsgsemailnotification", | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1466 email_msg); |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1467 msn_servconn_register_msg_type(notification, |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1468 "application/x-msmsgssystemmessage", |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1469 system_msg); |
5309 | 1470 |
1471 /* Save these for future use. */ | |
1472 notification_commands = notification->commands; | |
1473 notification_msg_types = notification->msg_types; | |
1474 } | |
1475 else { | |
1476 g_hash_table_destroy(notification->commands); | |
1477 g_hash_table_destroy(notification->msg_types); | |
1478 | |
1479 notification->commands = notification_commands; | |
1480 notification->msg_types = notification_msg_types; | |
1481 } | |
1482 | |
1483 return notification; | |
1484 } |