annotate src/protocols/msn/notification.c @ 5326:9737d5ce9dcd

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