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