Mercurial > pidgin
annotate src/protocols/msn/notification.c @ 6845:5de4d9a4e0e2
[gaim-migrate @ 7390]
Removed the old buddy icon code from MSN.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 15 Sep 2003 02:23:58 +0000 |
parents | ccfbd7c552ba |
children | 885c6528843b |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file notification.c Notification server functions | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
7 * |
5309 | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 #include "msn.h" | |
23 #include "notification.h" | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
24 #include "state.h" |
5309 | 25 #include "error.h" |
26 #include "utils.h" | |
27 | |
28 typedef struct | |
29 { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
30 GaimConnection *gc; |
5309 | 31 MsnUser *user; |
32 | |
33 } MsnPermitAdd; | |
34 | |
35 static GHashTable *notification_commands = NULL; | |
36 static GHashTable *notification_msg_types = NULL; | |
37 | |
38 /************************************************************************** | |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
39 * Utility functions |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
40 **************************************************************************/ |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
41 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
42 add_buddy(MsnServConn *servconn, MsnUser *user) |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
43 { |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
44 MsnSession *session = servconn->session; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
45 GaimAccount *account = session->account; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
46 GaimConnection *gc = gaim_account_get_connection(account); |
6695 | 47 GaimBuddy *b; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
48 MsnGroup *group = NULL; |
6695 | 49 GaimGroup *g = NULL; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
50 GList *l, *l2; |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
51 GSList *sl; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
52 GSList *buddies; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
53 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
54 buddies = gaim_find_buddies(account, msn_user_get_passport(user)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
55 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
56 for (l = msn_user_get_group_ids(user); l != NULL; l = l->next) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
57 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
58 int group_id = GPOINTER_TO_INT(l->data); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
59 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
60 if (group_id > -1) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
61 group = msn_groups_find_with_id(session->groups, group_id); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
62 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
63 if (group == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
64 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
65 gaim_debug(GAIM_DEBUG_WARNING, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
66 "Group ID %d for user %s was not defined.\n", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
67 group_id, msn_user_get_passport(user)); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
68 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
69 /* Find a group that we can stick this guy into. Lamer. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
70 l2 = msn_groups_get_list(session->groups); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
71 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
72 if (l2 != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
73 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
74 group = l2->data; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
75 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
76 msn_user_add_group_id(user, msn_group_get_id(group)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
77 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
78 } |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
79 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
80 if (group == NULL || |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
81 (g = gaim_find_group(msn_group_get_name(group))) == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
82 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
83 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
84 "Group '%s' appears in server-side " |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
85 "buddy list, but not here!", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
86 msn_group_get_name(group)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
87 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
88 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
89 if (group != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
90 msn_group_add_user(group, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
91 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
92 b = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
93 |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
94 for (sl = buddies; sl != NULL; sl = sl->next) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
95 { |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
96 b = (GaimBuddy *)sl->data; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
97 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
98 if (gaim_find_buddys_group(b) == g) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
99 break; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
100 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
101 b = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
102 } |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
103 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
104 if (b == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
105 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
106 b = gaim_buddy_new(account, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
107 msn_user_get_passport(user), NULL); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
108 |
6773
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
109 b->proto_data = user; |
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
110 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
111 gaim_blist_add_buddy(b, NULL, g, NULL); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
112 } |
6773
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
113 else |
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
114 b->proto_data = user; |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
115 } |
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
116 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
117 g_slist_free(buddies); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
118 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
119 serv_got_alias(gc, (char *)msn_user_get_passport(user), |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
120 (char *)msn_user_get_name(user)); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
121 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
122 return TRUE; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
123 } |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
124 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
125 static size_t |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
126 msn_ssl_read(GaimSslConnection *gsc, char **dest_buffer) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
127 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
128 size_t size = 0, s; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
129 char *buffer = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
130 char temp_buf[4096]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
131 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
132 while ((s = gaim_ssl_read(gsc, temp_buf, sizeof(temp_buf))) > 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
133 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
134 char *new_buffer = g_new(char, size + s + 1); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
135 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
136 if (buffer != NULL) |
6827
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
137 { |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
138 strncpy(new_buffer, buffer, size); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
139 |
6827
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
140 g_free(buffer); |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
141 } |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
142 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
143 buffer = new_buffer; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
144 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
145 strncpy(buffer + size, temp_buf, s); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
146 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
147 buffer[size + s] = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
148 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
149 size += s; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
150 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
151 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
152 *dest_buffer = buffer; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
153 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
154 return size; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
155 } |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
156 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
157 /************************************************************************** |
5309 | 158 * Callbacks |
159 **************************************************************************/ | |
160 static void | |
161 msn_accept_add_cb(MsnPermitAdd *pa) | |
162 { | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5566
diff
changeset
|
163 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL) { |
5309 | 164 MsnSession *session = pa->gc->proto_data; |
165 char outparams[MSN_BUF_LEN]; | |
166 | |
167 g_snprintf(outparams, sizeof(outparams), "AL %s %s", | |
168 msn_user_get_passport(pa->user), | |
169 msn_url_encode(msn_user_get_name(pa->user))); | |
170 | |
171 if (msn_servconn_send_command(session->notification_conn, | |
172 "ADD", outparams) <= 0) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
173 gaim_connection_error(pa->gc, _("Write error")); |
5309 | 174 return; |
175 } | |
176 | |
177 gaim_privacy_permit_add(pa->gc->account, | |
6380
0f0b34c72e69
[gaim-migrate @ 6885]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
178 msn_user_get_passport(pa->user), TRUE); |
5309 | 179 show_got_added(pa->gc, NULL, msn_user_get_passport(pa->user), |
180 msn_user_get_name(pa->user), NULL); | |
181 } | |
182 | |
183 msn_user_destroy(pa->user); | |
184 g_free(pa); | |
185 } | |
186 | |
187 static void | |
188 msn_cancel_add_cb(MsnPermitAdd *pa) | |
189 { | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5566
diff
changeset
|
190 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL) { |
5309 | 191 MsnSession *session = pa->gc->proto_data; |
192 char outparams[MSN_BUF_LEN]; | |
193 | |
194 g_snprintf(outparams, sizeof(outparams), "BL %s %s", | |
195 msn_user_get_passport(pa->user), | |
196 msn_url_encode(msn_user_get_name(pa->user))); | |
197 | |
198 if (msn_servconn_send_command(session->notification_conn, | |
199 "ADD", outparams) <= 0) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
200 gaim_connection_error(pa->gc, _("Write error")); |
5309 | 201 return; |
202 } | |
203 | |
204 gaim_privacy_deny_add(pa->gc->account, | |
6380
0f0b34c72e69
[gaim-migrate @ 6885]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
205 msn_user_get_passport(pa->user), TRUE); |
5309 | 206 } |
207 | |
208 msn_user_destroy(pa->user); | |
209 g_free(pa); | |
210 } | |
211 | |
212 /************************************************************************** | |
213 * Catch-all commands | |
214 **************************************************************************/ | |
215 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
216 blank_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
217 size_t param_count) |
5309 | 218 { |
219 return TRUE; | |
220 } | |
221 | |
222 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
223 unknown_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
224 size_t param_count) |
5309 | 225 { |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
226 char buf[MSN_BUF_LEN]; |
5309 | 227 |
5334
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
228 if (isdigit(*command)) { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
229 int errnum = atoi(command); |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
230 |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
231 if (errnum == 225) { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
232 /* |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
233 * 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
|
234 * 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
|
235 * 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
|
236 */ |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
237 return TRUE; |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
238 } |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
239 |
6321 | 240 g_snprintf(buf, sizeof(buf), _("MSN Error: %s\n"), |
5334
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
241 msn_error_get_text(errnum)); |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
242 } |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
243 else { |
bbf2141d30d0
[gaim-migrate @ 5709]
Christian Hammond <chipx86@chipx86.com>
parents:
5333
diff
changeset
|
244 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
|
245 } |
5309 | 246 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
247 gaim_notify_error(servconn->session->account->gc, NULL, buf, NULL); |
5309 | 248 |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
249 return TRUE; |
5309 | 250 } |
251 | |
252 | |
253 /************************************************************************** | |
254 * Login | |
255 **************************************************************************/ | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
256 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
257 |
5309 | 258 static gboolean |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
259 cvr_cmd(MsnServConn *servconn, const char *command, const char **params, |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
260 size_t param_count) |
5309 | 261 { |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
262 GaimAccount *account = servconn->session->account; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
263 GaimConnection *gc = gaim_account_get_connection(account); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
264 char outparams[MSN_BUF_LEN]; |
5309 | 265 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
266 g_snprintf(outparams, sizeof(outparams), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
267 "TWN I %s", gaim_account_get_username(account)); |
5309 | 268 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
269 if (!msn_servconn_send_command(servconn, "USR", outparams)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
270 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
271 gaim_connection_error(gc, _("Unable to request USR\n")); |
5309 | 272 |
273 return FALSE; | |
274 } | |
275 | |
276 return TRUE; | |
277 } | |
278 | |
279 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
280 inf_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
281 size_t param_count) |
5309 | 282 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
283 GaimAccount *account = servconn->session->account; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
284 GaimConnection *gc = gaim_account_get_connection(account); |
5309 | 285 char outparams[MSN_BUF_LEN]; |
286 | |
287 if (strcmp(params[1], "MD5")) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
288 gaim_connection_error(gc, _("Unable to login using MD5")); |
5309 | 289 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
290 return FALSE; |
5309 | 291 } |
292 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
293 g_snprintf(outparams, sizeof(outparams), "MD5 I %s", |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
294 gaim_account_get_username(account)); |
5309 | 295 |
296 if (!msn_servconn_send_command(servconn, "USR", outparams)) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
297 gaim_connection_error(gc, _("Unable to send USR")); |
5309 | 298 |
299 return FALSE; | |
300 } | |
301 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
302 gaim_connection_update_progress(gc, _("Requesting to send password"), |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
303 5, MSN_CONNECT_STEPS); |
5309 | 304 |
305 return TRUE; | |
306 } | |
307 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
308 static void |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
309 login_connect_cb(gpointer data, GaimSslConnection *gsc, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
310 GaimInputCondition cond) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
311 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
312 MsnServConn *servconn = (MsnServConn *)data; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
313 MsnSession *session = servconn->session; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
314 GaimConnection *gc = gaim_account_get_connection(session->account); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
315 char *username, *password; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
316 char *request_str; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
317 char *buffer = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
318 size_t s; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
319 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
320 username = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
321 g_strdup(msn_url_encode(gaim_account_get_username(session->account))); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
322 password = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
323 g_strdup(msn_url_encode(gaim_account_get_password(session->account))); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
324 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
325 request_str = g_strdup_printf( |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
326 "GET %s HTTP/1.1\r\n" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
327 "Authorization: Passport1.4 OrgVerb=GET,OrgURL=%s,sign-in=%s,pwd=%s," |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
328 "lc=%s,id=%s,tw=%s,fs=%s,ct=%s,kpp=%s,kv=%s,ver=%s,tpf=%s\r\n" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
329 "User-Agent: MSMSGS\r\n" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
330 "Host: %s\r\n" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
331 "Connection: Keep-Alive\r\n" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
332 "Cache-Control: no-cache\r\n" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
333 "\r\n", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
334 session->ssl_login_path, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
335 (char *)g_hash_table_lookup(session->ssl_challenge_data, "ru"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
336 username, password, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
337 (char *)g_hash_table_lookup(session->ssl_challenge_data, "lc"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
338 (char *)g_hash_table_lookup(session->ssl_challenge_data, "id"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
339 (char *)g_hash_table_lookup(session->ssl_challenge_data, "tw"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
340 (char *)g_hash_table_lookup(session->ssl_challenge_data, "fs"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
341 (char *)g_hash_table_lookup(session->ssl_challenge_data, "ct"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
342 (char *)g_hash_table_lookup(session->ssl_challenge_data, "kpp"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
343 (char *)g_hash_table_lookup(session->ssl_challenge_data, "kv"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
344 (char *)g_hash_table_lookup(session->ssl_challenge_data, "ver"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
345 (char *)g_hash_table_lookup(session->ssl_challenge_data, "tpf"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
346 session->ssl_login_host); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
347 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
348 gaim_debug(GAIM_DEBUG_MISC, "msn", "Sending: {%s}\n", request_str); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
349 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
350 g_free(username); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
351 g_free(password); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
352 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
353 if ((s = gaim_ssl_write(gsc, request_str, strlen(request_str))) <= 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
354 { |
6779 | 355 g_free(request_str); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
356 gaim_connection_error(gc, _("Unable to write to MSN Nexus server.")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
357 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
358 return; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
359 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
360 |
6779 | 361 g_free(request_str); |
362 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
363 if ((s = msn_ssl_read(gsc, &buffer)) <= 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
364 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
365 gaim_connection_error(gc, _("Unable to read from MSN Nexus server.")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
366 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
367 if (buffer != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
368 g_free(buffer); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
369 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
370 return; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
371 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
372 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
373 gaim_ssl_close(gsc); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
374 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
375 gaim_debug(GAIM_DEBUG_MISC, "msn", "ssl buffer: {%s}", buffer); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
376 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
377 if (strstr(buffer, "HTTP/1.1 302") != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
378 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
379 /* Redirect. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
380 char *location, *c; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
381 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
382 if ((location = strstr(buffer, "Location: ")) == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
383 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
384 gaim_connection_error(gc, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
385 _("MSN Nexus server returned invalid redirect information.")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
386 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
387 g_free(buffer); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
388 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
389 return; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
390 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
391 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
392 location = strchr(location, ' ') + 1; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
393 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
394 if ((c = strchr(location, '\r')) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
395 *c = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
396 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
397 /* Skip the http:// */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
398 if ((c = strchr(location, '/')) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
399 location = c + 2; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
400 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
401 if ((c = strchr(location, '/')) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
402 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
403 session->ssl_login_path = g_strdup(c); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
404 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
405 *c = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
406 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
407 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
408 session->ssl_login_host = g_strdup(location); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
409 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
410 session->ssl_conn = gaim_ssl_connect(session->account, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
411 session->ssl_login_host, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
412 GAIM_SSL_DEFAULT_PORT, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
413 login_connect_cb, servconn); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
414 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
415 else if (strstr(buffer, "HTTP/1.1 401 Unauthorized") != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
416 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
417 char *error; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
418 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
419 if ((error = strstr(buffer, "WWW-Authenticate")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
420 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
421 if ((error = strstr(buffer, "cbtxt=")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
422 error += strlen("cbtxt="); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
423 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
424 error = msn_url_decode(error); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
425 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
426 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
427 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
428 if (error == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
429 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
430 gaim_connection_error(gc, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
431 _("Unknown error when attempting to authorize with " |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
432 "MSN login server.")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
433 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
434 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
435 gaim_connection_error(gc, error); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
436 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
437 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
438 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
439 char *base, *c; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
440 char outparams[MSN_BUF_LEN]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
441 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
442 g_free(session->ssl_login_host); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
443 g_free(session->ssl_login_path); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
444 g_hash_table_destroy(session->ssl_challenge_data); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
445 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
446 session->ssl_login_host = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
447 session->ssl_login_path = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
448 session->ssl_challenge_data = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
449 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
450 #if 0 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
451 /* All your base are belong to us. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
452 base = buffer; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
453 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
454 /* For great cookie! */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
455 while ((base = strstr(base, "Set-Cookie: ")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
456 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
457 base += strlen("Set-Cookie: "); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
458 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
459 c = strchr(base, ';'); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
460 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
461 session->login_cookies = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
462 g_list_append(session->login_cookies, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
463 g_strndup(base, c - base)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
464 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
465 #endif |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
466 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
467 if ((base = strstr(buffer, "Authentication-Info: ")) == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
468 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
469 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
470 "Authentication information was not found. This did " |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
471 "not just happen, but if it did, you're screwed. " |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
472 "Report this.\n"); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
473 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
474 return; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
475 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
476 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
477 base = strstr(base, "from-PP='"); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
478 base += strlen("from-PP='"); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
479 c = strchr(base, '\''); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
480 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
481 session->ssl_login_params = g_strndup(base, c - base); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
482 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
483 g_snprintf(outparams, sizeof(outparams), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
484 "TWN S %s", session->ssl_login_params); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
485 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
486 g_free(session->ssl_login_params); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
487 session->ssl_login_params = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
488 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
489 if (!msn_servconn_send_command(session->notification_conn, "USR", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
490 outparams)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
491 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
492 gaim_connection_error(gc, _("Unable to request USR\n")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
493 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
494 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
495 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
496 g_free(buffer); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
497 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
498 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
499 static void |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
500 nexus_connect_cb(gpointer data, GaimSslConnection *gsc, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
501 GaimInputCondition cond) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
502 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
503 MsnServConn *servconn = (MsnServConn *)data; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
504 MsnSession *session = servconn->session; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
505 GaimConnection *gc = gaim_account_get_connection(session->account); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
506 char *request_str; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
507 char *da_login; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
508 char *base, *c; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
509 char *buffer = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
510 size_t s; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
511 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
512 request_str = g_strdup_printf("GET /rdr/pprdr.asp\r\n\r\n"); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
513 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
514 if ((s = gaim_ssl_write(gsc, request_str, strlen(request_str))) <= 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
515 { |
6779 | 516 g_free(request_str); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
517 gaim_connection_error(gc, _("Unable to write to MSN Nexus server.")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
518 return; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
519 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
520 |
6779 | 521 g_free(request_str); |
6827
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
522 |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
523 if (session->ssl_url != NULL) |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
524 { |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
525 g_free(session->ssl_url); |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
526 session->ssl_url = NULL; |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6800
diff
changeset
|
527 } |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
528 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
529 /* Get the PassportURLs line. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
530 if ((s = msn_ssl_read(gsc, &buffer)) <= 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
531 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
532 gaim_connection_error(gc, _("Unable to read from MSN Nexus server.")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
533 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
534 if (buffer != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
535 g_free(buffer); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
536 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
537 return; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
538 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
539 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
540 if ((base = strstr(buffer, "PassportURLs")) == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
541 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
542 gaim_connection_error(gc, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
543 _("MSN Nexus server returned invalid information.")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
544 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
545 g_free(buffer); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
546 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
547 return; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
548 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
549 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
550 if ((da_login = strstr(base, "DALogin=")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
551 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
552 if ((da_login = strchr(da_login, '=')) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
553 da_login++; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
554 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
555 if ((c = strchr(da_login, ',')) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
556 *c = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
557 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
558 if ((c = strchr(da_login, '/')) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
559 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
560 session->ssl_login_path = g_strdup(c); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
561 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
562 *c = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
563 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
564 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
565 session->ssl_login_host = g_strdup(da_login); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
566 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
567 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
568 g_free(buffer); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
569 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
570 gaim_ssl_close(gsc); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
571 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
572 /* Now begin the connection to the login server. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
573 session->ssl_conn = gaim_ssl_connect(session->account, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
574 session->ssl_login_host, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
575 GAIM_SSL_DEFAULT_PORT, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
576 login_connect_cb, servconn); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
577 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
578 |
5309 | 579 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
580 usr_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
581 size_t param_count) |
5309 | 582 { |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
583 MsnSession *session = servconn->session; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
584 GaimAccount *account = session->account; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
585 GaimConnection *gc = gaim_account_get_connection(account); |
5309 | 586 char outparams[MSN_BUF_LEN]; |
587 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
588 /* |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
589 * We're either getting the passport connect info (if we're on |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
590 * MSNP8 or higher), or a challenge request (MSNP7 and lower). |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
591 * |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
592 * Let's find out. |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
593 */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
594 if (!g_ascii_strcasecmp(params[1], "OK")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
595 { |
5652
4fa26acb4cd3
[gaim-migrate @ 6066]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
596 const char *friendly = msn_url_decode(params[3]); |
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
597 |
5309 | 598 /* OK */ |
599 | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
600 gaim_connection_set_display_name(gc, friendly); |
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
601 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
602 session->syncing_lists = TRUE; |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
603 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
604 if (!msn_servconn_send_command(servconn, "SYN", "0")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
605 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
606 gaim_connection_error(gc, _("Unable to write")); |
5309 | 607 |
608 return FALSE; | |
609 } | |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
610 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
611 gaim_connection_update_progress(gc, _("Retrieving buddy list"), |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
612 7, MSN_CONNECT_STEPS); |
5309 | 613 } |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
614 else if (!g_ascii_strcasecmp(params[1], "TWN")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
615 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
616 /* Passport authentication */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
617 char *challenge_data; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
618 char *key, *value = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
619 char *c; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
620 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
621 if (session->ssl_challenge_data != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
622 g_hash_table_destroy(session->ssl_challenge_data); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
623 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
624 session->ssl_challenge_data = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
625 g_hash_table_new_full(g_str_hash, g_str_equal, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
626 g_free, g_free); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
627 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
628 /* Parse the challenge data. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
629 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
630 challenge_data = g_strdup(params[3]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
631 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
632 for (c = challenge_data, key = challenge_data; *c != '\0'; c++) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
633 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
634 if (*c == '=') |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
635 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
636 *c = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
637 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
638 value = c + 1; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
639 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
640 else if (*c == ',') |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
641 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
642 *c = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
643 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
644 g_hash_table_insert(session->ssl_challenge_data, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
645 g_strdup(key), g_strdup(value)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
646 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
647 key = c + 1; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
648 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
649 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
650 |
6779 | 651 g_free(challenge_data); |
652 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
653 #if 0 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
654 passport_str = g_strdup(msn_url_decode(params[3])); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
655 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
656 for (c = passport_str; *c != '\0'; c++) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
657 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
658 if (*c == ',') |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
659 *c = '&'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
660 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
661 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
662 session->ssl_url = passport_str; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
663 #endif |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
664 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
665 session->ssl_conn = gaim_ssl_connect(session->account, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
666 "nexus.passport.com", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
667 GAIM_SSL_DEFAULT_PORT, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
668 nexus_connect_cb, servconn); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
669 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
670 if (session->ssl_conn == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
671 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
672 gaim_connection_error(gc, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
673 _("Unable to connect to passport server")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
674 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
675 return FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
676 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
677 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
678 gaim_connection_update_progress(gc, _("Password sent"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
679 6, MSN_CONNECT_STEPS); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
680 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
681 else if (!g_ascii_strcasecmp(params[1], "MD5")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
682 { |
5309 | 683 /* Challenge */ |
684 const char *challenge = params[3]; | |
685 char buf[MSN_BUF_LEN]; | |
686 md5_state_t st; | |
687 md5_byte_t di[16]; | |
688 int i; | |
689 | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
690 g_snprintf(buf, sizeof(buf), "%s%s", challenge, |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
691 gaim_account_get_password(account)); |
5309 | 692 |
693 md5_init(&st); | |
694 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
695 md5_finish(&st, di); | |
696 | |
697 g_snprintf(outparams, sizeof(outparams), "MD5 S "); | |
698 | |
699 for (i = 0; i < 16; i++) { | |
700 g_snprintf(buf, sizeof(buf), "%02x", di[i]); | |
701 strcat(outparams, buf); | |
702 } | |
703 | |
704 if (!msn_servconn_send_command(servconn, "USR", outparams)) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
705 gaim_connection_error(gc, _("Unable to send password")); |
5309 | 706 |
707 return FALSE; | |
708 } | |
709 | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
710 gaim_connection_update_progress(gc, _("Password sent"), |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
711 6, MSN_CONNECT_STEPS); |
5309 | 712 } |
713 | |
714 return TRUE; | |
715 } | |
716 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
717 static gboolean |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
718 ver_cmd(MsnServConn *servconn, const char *command, const char **params, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
719 size_t param_count) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
720 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
721 MsnSession *session = servconn->session; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
722 GaimAccount *account = session->account; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
723 GaimConnection *gc = gaim_account_get_connection(account); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
724 gboolean protocol_supported = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
725 char outparams[MSN_BUF_LEN]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
726 char proto_str[8]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
727 size_t i; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
728 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
729 g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
730 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
731 for (i = 1; i < param_count; i++) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
732 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
733 if (!strcmp(params[i], proto_str)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
734 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
735 protocol_supported = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
736 break; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
737 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
738 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
739 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
740 if (!protocol_supported) { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
741 gaim_connection_error(gc, _("Protocol not supported")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
742 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
743 return FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
744 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
745 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
746 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
747 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
748 g_snprintf(outparams, sizeof(outparams), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
749 "0x0409 winnt 5.1 i386 MSNMSGR 6.0.0602 MSMSGS %s", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
750 gaim_account_get_username(account)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
751 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
752 if (!msn_servconn_send_command(servconn, "CVR", outparams)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
753 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
754 gaim_connection_error(gc, _("Unable to request CVR\n")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
755 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
756 return FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
757 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
758 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
759 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
760 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
761 if (!msn_servconn_send_command(servconn, "INF", NULL)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
762 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
763 gaim_connection_error(gc, _("Unable to request INF\n")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
764 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
765 return FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
766 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
767 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
768 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
769 return TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
770 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
771 |
5309 | 772 /************************************************************************** |
773 * Log out | |
774 **************************************************************************/ | |
775 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
776 out_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
777 size_t param_count) |
5309 | 778 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
779 GaimConnection *gc = servconn->session->account->gc; |
5309 | 780 |
781 if (!g_ascii_strcasecmp(params[0], "OTH")) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
782 gaim_connection_error(gc, |
5309 | 783 _("You have been disconnected. You have " |
784 "signed on from another location.")); | |
785 } | |
786 else if (!g_ascii_strcasecmp(params[0], "SSD")) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
787 gaim_connection_error(gc, |
5309 | 788 _("You have been disconnected. The MSN servers " |
789 "are going down temporarily.")); | |
790 } | |
791 | |
792 return FALSE; | |
793 } | |
794 | |
795 /************************************************************************** | |
796 * Messages | |
797 **************************************************************************/ | |
798 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
799 msg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
800 size_t param_count) |
5309 | 801 { |
802 gaim_debug(GAIM_DEBUG_INFO, "msn", "Found message. Parsing.\n"); | |
803 | |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
804 servconn->parsing_multiline = TRUE; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
805 servconn->multiline_type = MSN_MULTILINE_MSG; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
806 servconn->multiline_len = atoi(params[2]); |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
807 |
5309 | 808 servconn->msg_passport = g_strdup(params[0]); |
809 servconn->msg_friendly = g_strdup(params[1]); | |
810 | |
811 return TRUE; | |
812 } | |
813 | |
814 /************************************************************************** | |
815 * Challenges | |
816 **************************************************************************/ | |
817 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
818 chl_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
819 size_t param_count) |
5309 | 820 { |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
821 MsnSession *session = servconn->session; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
822 GaimConnection *gc = session->account->gc; |
5309 | 823 char buf[MSN_BUF_LEN]; |
824 char buf2[3]; | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
825 const char *challenge_resp; |
5309 | 826 md5_state_t st; |
827 md5_byte_t di[16]; | |
828 int i; | |
829 | |
830 md5_init(&st); | |
831 md5_append(&st, (const md5_byte_t *)params[1], strlen(params[1])); | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
832 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
833 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
834 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
835 challenge_resp = "VT6PX?UQTM4WM%YR"; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
836 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
837 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
838 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
839 challenge_resp = "Q1P7W2E4J9R8U3S5"; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
840 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
841 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
842 md5_append(&st, (const md5_byte_t *)challenge_resp, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
843 strlen(challenge_resp)); |
5309 | 844 md5_finish(&st, di); |
845 | |
846 g_snprintf(buf, sizeof(buf), | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
847 "QRY %u %s 32\r\n", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
848 servconn->session->trId++, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
849 (session->protocol_ver >= 8 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
850 ? "PROD0038W!61ZTF9" |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
851 : "msmsgs@msnmsgr.com")); |
5309 | 852 |
853 for (i = 0; i < 16; i++) { | |
854 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); | |
855 strcat(buf, buf2); | |
856 } | |
857 | |
858 if (msn_servconn_write(servconn, buf, strlen(buf)) <= 0) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
859 gaim_connection_error(gc, _("Unable to write to server")); |
5309 | 860 } |
861 | |
862 return TRUE; | |
863 } | |
864 | |
865 /************************************************************************** | |
866 * Buddy Lists | |
867 **************************************************************************/ | |
868 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
869 add_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
870 size_t param_count) |
5309 | 871 { |
872 MsnSession *session = servconn->session; | |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
873 MsnUser *user; |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
874 GaimAccount *account = session->account; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
875 GaimConnection *gc = gaim_account_get_connection(account); |
5309 | 876 MsnPermitAdd *pa; |
877 GSList *sl; | |
5890
1a2fcda8a5e7
[gaim-migrate @ 6322]
Christian Hammond <chipx86@chipx86.com>
parents:
5887
diff
changeset
|
878 const char *list, *passport, *group_id = NULL; |
5309 | 879 char *friend; |
880 char msg[MSN_BUF_LEN]; | |
881 | |
5918
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
882 list = params[1]; |
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
883 passport = params[3]; |
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
884 friend = msn_url_decode(params[4]); |
5309 | 885 |
5918
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
886 if (param_count >= 6) |
7134be4a319f
[gaim-migrate @ 6358]
Christian Hammond <chipx86@chipx86.com>
parents:
5890
diff
changeset
|
887 group_id = params[5]; |
5309 | 888 |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
889 if (!g_ascii_strcasecmp(list, "FL")) { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
890 user = msn_user_new(session, passport, NULL); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
891 |
5933
44eb6d75a5c6
[gaim-migrate @ 6373]
Christian Hammond <chipx86@chipx86.com>
parents:
5918
diff
changeset
|
892 if (group_id != NULL) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
893 msn_user_add_group_id(user, atoi(group_id)); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
894 |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
895 add_buddy(servconn, user); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
896 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
897 return TRUE; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
898 } |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
899 else if (g_ascii_strcasecmp(list, "RL")) |
5309 | 900 return TRUE; |
901 | |
902 for (sl = gc->account->permit; sl != NULL; sl = sl->next) { | |
903 if (!gaim_utf8_strcasecmp(sl->data, passport)) | |
904 return TRUE; | |
905 } | |
906 | |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
907 user = msn_user_new(session, passport, friend); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
908 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
909 pa = g_new0(MsnPermitAdd, 1); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
910 pa->user = user; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
911 pa->gc = gc; |
5309 | 912 |
913 g_snprintf(msg, sizeof(msg), | |
914 _("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
|
915 passport, friend, gaim_account_get_username(account)); |
5309 | 916 |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
917 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
918 _("Authorize"), G_CALLBACK(msn_accept_add_cb), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
919 _("Deny"), G_CALLBACK(msn_cancel_add_cb)); |
5309 | 920 |
921 return TRUE; | |
922 } | |
923 | |
924 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
925 adg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
926 size_t param_count) |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
927 { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
928 MsnGroup *group; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
929 MsnSession *session = servconn->session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
930 gint group_id; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
931 char *group_name; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
932 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
933 group_id = atoi(params[3]); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
934 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
935 group_name = msn_url_decode(params[2]); |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
936 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
937 group = msn_group_new(session, group_id, group_name); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
938 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
939 msn_groups_add(session->groups, group); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
940 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
941 return TRUE; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
942 } |
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 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
945 blp_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
946 size_t param_count) |
5309 | 947 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
948 GaimConnection *gc = servconn->session->account->gc; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
949 const char *list_name; |
5309 | 950 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
951 if (servconn->session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
952 list_name = params[0]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
953 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
954 list_name = params[2]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
955 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
956 if (!g_ascii_strcasecmp(list_name, "AL")) { |
5309 | 957 /* |
958 * If the current setting is AL, messages from users who | |
959 * are not in BL will be delivered. | |
960 * | |
961 * In other words, deny some. | |
962 */ | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
963 gc->account->perm_deny = DENY_SOME; |
5309 | 964 } |
965 else { | |
966 /* If the current setting is BL, only messages from people | |
967 * who are in the AL will be delivered. | |
968 * | |
969 * In other words, permit some. | |
970 */ | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
971 gc->account->perm_deny = PERMIT_SOME; |
5309 | 972 } |
973 | |
974 return TRUE; | |
975 } | |
976 | |
977 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
978 bpr_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
979 size_t param_count) |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
980 { |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
981 MsnSession *session = servconn->session; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
982 GaimConnection *gc = session->account->gc; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
983 const char *passport, *type, *value; |
6695 | 984 GaimBuddy *b; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
985 MsnUser *user; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
986 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
987 if (param_count == 4) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
988 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
989 passport = params[1]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
990 type = params[2]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
991 value = params[3]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
992 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
993 else if (param_count == 2) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
994 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
995 passport = msn_user_get_passport(session->last_user_added); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
996 type = params[0]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
997 value = params[1]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
998 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
999 else |
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
1000 return TRUE; |
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
1001 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1002 user = msn_users_find_with_passport(session->users, passport); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1003 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1004 if (value != NULL) { |
5375
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1005 if (!strcmp(type, "MOB")) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1006 if (!strcmp(value, "Y")) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1007 user->mobile = TRUE; |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1008 |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1009 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1010 if (GAIM_BUDDY_IS_ONLINE(b)) { |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1011 serv_got_update(gc, (char *)passport, |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1012 1, 0, 0, 0, b->uc); |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1013 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1014 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1015 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
1016 } |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1017 else if (!strcmp(type, "PHH")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1018 msn_user_set_home_phone(user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1019 else if (!strcmp(type, "PHW")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1020 msn_user_set_work_phone(user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1021 else if (!strcmp(type, "PHM")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1022 msn_user_set_mobile_phone(user, msn_url_decode(value)); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1023 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1024 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1025 return TRUE; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1026 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1027 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1028 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1029 fln_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1030 size_t param_count) |
5309 | 1031 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1032 GaimConnection *gc = servconn->session->account->gc; |
5309 | 1033 |
1034 serv_got_update(gc, (char *)params[0], 0, 0, 0, 0, 0); | |
1035 | |
1036 return TRUE; | |
1037 } | |
1038 | |
1039 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1040 iln_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1041 size_t param_count) |
5309 | 1042 { |
6800
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1043 MsnSession *session = servconn->session; |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1044 GaimConnection *gc = session->account->gc; |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1045 MsnUser *user; |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1046 MsnObject *msnobj; |
5309 | 1047 int status = 0; |
1048 const char *state, *passport, *friend; | |
6695 | 1049 GaimBuddy *b; |
5309 | 1050 |
1051 state = params[1]; | |
1052 passport = params[2]; | |
1053 friend = msn_url_decode(params[3]); | |
1054 | |
6833
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
1055 serv_got_alias(gc, (char *)passport, (char *)friend); |
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
1056 |
6800
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1057 if (session->protocol_ver >= 9 && param_count == 6) |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1058 { |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1059 user = msn_users_find_with_passport(session->users, passport); |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1060 |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1061 msnobj = msn_object_new_from_string(msn_url_decode(params[5])); |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1062 msn_user_set_object(user, msnobj); |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1063 } |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
1064 |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1065 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1066 status |= ((((b->uc) >> 1) & 0xF0) << 1); |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
1067 |
5309 | 1068 if (!g_ascii_strcasecmp(state, "BSY")) |
1069 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
1070 else if (!g_ascii_strcasecmp(state, "IDL")) | |
1071 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
1072 else if (!g_ascii_strcasecmp(state, "BRB")) | |
1073 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
1074 else if (!g_ascii_strcasecmp(state, "AWY")) | |
1075 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
1076 else if (!g_ascii_strcasecmp(state, "PHN")) | |
1077 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
1078 else if (!g_ascii_strcasecmp(state, "LUN")) | |
1079 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
1080 | |
1081 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
1082 | |
1083 return TRUE; | |
1084 } | |
1085 | |
1086 static gboolean | |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1087 ipg_cmd(MsnServConn *servconn, const char *command, const char **params, |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1088 size_t param_count) |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1089 { |
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
1090 /* GaimConnection *gc = servconn->session->account->gc; */ |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1091 |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1092 servconn->parsing_multiline = TRUE; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1093 servconn->multiline_type = MSN_MULTILINE_IPG; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1094 servconn->multiline_len = atoi(params[0]); |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1095 |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1096 servconn->msg_passport = NULL; |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1097 servconn->msg_friendly = NULL; |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1098 |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1099 return TRUE; |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1100 } |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1101 |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
1102 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1103 lsg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1104 size_t param_count) |
5309 | 1105 { |
1106 MsnSession *session = servconn->session; | |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1107 MsnGroup *group; |
6695 | 1108 GaimGroup *g; |
5309 | 1109 const char *name; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1110 int num_groups, group_id; |
5309 | 1111 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1112 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1113 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1114 group_id = atoi(params[0]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1115 name = msn_url_decode(params[1]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1116 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1117 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1118 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1119 num_groups = atoi(params[3]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1120 group_id = atoi(params[4]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1121 name = msn_url_decode(params[5]); |
5309 | 1122 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1123 if (num_groups == 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1124 return TRUE; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1125 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1126 if (!strcmp(name, "~")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1127 name = _("Buddies"); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1128 } |
5323
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
1129 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1130 group = msn_group_new(session, group_id, name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1131 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1132 msn_groups_add(session->groups, group); |
5309 | 1133 |
1134 if ((g = gaim_find_group(name)) == NULL) { | |
1135 g = gaim_group_new(name); | |
1136 gaim_blist_add_group(g, NULL); | |
1137 } | |
1138 | |
1139 return TRUE; | |
1140 } | |
1141 | |
1142 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1143 lst_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1144 size_t param_count) |
5309 | 1145 { |
1146 MsnSession *session = servconn->session; | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1147 GaimAccount *account = session->account; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1148 GaimConnection *gc = gaim_account_get_connection(account); |
5768 | 1149 const char *passport = NULL; |
1150 const char *friend = NULL; | |
5309 | 1151 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1152 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1153 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1154 const char *group_nums; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1155 int list_op; |
5309 | 1156 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1157 passport = params[0]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1158 friend = msn_url_decode(params[1]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1159 list_op = atoi(params[2]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1160 group_nums = params[3]; |
5309 | 1161 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1162 if (list_op & MSN_LIST_FL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1163 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1164 MsnUser *user; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1165 char **c; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1166 char **tokens; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1167 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1168 user = msn_user_new(session, passport, friend); |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
1169 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1170 tokens = g_strsplit(group_nums, ",", -1); |
5309 | 1171 |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
1172 gaim_debug_misc("msn", "Fetching group IDs from '%s'\n", |
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
1173 group_nums); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1174 for (c = tokens; *c != NULL; c++) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1175 { |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
1176 gaim_debug_misc("msn", "Appending group ID %d\n", atoi(*c)); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1177 msn_user_add_group_id(user, atoi(*c)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1178 } |
5309 | 1179 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1180 g_strfreev(tokens); |
5309 | 1181 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1182 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1183 g_slist_append(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1184 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1185 session->last_user_added = user; |
5309 | 1186 } |
1187 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1188 if (list_op & MSN_LIST_AL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1189 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1190 /* These are users who are allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1191 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1192 if (g_slist_find_custom(account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1193 (GCompareFunc)strcmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1194 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1195 gaim_privacy_deny_remove(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1196 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1197 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1198 gaim_privacy_permit_add(account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1199 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1200 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1201 if (list_op & MSN_LIST_BL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1202 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1203 /* These are users who are not allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1204 gaim_privacy_deny_add(account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1205 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1206 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1207 if (list_op & MSN_LIST_RL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1208 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1209 /* These are users who have us on their contact list. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1210 |
5309 | 1211 gboolean new_entry = TRUE; |
1212 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1213 if (g_slist_find_custom(account->permit, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1214 (GCompareFunc)g_ascii_strcasecmp) || |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1215 g_slist_find_custom(account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1216 (GCompareFunc)g_ascii_strcasecmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1217 { |
5309 | 1218 new_entry = FALSE; |
1219 } | |
1220 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1221 if (new_entry) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1222 { |
5309 | 1223 MsnPermitAdd *pa; |
1224 char msg[MSN_BUF_LEN]; | |
1225 | |
1226 pa = g_new0(MsnPermitAdd, 1); | |
1227 pa->user = msn_user_new(session, passport, friend); | |
1228 pa->gc = gc; | |
1229 | |
1230 g_snprintf(msg, sizeof(msg), | |
1231 _("The user %s (%s) wants to add you to their " | |
1232 "buddy list."), | |
1233 msn_user_get_passport(pa->user), | |
1234 msn_user_get_name(pa->user)); | |
1235 | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
1236 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
1237 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
1238 G_CALLBACK(msn_accept_add_cb), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
1239 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
1240 G_CALLBACK(msn_cancel_add_cb)); |
5309 | 1241 } |
1242 } | |
1243 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1244 session->num_users++; |
5309 | 1245 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1246 if (session->num_users == session->total_users) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1247 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1248 if (!msn_servconn_send_command(servconn, "CHG", "NLN")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1249 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1250 gaim_connection_error(gc, _("Unable to write")); |
5309 | 1251 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1252 return FALSE; |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1253 } |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1254 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1255 gaim_connection_set_state(gc, GAIM_CONNECTED); |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1256 serv_finish_login(gc); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1257 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1258 if (session->lists.allow == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1259 session->lists.allow = g_slist_copy(account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1260 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1261 session->lists.allow = g_slist_concat(session->lists.allow, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1262 account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1263 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1264 if (session->lists.block == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1265 session->lists.block = g_slist_copy(account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1266 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1267 session->lists.block = g_slist_concat(session->lists.block, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1268 account->deny); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1269 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1270 while (session->lists.forward != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1271 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1272 MsnUser *user = session->lists.forward->data; |
6777
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1273 GSList *buddies; |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1274 GSList *sl; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1275 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1276 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1277 g_slist_remove(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1278 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1279 add_buddy(servconn, user); |
6777
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1280 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1281 buddies = gaim_find_buddies(account, |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1282 msn_user_get_passport(user)); |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1283 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1284 /* Find all occurrences of this buddy in the wrong place. */ |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1285 for (sl = buddies; sl != NULL; sl = sl->next) |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1286 { |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1287 GaimBuddy *b = sl->data; |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1288 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1289 if (b->proto_data == NULL) |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1290 { |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1291 gaim_debug_warning("msn", |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1292 "Deleting misplaced user %s (%s) during sync " |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1293 "with server.\n", |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1294 b->name, gaim_find_buddys_group(b)->name); |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1295 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1296 gaim_blist_remove_buddy(b); |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1297 } |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1298 } |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1299 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
1300 g_slist_free(buddies); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1301 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1302 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1303 session->syncing_lists = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1304 session->lists_synced = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1305 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1306 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1307 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1308 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1309 const char *list_name; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1310 int user_num; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1311 int num_users; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1312 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1313 list_name = params[1]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1314 user_num = atoi(params[3]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1315 num_users = atoi(params[4]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1316 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1317 if (g_ascii_strcasecmp(list_name, "RL") && |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1318 user_num == 0 && num_users == 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1319 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1320 return TRUE; /* There are no users on this list. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1321 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1322 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1323 if (num_users > 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1324 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1325 passport = params[5]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1326 friend = msn_url_decode(params[6]); |
5309 | 1327 } |
1328 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1329 if (session->syncing_lists && session->lists_synced) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1330 return TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1331 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1332 if (!g_ascii_strcasecmp(list_name, "FL") && user_num != 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1333 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1334 /* These are users on our contact list. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1335 MsnUser *user; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1336 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1337 user = msn_user_new(session, passport, friend); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1338 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1339 if (param_count == 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1340 msn_user_add_group_id(user, atoi(params[7])); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1341 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1342 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1343 g_slist_append(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1344 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1345 else if (!g_ascii_strcasecmp(list_name, "AL") && user_num != 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1346 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1347 /* These are users who are allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1348 if (g_slist_find_custom(gc->account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1349 (GCompareFunc)strcmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1350 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1351 gaim_debug(GAIM_DEBUG_INFO, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1352 "Moving user from deny list to permit: %s (%s)\n", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1353 passport, friend); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1354 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1355 gaim_privacy_deny_remove(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1356 } |
5309 | 1357 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1358 gaim_privacy_permit_add(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1359 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1360 else if (!g_ascii_strcasecmp(list_name, "BL") && user_num != 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1361 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1362 /* These are users who are not allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1363 gaim_privacy_deny_add(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1364 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1365 else if (!g_ascii_strcasecmp(list_name, "RL")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1366 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1367 /* These are users who have us on their contact list. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1368 if (user_num > 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1369 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1370 gboolean new_entry = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1371 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1372 if (g_slist_find_custom(gc->account->permit, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1373 (GCompareFunc)g_ascii_strcasecmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1374 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1375 new_entry = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1376 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1377 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1378 if (g_slist_find_custom(gc->account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1379 (GCompareFunc)g_ascii_strcasecmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1380 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1381 new_entry = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1382 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1383 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1384 if (new_entry) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1385 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1386 MsnPermitAdd *pa; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1387 char msg[MSN_BUF_LEN]; |
5309 | 1388 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1389 gaim_debug(GAIM_DEBUG_WARNING, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1390 "Unresolved MSN RL entry: %s\n", passport); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1391 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1392 pa = g_new0(MsnPermitAdd, 1); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1393 pa->user = msn_user_new(session, passport, friend); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1394 pa->gc = gc; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1395 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1396 g_snprintf(msg, sizeof(msg), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1397 _("The user %s (%s) wants to add you to their " |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1398 "buddy list."), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1399 msn_user_get_passport(pa->user), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1400 msn_user_get_name(pa->user)); |
5309 | 1401 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1402 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1403 _("Authorize"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1404 G_CALLBACK(msn_accept_add_cb), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1405 _("Deny"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1406 G_CALLBACK(msn_cancel_add_cb)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1407 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1408 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1409 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1410 if (user_num != num_users) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1411 return TRUE; /* This isn't the last one in the RL. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1412 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1413 /* Now we're at the last one, so we can do final work. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1414 if (!session->lists_synced) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1415 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1416 if (!msn_servconn_send_command(servconn, "CHG", "NLN")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1417 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1418 gaim_connection_error(gc, _("Unable to write")); |
5309 | 1419 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1420 return FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1421 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1422 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1423 gaim_connection_set_state(gc, GAIM_CONNECTED); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1424 serv_finish_login(gc); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1425 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1426 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1427 if (session->lists.allow == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1428 session->lists.allow = g_slist_copy(gc->account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1429 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1430 session->lists.allow = g_slist_concat(session->lists.allow, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1431 gc->account->permit); |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
1432 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1433 if (session->lists.block == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1434 session->lists.block = g_slist_copy(gc->account->deny); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1435 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1436 session->lists.block = g_slist_concat(session->lists.block, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1437 gc->account->deny); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1438 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1439 while (session->lists.forward != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1440 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1441 MsnUser *user = session->lists.forward->data; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1442 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1443 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1444 g_slist_remove(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1445 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1446 add_buddy(servconn, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1447 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1448 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1449 session->syncing_lists = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1450 session->lists_synced = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1451 } |
5309 | 1452 } |
1453 | |
1454 return TRUE; | |
1455 } | |
1456 | |
1457 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1458 nln_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1459 size_t param_count) |
5309 | 1460 { |
1461 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1462 GaimConnection *gc = session->account->gc; |
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1463 MsnUser *user; |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1464 MsnObject *msnobj; |
5309 | 1465 const char *state; |
1466 const char *passport; | |
1467 const char *friend; | |
1468 int status = 0; | |
1469 | |
1470 state = params[0]; | |
1471 passport = params[1]; | |
1472 friend = msn_url_decode(params[2]); | |
1473 | |
6833
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
1474 serv_got_alias(gc, (char *)passport, (char *)friend); |
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
1475 |
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1476 if (session->protocol_ver >= 9 && param_count == 5) |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1477 { |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1478 user = msn_users_find_with_passport(session->users, passport); |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1479 |
6830
7ed61a258cb2
[gaim-migrate @ 7375]
Christian Hammond <chipx86@chipx86.com>
parents:
6829
diff
changeset
|
1480 msnobj = msn_object_new_from_string(msn_url_decode(params[4])); |
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1481 msn_user_set_object(user, msnobj); |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1482 } |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1483 |
5309 | 1484 if (!g_ascii_strcasecmp(state, "BSY")) |
1485 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
1486 else if (!g_ascii_strcasecmp(state, "IDL")) | |
1487 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
1488 else if (!g_ascii_strcasecmp(state, "BRB")) | |
1489 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
1490 else if (!g_ascii_strcasecmp(state, "AWY")) | |
1491 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
1492 else if (!g_ascii_strcasecmp(state, "PHN")) | |
1493 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
1494 else if (!g_ascii_strcasecmp(state, "LUN")) | |
1495 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
1496 | |
1497 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
1498 | |
1499 return TRUE; | |
1500 } | |
1501 | |
1502 static gboolean | |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1503 not_cmd(MsnServConn *servconn, const char *command, const char **params, |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1504 size_t param_count) |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1505 { |
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
1506 /* GaimConnection *gc = servconn->session->account->gc; */ |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1507 |
5962
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1508 servconn->parsing_multiline = TRUE; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1509 servconn->multiline_type = MSN_MULTILINE_NOT; |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1510 servconn->multiline_len = atoi(params[0]); |
115769a4c6fc
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5961
diff
changeset
|
1511 |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1512 servconn->msg_passport = NULL; |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1513 servconn->msg_friendly = NULL; |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1514 |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1515 return TRUE; |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1516 } |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1517 |
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1518 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1519 prp_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1520 size_t param_count) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1521 { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1522 MsnSession *session = servconn->session; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1523 const char *type, *value; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1524 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1525 type = params[2]; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1526 value = params[3]; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1527 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1528 if (param_count == 4) { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1529 if (!strcmp(type, "PHH")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1530 msn_user_set_home_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1531 else if (!strcmp(type, "PHW")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1532 msn_user_set_work_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1533 else if (!strcmp(type, "PHM")) |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1534 msn_user_set_mobile_phone(session->user, msn_url_decode(value)); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1535 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1536 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1537 return TRUE; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1538 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1539 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1540 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1541 rea_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1542 size_t param_count) |
5309 | 1543 { |
1544 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1545 GaimConnection *gc = session->account->gc; |
5309 | 1546 char *friend; |
1547 | |
5479
175de59cd1c5
[gaim-migrate @ 5875]
Christian Hammond <chipx86@chipx86.com>
parents:
5457
diff
changeset
|
1548 friend = msn_url_decode(params[3]); |
5309 | 1549 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1550 gaim_connection_set_display_name(gc, friend); |
5309 | 1551 |
1552 return TRUE; | |
1553 } | |
1554 | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1555 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1556 reg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1557 size_t param_count) |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1558 { |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1559 MsnSession *session = servconn->session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1560 MsnGroup *group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1561 int group_id; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1562 char *group_name; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1563 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1564 group_id = atoi(params[2]); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1565 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1566 group_name = msn_url_decode(params[3]); |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1567 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1568 group = msn_groups_find_with_id(session->groups, group_id); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1569 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1570 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
|
1571 msn_group_get_name(group), group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1572 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1573 if (group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1574 msn_group_set_name(group, group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1575 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1576 return TRUE; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1577 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1578 |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1579 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1580 rem_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1581 size_t param_count) |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1582 { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1583 MsnSession *session = servconn->session; |
6772
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1584 const char *passport = params[3]; |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1585 |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1586 if (param_count == 5) |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1587 { |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1588 MsnUser *user; |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1589 int group_id = atoi(params[4]); |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1590 |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1591 user = msn_users_find_with_passport(session->users, passport); |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1592 |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1593 msn_user_remove_group_id(user, group_id); |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1594 } |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1595 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1596 /* I hate this. */ |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1597 if (session->moving_buddy) { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1598 MsnGroup *group, *old_group; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1599 GaimConnection *gc = session->account->gc; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1600 char outparams[MSN_BUF_LEN]; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1601 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1602 group = msn_groups_find_with_name(session->groups, |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1603 session->dest_group_name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1604 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1605 old_group = session->old_group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1606 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1607 session->moving_buddy = FALSE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1608 session->old_group = NULL; |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1609 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1610 if (group == NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1611 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1612 "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
|
1613 session->dest_group_name, passport); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1614 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1615 g_free(session->dest_group_name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1616 session->dest_group_name = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1617 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1618 return TRUE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1619 } |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1620 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1621 g_free(session->dest_group_name); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1622 session->dest_group_name = NULL; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1623 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1624 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1625 passport, passport, msn_group_get_id(group)); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1626 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1627 if (!msn_servconn_send_command(session->notification_conn, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1628 "ADD", outparams)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1629 gaim_connection_error(gc, _("Write error")); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1630 return FALSE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1631 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1632 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1633 if (old_group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1634 msn_group_remove_user(old_group, session->moving_user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1635 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1636 msn_user_unref(session->moving_user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1637 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1638 session->moving_user = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1639 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1640 if (old_group != NULL && |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1641 msn_users_get_count(msn_group_get_users(old_group)) <= 0) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1642 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1643 g_snprintf(outparams, sizeof(outparams), "%d", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1644 msn_group_get_id(old_group)); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1645 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1646 if (!msn_servconn_send_command(session->notification_conn, |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1647 "RMG", outparams)) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1648 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1649 gaim_connection_error(gc, _("Write error")); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1650 return FALSE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1651 } |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1652 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1653 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1654 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1655 return TRUE; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1656 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1657 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1658 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1659 rmg_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1660 size_t param_count) |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1661 { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1662 MsnSession *session = servconn->session; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1663 MsnGroup *group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1664 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1665 group = msn_groups_find_with_id(session->groups, atoi(params[2])); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1666 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1667 if (group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1668 msn_groups_remove(session->groups, group); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1669 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1670 return TRUE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1671 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1672 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1673 static gboolean |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1674 syn_cmd(MsnServConn *servconn, const char *command, const char **params, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1675 size_t param_count) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1676 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1677 MsnSession *session = servconn->session; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1678 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1679 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1680 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1681 session->total_users = atoi(params[2]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1682 session->total_groups = atoi(params[3]); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1683 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1684 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1685 return TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1686 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1687 |
5309 | 1688 /************************************************************************** |
1689 * Misc commands | |
1690 **************************************************************************/ | |
1691 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1692 url_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1693 size_t param_count) |
5309 | 1694 { |
1695 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1696 GaimAccount *account = session->account; |
5309 | 1697 const char *rru; |
1698 const char *url; | |
1699 md5_state_t st; | |
1700 md5_byte_t di[16]; | |
1701 FILE *fd; | |
1702 char buf[2048]; | |
1703 char buf2[3]; | |
1704 char sendbuf[64]; | |
1705 int i; | |
1706 | |
1707 rru = params[1]; | |
1708 url = params[2]; | |
1709 | |
1710 g_snprintf(buf, sizeof(buf), "%s%lu%s", | |
1711 session->passport_info.mspauth, | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1712 time(NULL) - session->passport_info.sl, |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1713 gaim_account_get_password(account)); |
5309 | 1714 |
1715 md5_init(&st); | |
1716 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
1717 md5_finish(&st, di); | |
1718 | |
1719 memset(sendbuf, 0, sizeof(sendbuf)); | |
1720 | |
1721 for (i = 0; i < 16; i++) { | |
1722 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); | |
1723 strcat(sendbuf, buf2); | |
1724 } | |
1725 | |
1726 if (session->passport_info.file != NULL) { | |
1727 unlink(session->passport_info.file); | |
1728 g_free(session->passport_info.file); | |
1729 } | |
1730 | |
1731 if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL) { | |
1732 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
1733 "Error opening temp passport file: %s\n", | |
1734 strerror(errno)); | |
1735 } | |
1736 else { | |
1737 fputs("<html>\n" | |
1738 "<head>\n" | |
1739 "<noscript>\n" | |
1740 "<meta http-equiv=\"Refresh\" content=\"0; " | |
1741 "url=http://www.hotmail.com\">\n" | |
1742 "</noscript>\n" | |
1743 "</head>\n\n", | |
1744 fd); | |
1745 | |
1746 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); | |
1747 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", | |
1748 url); | |
1749 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); | |
1750 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1751 gaim_account_get_username(account)); |
5309 | 1752 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1753 gaim_account_get_username(account)); |
5309 | 1754 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", |
1755 session->passport_info.sid); | |
1756 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", | |
1757 session->passport_info.kv); | |
1758 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); | |
1759 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", | |
1760 time(NULL) - session->passport_info.sl); | |
1761 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", | |
1762 rru); | |
1763 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", | |
1764 session->passport_info.mspauth); | |
1765 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", | |
1766 sendbuf); /* TODO Digest me (huh? -- ChipX86) */ | |
1767 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); | |
1768 fprintf(fd, "<input type=\"hiden\" name=\"js\" value=\"yes\">\n"); | |
1769 fprintf(fd, "</form></body>\n"); | |
1770 fprintf(fd, "</html>\n"); | |
1771 | |
1772 if (fclose(fd)) { | |
1773 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
1774 "Error closing temp passport file: %s\n", | |
1775 strerror(errno)); | |
1776 | |
1777 unlink(session->passport_info.file); | |
1778 g_free(session->passport_info.file); | |
1779 } | |
1780 else { | |
1781 /* | |
1782 * Renaming file with .html extension, so that the | |
1783 * win32 open_url will work. | |
1784 */ | |
1785 char *tmp; | |
1786 | |
1787 if ((tmp = g_strdup_printf("%s.html", | |
1788 session->passport_info.file)) != NULL) { | |
1789 | |
1790 if (rename(session->passport_info.file, tmp) == 0) { | |
1791 g_free(session->passport_info.file); | |
1792 session->passport_info.file = tmp; | |
1793 } | |
1794 else | |
1795 g_free(tmp); | |
1796 } | |
1797 } | |
1798 } | |
1799 | |
1800 return TRUE; | |
1801 } | |
1802 /************************************************************************** | |
1803 * Switchboards | |
1804 **************************************************************************/ | |
1805 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1806 rng_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1807 size_t param_count) |
5309 | 1808 { |
1809 MsnSession *session = servconn->session; | |
1810 MsnSwitchBoard *swboard; | |
1811 MsnUser *user; | |
1812 const char *session_id; | |
1813 char *host, *c; | |
1814 int port; | |
1815 | |
1816 session_id = params[0]; | |
1817 | |
1818 host = g_strdup(params[1]); | |
1819 | |
1820 if ((c = strchr(host, ':')) != NULL) { | |
1821 *c = '\0'; | |
1822 port = atoi(c + 1); | |
1823 } | |
1824 else | |
1825 port = 1863; | |
1826 | |
1827 swboard = msn_switchboard_new(session); | |
1828 | |
1829 user = msn_user_new(session, params[4], NULL); | |
1830 | |
1831 msn_switchboard_set_invited(swboard, TRUE); | |
1832 msn_switchboard_set_session_id(swboard, params[0]); | |
1833 msn_switchboard_set_auth_key(swboard, params[3]); | |
1834 msn_switchboard_set_user(swboard, user); | |
1835 | |
1836 if (!msn_switchboard_connect(swboard, host, port)) { | |
1837 gaim_debug(GAIM_DEBUG_ERROR, "msn", | |
1838 "Unable to connect to switchboard on %s, port %d\n", | |
1839 host, port); | |
1840 | |
1841 g_free(host); | |
1842 | |
1843 return FALSE; | |
1844 } | |
1845 | |
1846 g_free(host); | |
1847 | |
1848 return TRUE; | |
1849 } | |
1850 | |
1851 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1852 xfr_cmd(MsnServConn *servconn, const char *command, const char **params, |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1853 size_t param_count) |
5309 | 1854 { |
1855 MsnSession *session = servconn->session; | |
1856 MsnSwitchBoard *swboard; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1857 GaimConnection *gc = session->account->gc; |
5309 | 1858 char *host; |
1859 char *c; | |
1860 int port; | |
1861 | |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1862 if (strcmp(params[1], "SB") && strcmp(params[1], "NS")) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1863 gaim_connection_error(gc, _("Got invalid XFR")); |
5309 | 1864 |
1865 return FALSE; | |
1866 } | |
1867 | |
1868 host = g_strdup(params[2]); | |
1869 | |
1870 if ((c = strchr(host, ':')) != NULL) { | |
1871 *c = '\0'; | |
1872 port = atoi(c + 1); | |
1873 } | |
1874 else | |
1875 port = 1863; | |
1876 | |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1877 if (!strcmp(params[1], "SB")) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1878 swboard = msn_session_find_unused_switch(session); |
5309 | 1879 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1880 if (swboard == NULL) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1881 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1882 "Received an XFR SB request when there's no unused " |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1883 "switchboards!\n"); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1884 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1885 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1886 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1887 msn_switchboard_set_auth_key(swboard, params[4]); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1888 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1889 if (!msn_switchboard_connect(swboard, host, port)) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1890 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1891 "Unable to connect to switchboard on %s, port %d\n", |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1892 host, port); |
5309 | 1893 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1894 g_free(host); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1895 |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1896 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1897 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1898 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1899 else if (!strcmp(params[1], "NS")) { |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1900 msn_servconn_destroy(session->notification_conn); |
5309 | 1901 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1902 session->notification_conn = msn_notification_new(session, host, port); |
5309 | 1903 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1904 if (!msn_servconn_connect(session->notification_conn)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1905 gaim_connection_error(gc, _("Unable to transfer to " |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1906 "notification server")); |
5309 | 1907 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1908 return FALSE; |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1909 } |
5309 | 1910 } |
1911 | |
1912 g_free(host); | |
1913 | |
1914 return TRUE; | |
1915 } | |
1916 | |
1917 /************************************************************************** | |
1918 * Message Types | |
1919 **************************************************************************/ | |
1920 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1921 profile_msg(MsnServConn *servconn, MsnMessage *msg) |
5309 | 1922 { |
1923 MsnSession *session = servconn->session; | |
1924 const char *value; | |
1925 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1926 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1927 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1928 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1929 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1930 |
5309 | 1931 if ((value = msn_message_get_attr(msg, "kv")) != NULL) |
1932 session->passport_info.kv = g_strdup(value); | |
1933 | |
1934 if ((value = msn_message_get_attr(msg, "sid")) != NULL) | |
1935 session->passport_info.sid = g_strdup(value); | |
1936 | |
1937 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) | |
1938 session->passport_info.mspauth = g_strdup(value); | |
1939 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1940 if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1941 session->passport_info.client_ip = g_strdup(value); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1942 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1943 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1944 session->passport_info.client_port = ntohs(atoi(value)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1945 |
5309 | 1946 return TRUE; |
1947 } | |
1948 | |
1949 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1950 initial_email_msg(MsnServConn *servconn, MsnMessage *msg) |
5309 | 1951 { |
1952 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1953 GaimConnection *gc = session->account->gc; |
5309 | 1954 GHashTable *table; |
1955 const char *unread; | |
1956 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1957 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1958 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1959 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1960 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1961 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1962 if (!gaim_account_get_check_mail(session->account)) |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1963 return TRUE; |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1964 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1965 if (session->passport_info.file == NULL) { |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1966 msn_servconn_send_command(servconn, "URL", "INBOX"); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1967 |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1968 msn_servconn_queue_message(servconn, "URL", msg); |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1969 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1970 return TRUE; |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1971 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1972 |
5309 | 1973 table = msn_message_get_hashtable_from_body(msg); |
1974 | |
1975 unread = g_hash_table_lookup(table, "Inbox-Unread"); | |
1976 | |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1977 if (unread != NULL) { |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1978 const char *passport = msn_user_get_passport(session->user); |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1979 const char *url = session->passport_info.file; |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1980 |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1981 gaim_notify_emails(gc, atoi(unread), FALSE, NULL, NULL, |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1982 &passport, &url, NULL, NULL); |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1983 } |
5309 | 1984 |
1985 g_hash_table_destroy(table); | |
1986 | |
1987 return TRUE; | |
1988 } | |
1989 | |
1990 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1991 email_msg(MsnServConn *servconn, MsnMessage *msg) |
5309 | 1992 { |
1993 MsnSession *session = servconn->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1994 GaimConnection *gc = session->account->gc; |
5309 | 1995 GHashTable *table; |
1996 const char *from, *subject; | |
1997 | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1998 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1999 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2000 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2001 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2002 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
2003 if (!gaim_account_get_check_mail(session->account)) |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
2004 return TRUE; |
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
2005 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
2006 if (session->passport_info.file == NULL) { |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
2007 msn_servconn_send_command(servconn, "URL", "INBOX"); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
2008 |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
2009 msn_servconn_queue_message(servconn, "URL", msg); |
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
2010 |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
2011 return TRUE; |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
2012 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
2013 |
5309 | 2014 table = msn_message_get_hashtable_from_body(msg); |
2015 | |
2016 from = g_hash_table_lookup(table, "From"); | |
2017 subject = g_hash_table_lookup(table, "Subject"); | |
2018 | |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
2019 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
|
2020 session->passport_info.file, NULL, NULL); |
5309 | 2021 |
2022 g_hash_table_destroy(table); | |
2023 | |
2024 return TRUE; | |
2025 } | |
2026 | |
2027 static gboolean | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2028 system_msg(MsnServConn *servconn, MsnMessage *msg) |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2029 { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2030 GHashTable *table; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2031 const char *type_s; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2032 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2033 if (strcmp(servconn->msg_passport, "Hotmail")) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2034 /* This isn't an official message. */ |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2035 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2036 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2037 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2038 table = msn_message_get_hashtable_from_body(msg); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2039 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2040 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2041 int type = atoi(type_s); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2042 char buf[MSN_BUF_LEN]; |
6308 | 2043 int minutes; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2044 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2045 switch (type) { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2046 case 1: |
6308 | 2047 minutes = atoi(g_hash_table_lookup(table, "Arg1")); |
2048 g_snprintf(buf, sizeof(buf), ngettext( | |
2049 "The MSN server will shut down for maintenance " | |
2050 "in %d minute. You will automatically be " | |
2051 "signed out at that time. Please finish any " | |
2052 "conversations in progress.\n\nAfter the " | |
2053 "maintenance has been completed, you will be " | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2054 "able to successfully sign in.", |
6308 | 2055 "The MSN server will shut down for maintenance " |
2056 "in %d minutes. You will automatically be " | |
2057 "signed out at that time. Please finish any " | |
2058 "conversations in progress.\n\nAfter the " | |
2059 "maintenance has been completed, you will be " | |
2060 "able to successfully sign in.", minutes), | |
2061 minutes); | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2062 default: |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2063 break; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2064 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2065 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
2066 if (*buf != '\0') |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
2067 gaim_notify_info(servconn->session->account->gc, NULL, buf, NULL); |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2068 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2069 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2070 g_hash_table_destroy(table); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2071 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2072 return TRUE; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2073 } |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2074 |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2075 static gboolean |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2076 connect_cb(gpointer data, gint source, GaimInputCondition cond) |
5309 | 2077 { |
2078 MsnServConn *notification = data; | |
2079 MsnSession *session = notification->session; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
2080 GaimAccount *account = session->account; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
2081 GaimConnection *gc = gaim_account_get_connection(account); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2082 char proto_vers[256]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2083 size_t i; |
5309 | 2084 |
2085 if (source == -1) { | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
2086 gaim_connection_error(session->account->gc, _("Unable to connect")); |
5309 | 2087 return FALSE; |
2088 } | |
2089 | |
2090 if (notification->fd != source) | |
2091 notification->fd = source; | |
2092 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2093 proto_vers[0] = '\0'; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2094 |
6828
cdcb43229e33
[gaim-migrate @ 7373]
Christian Hammond <chipx86@chipx86.com>
parents:
6827
diff
changeset
|
2095 for (i = 7; i <= session->protocol_ver; i++) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2096 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2097 char old_buf[256]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2098 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2099 strcpy(old_buf, proto_vers); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2100 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2101 g_snprintf(proto_vers, sizeof(proto_vers), "MSNP%d %s", i, old_buf); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2102 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2103 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2104 strncat(proto_vers, "CVR0", sizeof(proto_vers)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2105 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2106 if (!msn_servconn_send_command(notification, "VER", proto_vers)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2107 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
2108 gaim_connection_error(gc, _("Unable to write to server")); |
5309 | 2109 return FALSE; |
2110 } | |
2111 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
2112 session->user = msn_user_new(session, |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
2113 gaim_account_get_username(account), NULL); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
2114 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
2115 gaim_connection_update_progress(gc, _("Syncing with server"), |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
2116 4, MSN_CONNECT_STEPS); |
5309 | 2117 |
2118 return TRUE; | |
2119 } | |
2120 | |
2121 static void | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2122 failed_read_cb(gpointer data, gint source, GaimInputCondition cond) |
5309 | 2123 { |
2124 MsnServConn *notification = data; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
2125 GaimConnection *gc; |
5309 | 2126 |
2127 gc = notification->session->account->gc; | |
2128 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
2129 gaim_connection_error(gc, _("Error reading from server")); |
5309 | 2130 } |
2131 | |
2132 MsnServConn * | |
2133 msn_notification_new(MsnSession *session, const char *server, int port) | |
2134 { | |
2135 MsnServConn *notification; | |
2136 | |
2137 notification = msn_servconn_new(session); | |
2138 | |
2139 msn_servconn_set_server(notification, server, port); | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2140 msn_servconn_set_connect_cb(notification, connect_cb); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2141 msn_servconn_set_failed_read_cb(notification, failed_read_cb); |
5309 | 2142 |
2143 if (notification_commands == NULL) { | |
2144 /* Register the command callbacks. */ | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2145 msn_servconn_register_command(notification, "ADD", add_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2146 msn_servconn_register_command(notification, "ADG", adg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2147 msn_servconn_register_command(notification, "BLP", blp_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2148 msn_servconn_register_command(notification, "BPR", bpr_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2149 msn_servconn_register_command(notification, "CHG", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2150 msn_servconn_register_command(notification, "CHL", chl_cmd); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2151 msn_servconn_register_command(notification, "CVR", cvr_cmd); |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2152 msn_servconn_register_command(notification, "FLN", fln_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2153 msn_servconn_register_command(notification, "GTC", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2154 msn_servconn_register_command(notification, "ILN", iln_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2155 msn_servconn_register_command(notification, "INF", inf_cmd); |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
2156 msn_servconn_register_command(notification, "IPG", ipg_cmd); |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2157 msn_servconn_register_command(notification, "LSG", lsg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2158 msn_servconn_register_command(notification, "LST", lst_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2159 msn_servconn_register_command(notification, "MSG", msg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2160 msn_servconn_register_command(notification, "NLN", nln_cmd); |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
2161 msn_servconn_register_command(notification, "NOT", not_cmd); |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2162 msn_servconn_register_command(notification, "OUT", out_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2163 msn_servconn_register_command(notification, "PRP", prp_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2164 msn_servconn_register_command(notification, "QNG", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2165 msn_servconn_register_command(notification, "QRY", blank_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2166 msn_servconn_register_command(notification, "REA", rea_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2167 msn_servconn_register_command(notification, "REG", reg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2168 msn_servconn_register_command(notification, "REM", rem_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2169 msn_servconn_register_command(notification, "RMG", rmg_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2170 msn_servconn_register_command(notification, "RNG", rng_cmd); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2171 msn_servconn_register_command(notification, "SYN", syn_cmd); |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2172 msn_servconn_register_command(notification, "URL", url_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2173 msn_servconn_register_command(notification, "USR", usr_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2174 msn_servconn_register_command(notification, "VER", ver_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2175 msn_servconn_register_command(notification, "XFR", xfr_cmd); |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2176 msn_servconn_register_command(notification, "_unknown_", unknown_cmd); |
5309 | 2177 |
2178 /* Register the message type callbacks. */ | |
2179 msn_servconn_register_msg_type(notification, "text/x-msmsgsprofile", | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2180 profile_msg); |
5309 | 2181 msn_servconn_register_msg_type(notification, |
2182 "text/x-msmsgsinitialemailnotification", | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2183 initial_email_msg); |
5309 | 2184 msn_servconn_register_msg_type(notification, |
2185 "text/x-msmsgsemailnotification", | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2186 email_msg); |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2187 msn_servconn_register_msg_type(notification, |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
2188 "application/x-msmsgssystemmessage", |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
2189 system_msg); |
5309 | 2190 |
2191 /* Save these for future use. */ | |
2192 notification_commands = notification->commands; | |
2193 notification_msg_types = notification->msg_types; | |
2194 } | |
2195 else { | |
2196 g_hash_table_destroy(notification->commands); | |
2197 g_hash_table_destroy(notification->msg_types); | |
2198 | |
2199 notification->commands = notification_commands; | |
2200 notification->msg_types = notification_msg_types; | |
2201 } | |
2202 | |
2203 return notification; | |
2204 } |