annotate src/protocols/msn/notification.c @ 5890:1a2fcda8a5e7

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