Mercurial > pidgin.yaz
annotate src/protocols/msn/notification.c @ 8808:bbd8cdaf0ad5
[gaim-migrate @ 9570]
A massive patch by shx to reorganize MSN some more and add command
processor support. This allows us to do cool things like produce more
detailed error messages. For example, the Invalid Username dialog now
shows the username of the invalid user.
I modified the aforementioned dialog so it'll look a little nicer looking,
and also mention the account this happened on. It also removes the user
from your blist, as there's no point to keeping the user on there.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 25 Apr 2004 22:02:06 +0000 |
parents | 06dd136238ab |
children | c313e3b1f2c0 |
rev | line source |
---|---|
5309 | 1 /** |
2 * @file notification.c Notification server functions | |
3 * | |
4 * gaim | |
5 * | |
8475
06f57183e29f
[gaim-migrate @ 9208]
Christian Hammond <chipx86@chipx86.com>
parents:
8255
diff
changeset
|
6 * Copyright (C) 2003-2004 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 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
35 static MsnTable *cbs_table = NULL; |
5309 | 36 |
37 /************************************************************************** | |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
38 * Utility functions |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
39 **************************************************************************/ |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
40 static gboolean |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
41 add_buddy(MsnCmdProc *cmdproc, MsnUser *user) |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
42 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
43 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
44 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
45 GaimConnection *gc; |
6695 | 46 GaimBuddy *b; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
47 MsnGroup *group = NULL; |
6695 | 48 GaimGroup *g = NULL; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
49 GList *l, *l2; |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
50 GSList *sl; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
51 GSList *buddies; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
52 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
53 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
54 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
55 gc = gaim_account_get_connection(account); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
56 buddies = gaim_find_buddies(account, msn_user_get_passport(user)); |
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 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
|
59 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
60 int group_id = GPOINTER_TO_INT(l->data); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
61 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
62 if (group_id > -1) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
63 group = msn_groups_find_with_id(session->groups, group_id); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
64 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
65 if (group == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
66 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
67 gaim_debug(GAIM_DEBUG_WARNING, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
68 "Group ID %d for user %s was not defined.\n", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
69 group_id, msn_user_get_passport(user)); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
70 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
71 /* Find a group that we can stick this guy into. Lamer. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
72 l2 = msn_groups_get_list(session->groups); |
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 if (l2 != NULL) |
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 group = l2->data; |
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 msn_user_add_group_id(user, msn_group_get_id(group)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
79 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
80 } |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
81 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
82 if (group == NULL || |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
83 (g = gaim_find_group(msn_group_get_name(group))) == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
84 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
85 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
86 "Group '%s' appears in server-side " |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
87 "buddy list, but not here!", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
88 msn_group_get_name(group)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
89 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
90 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
91 if (group != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
92 msn_group_add_user(group, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
93 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
94 b = NULL; |
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 for (sl = buddies; sl != NULL; sl = sl->next) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
97 { |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
98 b = (GaimBuddy *)sl->data; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
99 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
100 if (gaim_find_buddys_group(b) == g) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
101 break; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
102 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
103 b = NULL; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
104 } |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
105 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
106 if (b == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
107 { |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
108 const char *passport, *friendly; |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
109 |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
110 passport = msn_user_get_passport(user); |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
111 |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
112 b = gaim_buddy_new(account, passport, NULL); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
113 |
6773
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
114 b->proto_data = user; |
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
115 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
116 gaim_blist_add_buddy(b, NULL, g, NULL); |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
117 |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
118 if ((friendly = msn_user_get_name(user)) != NULL) |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
119 serv_got_alias(gc, passport, friendly); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
120 } |
6773
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
121 else |
addc5c8c0df1
[gaim-migrate @ 7310]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
122 b->proto_data = user; |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
123 } |
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
124 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
125 g_slist_free(buddies); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
126 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
127 serv_got_alias(gc, (char *)msn_user_get_passport(user), |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
128 (char *)msn_user_get_name(user)); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
129 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
130 return TRUE; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
131 } |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
132 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
133 /************************************************************************** |
5309 | 134 * Callbacks |
135 **************************************************************************/ | |
136 static void | |
137 msn_accept_add_cb(MsnPermitAdd *pa) | |
138 { | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
139 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
140 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
141 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
142 MsnCmdProc *cmdproc; |
5309 | 143 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
144 session = pa->gc->proto_data; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
145 cmdproc = session->notification_conn->cmdproc; |
5309 | 146 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
147 msn_cmdproc_send(cmdproc, "ADD", "AL %s %s", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
148 msn_user_get_passport(pa->user), |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
149 gaim_url_encode(msn_user_get_name(pa->user))); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
150 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
151 if (cmdproc->error) |
5309 | 152 return; |
153 | |
154 gaim_privacy_permit_add(pa->gc->account, | |
6380
0f0b34c72e69
[gaim-migrate @ 6885]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
155 msn_user_get_passport(pa->user), TRUE); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6980
diff
changeset
|
156 gaim_account_notify_added(pa->gc->account, NULL, |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6980
diff
changeset
|
157 msn_user_get_passport(pa->user), |
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
6980
diff
changeset
|
158 msn_user_get_name(pa->user), NULL); |
5309 | 159 } |
160 | |
161 msn_user_destroy(pa->user); | |
162 g_free(pa); | |
163 } | |
164 | |
165 static void | |
166 msn_cancel_add_cb(MsnPermitAdd *pa) | |
167 { | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
168 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
169 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
170 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
171 MsnCmdProc *cmdproc; |
5309 | 172 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
173 session = pa->gc->proto_data; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
174 cmdproc = session->notification_conn->cmdproc; |
5309 | 175 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
176 msn_cmdproc_send(cmdproc, "ADD", "BL %s %s", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
177 msn_user_get_passport(pa->user), |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
178 gaim_url_encode(msn_user_get_name(pa->user))); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
179 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
180 if (cmdproc->error) |
5309 | 181 return; |
182 | |
183 gaim_privacy_deny_add(pa->gc->account, | |
6380
0f0b34c72e69
[gaim-migrate @ 6885]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
184 msn_user_get_passport(pa->user), TRUE); |
5309 | 185 } |
186 | |
187 msn_user_destroy(pa->user); | |
188 g_free(pa); | |
189 } | |
190 | |
191 /************************************************************************** | |
192 * Login | |
193 **************************************************************************/ | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
194 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
195 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
196 cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 197 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
198 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
199 GaimConnection *gc; |
5309 | 200 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
201 account = cmdproc->session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
202 gc = gaim_account_get_connection(account); |
5309 | 203 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
204 msn_cmdproc_send(cmdproc, "USR", "TWN I %s", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
205 gaim_account_get_username(account)); |
5309 | 206 } |
207 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
208 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
209 inf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 210 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
211 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
212 GaimConnection *gc; |
5309 | 213 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
214 account = cmdproc->session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
215 gc = gaim_account_get_connection(account); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
216 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
217 if (strcmp(cmd->params[1], "MD5")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
218 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
219 gaim_connection_error(gc, _("Unable to login using MD5")); |
5309 | 220 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
221 return; |
5309 | 222 } |
223 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
224 msn_cmdproc_send(cmdproc, "USR", "MD5 I %s", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
225 gaim_account_get_username(account)); |
5309 | 226 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
227 if (cmdproc->error) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
228 return; |
5309 | 229 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
230 gaim_connection_update_progress(gc, _("Requesting to send password"), |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
231 5, MSN_CONNECT_STEPS); |
5309 | 232 } |
233 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
234 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
235 usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 236 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
237 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
238 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
239 GaimConnection *gc; |
5309 | 240 char outparams[MSN_BUF_LEN]; |
241 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
242 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
243 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
244 gc = gaim_account_get_connection(account); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
245 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
246 /* |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
247 * 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
|
248 * MSNP8 or higher), or a challenge request (MSNP7 and lower). |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
249 * |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
250 * Let's find out. |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
251 */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
252 if (!g_ascii_strcasecmp(cmd->params[1], "OK")) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
253 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
254 const char *friendly = gaim_url_decode(cmd->params[3]); |
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
255 |
5309 | 256 /* OK */ |
257 | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
258 gaim_connection_set_display_name(gc, friendly); |
5508
2a57266df5f6
[gaim-migrate @ 5907]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
259 |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
260 session->syncing_lists = TRUE; |
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
261 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
262 msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); |
5309 | 263 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
264 if (cmdproc->error) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
265 return; |
5326
9737d5ce9dcd
[gaim-migrate @ 5699]
Christian Hammond <chipx86@chipx86.com>
parents:
5323
diff
changeset
|
266 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
267 gaim_connection_update_progress(gc, _("Retrieving buddy list"), |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
268 7, MSN_CONNECT_STEPS); |
5309 | 269 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
270 else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
271 { |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
272 char **elems, **cur, **tokens; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
273 |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
274 /* Passport authentication */ |
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
275 session->nexus = msn_nexus_new(session); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
276 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
277 /* Parse the challenge data. */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
278 elems = g_strsplit(cmd->params[3], ",", 0); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
279 |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
280 for (cur = elems; *cur != NULL; cur++) |
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
281 { |
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
282 tokens = g_strsplit(*cur, "=", 2); |
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
283 g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); |
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
284 /* Don't free each of the tokens, only the array. */ |
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
285 g_free(tokens); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
286 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
287 |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
288 g_strfreev(elems); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
289 |
8171
d0ba2f7b40e7
[gaim-migrate @ 8884]
Christian Hammond <chipx86@chipx86.com>
parents:
8029
diff
changeset
|
290 msn_nexus_connect(session->nexus); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
291 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
292 gaim_connection_update_progress(gc, _("Password sent"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
293 6, MSN_CONNECT_STEPS); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
294 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
295 else if (!g_ascii_strcasecmp(cmd->params[1], "MD5")) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
296 { |
5309 | 297 /* Challenge */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
298 const char *challenge; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
299 const char *password; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
300 char buf[33]; |
5309 | 301 md5_state_t st; |
302 md5_byte_t di[16]; | |
303 int i; | |
304 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
305 challenge = cmd->params[3]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
306 password = gaim_account_get_password(account); |
5309 | 307 |
308 md5_init(&st); | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
309 md5_append(&st, (const md5_byte_t *)challenge, strlen(challenge)); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
310 md5_append(&st, (const md5_byte_t *)password, strlen(password)); |
5309 | 311 md5_finish(&st, di); |
312 | |
313 g_snprintf(outparams, sizeof(outparams), "MD5 S "); | |
314 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
315 for (i = 0; i < 16; i++) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
316 g_snprintf(buf + (i*2), 3, "%02x", di[i]); |
5309 | 317 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
318 msn_cmdproc_send(cmdproc, "USR", "MD5 S %s", buf); |
5309 | 319 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
320 if (cmdproc->error) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
321 return; |
5309 | 322 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
323 gaim_connection_update_progress(gc, _("Password sent"), |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
324 6, MSN_CONNECT_STEPS); |
5309 | 325 } |
326 } | |
327 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
328 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
329 ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
330 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
331 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
332 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
333 GaimConnection *gc; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
334 gboolean protocol_supported = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
335 char proto_str[8]; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
336 size_t i; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
337 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
338 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
339 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
340 gc = gaim_account_get_connection(account); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
341 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
342 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
|
343 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
344 for (i = 1; i < cmd->param_count; i++) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
345 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
346 if (!strcmp(cmd->params[i], proto_str)) |
6701
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 protocol_supported = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
349 break; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
350 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
351 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
352 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
353 if (!protocol_supported) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
354 { |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
355 gaim_connection_error(gc, _("Protocol not supported")); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
356 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
357 return; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
358 } |
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 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
361 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
362 msn_cmdproc_send(cmdproc, "CVR", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
363 "0x0409 winnt 5.1 i386 MSNMSGR 6.0.0602 MSMSGS %s", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
364 gaim_account_get_username(account)); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
365 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
366 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
367 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
368 msn_cmdproc_send(cmdproc, "INF", NULL, NULL); |
6701
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 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
371 |
5309 | 372 /************************************************************************** |
373 * Log out | |
374 **************************************************************************/ | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
375 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
376 out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 377 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
378 GaimConnection *gc; |
5309 | 379 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
380 gc = cmdproc->session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
381 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
382 if (!g_ascii_strcasecmp(cmd->params[0], "OTH")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
383 { |
8669 | 384 gc->wants_to_die = TRUE; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
385 gaim_connection_error(gc, |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
386 _("You have been disconnected. You have " |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
387 "signed on from another location.")); |
5309 | 388 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
389 else if (!g_ascii_strcasecmp(cmd->params[0], "SSD")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
390 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
391 gaim_connection_error(gc, |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
392 _("You have been disconnected. The MSN servers " |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
393 "are going down temporarily.")); |
5309 | 394 } |
395 } | |
396 | |
397 /************************************************************************** | |
398 * Messages | |
399 **************************************************************************/ | |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
400 static void |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
401 msg_cmd_post(MsnCmdProc *cmdproc, char *payload, size_t len) |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
402 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
403 MsnMessage *msg; |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
404 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
405 msg = msn_message_new(); |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
406 |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
407 msn_message_parse_payload(msg, payload, len); |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
408 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
409 msg->passport = cmdproc->temp; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
410 msn_cmdproc_process_msg(cmdproc, msg); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
411 g_free(cmdproc->temp); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
412 cmdproc->temp = NULL; |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
413 |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
414 msn_message_destroy(msg); |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
415 } |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
416 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
417 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
418 msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 419 { |
420 gaim_debug(GAIM_DEBUG_INFO, "msn", "Found message. Parsing.\n"); | |
421 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
422 cmdproc->payload_cb = msg_cmd_post; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
423 cmdproc->servconn->payload_len = atoi(cmd->params[2]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
424 cmdproc->temp = g_strdup(cmd->params[0]); |
5309 | 425 } |
426 | |
427 /************************************************************************** | |
428 * Challenges | |
429 **************************************************************************/ | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
430 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
431 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 432 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
433 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
434 GaimConnection *gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
435 MsnTransaction *trans; |
5309 | 436 char buf[MSN_BUF_LEN]; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
437 const char *challenge_resp; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
438 const char *challenge_str; |
5309 | 439 md5_state_t st; |
440 md5_byte_t di[16]; | |
441 int i; | |
442 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
443 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
444 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
445 |
5309 | 446 md5_init(&st); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
447 md5_append(&st, (const md5_byte_t *)cmd->params[1], strlen(cmd->params[1])); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
448 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
449 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
450 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
451 challenge_resp = "VT6PX?UQTM4WM%YR"; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
452 challenge_str = "PROD0038W!61ZTF9"; |
6701
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 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
455 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
456 challenge_resp = "Q1P7W2E4J9R8U3S5"; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
457 challenge_str = "msmsgs@msnmsgr.com"; |
6701
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 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
460 md5_append(&st, (const md5_byte_t *)challenge_resp, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
461 strlen(challenge_resp)); |
5309 | 462 md5_finish(&st, di); |
463 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
464 for (i = 0; i < 16; i++) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
465 g_snprintf(buf + (i*2), 3, "%02x", di[i]); |
5309 | 466 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
467 trans = msn_transaction_new("QRY", "%s 32", challenge_str); |
5309 | 468 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
469 msn_transaction_set_payload(trans, buf, 32); |
5309 | 470 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
471 msn_cmdproc_send_trans(cmdproc, trans); |
5309 | 472 } |
473 | |
474 /************************************************************************** | |
475 * Buddy Lists | |
476 **************************************************************************/ | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
477 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
478 add_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 479 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
480 MsnSession *session; |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
481 MsnUser *user; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
482 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
483 GaimConnection *gc; |
5309 | 484 MsnPermitAdd *pa; |
485 GSList *sl; | |
5890
1a2fcda8a5e7
[gaim-migrate @ 6322]
Christian Hammond <chipx86@chipx86.com>
parents:
5887
diff
changeset
|
486 const char *list, *passport, *group_id = NULL; |
7162 | 487 const char *friend; |
5309 | 488 char msg[MSN_BUF_LEN]; |
489 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
490 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
491 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
492 gc = gaim_account_get_connection(account); |
5309 | 493 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
494 list = cmd->params[1]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
495 passport = cmd->params[3]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
496 friend = gaim_url_decode(cmd->params[4]); |
5309 | 497 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
498 if (cmd->param_count >= 6) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
499 group_id = cmd->params[5]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
500 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
501 if (!g_ascii_strcasecmp(list, "FL")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
502 { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
503 user = msn_user_new(session, passport, NULL); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
504 |
5933
44eb6d75a5c6
[gaim-migrate @ 6373]
Christian Hammond <chipx86@chipx86.com>
parents:
5918
diff
changeset
|
505 if (group_id != NULL) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
506 msn_user_add_group_id(user, atoi(group_id)); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
507 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
508 add_buddy(cmdproc, user); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
509 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
510 return; |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
511 } |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
512 else if (g_ascii_strcasecmp(list, "RL")) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
513 return; |
5309 | 514 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
515 for (sl = gc->account->permit; sl != NULL; sl = sl->next) |
5309 | 516 if (!gaim_utf8_strcasecmp(sl->data, passport)) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
517 return; |
5309 | 518 |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
519 user = msn_user_new(session, passport, friend); |
7941
14b8dc2f5408
[gaim-migrate @ 8612]
Christian Hammond <chipx86@chipx86.com>
parents:
7934
diff
changeset
|
520 msn_user_set_name(user, friend); |
5457
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
521 |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
522 pa = g_new0(MsnPermitAdd, 1); |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
523 pa->user = user; |
c8c290021b7b
[gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
524 pa->gc = gc; |
5309 | 525 |
526 g_snprintf(msg, sizeof(msg), | |
527 _("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
|
528 passport, friend, gaim_account_get_username(account)); |
5309 | 529 |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
530 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
531 _("Authorize"), G_CALLBACK(msn_accept_add_cb), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
532 _("Deny"), G_CALLBACK(msn_cancel_add_cb)); |
5309 | 533 } |
534 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
535 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
536 add_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
537 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
538 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
539 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
540 GaimConnection *gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
541 const char *list, *passport; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
542 char *reason; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
543 char *msg = NULL; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
544 char **params; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
545 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
546 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
547 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
548 gc = gaim_account_get_connection(account); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
549 params = g_strsplit(trans->params, " ", 0); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
550 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
551 list = params[0]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
552 passport = params[1]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
553 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
554 reason = "invalid user"; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
555 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
556 if (!strcmp(list, "FL")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
557 msg = g_strdup("Unable to add user on MSN"); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
558 else if (!strcmp(list, "BL")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
559 msg = g_strdup("Unable to block user on MSN"); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
560 else if (!strcmp(list, "AL")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
561 msg = g_strdup("Unable to permit user on MSN"); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
562 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
563 if (!strcmp(list, "FL")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
564 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
565 reason = g_strdup_printf("%s is not a valid passport account.\n\n" |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
566 "This user will be automatically removed " |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
567 "from your %s account's buddy list, so this " |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
568 "won't appear again.", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
569 passport, gaim_account_get_username(account)); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
570 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
571 else |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
572 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
573 reason = g_strdup_printf("%s is not a valid passport account.", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
574 passport); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
575 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
576 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
577 if (msg != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
578 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
579 gaim_notify_error(gc, NULL, msg, reason); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
580 g_free(msg); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
581 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
582 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
583 if (!strcmp(list, "FL")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
584 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
585 GaimBuddy *buddy; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
586 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
587 buddy = gaim_find_buddy(account, passport); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
588 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
589 if (buddy != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
590 gaim_blist_remove_buddy(buddy); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
591 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
592 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
593 g_free(reason); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
594 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
595 g_strfreev(params); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
596 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
597 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
598 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
599 adg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
600 { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
601 MsnGroup *group; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
602 MsnSession *session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
603 gint group_id; |
7162 | 604 const char *group_name; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
605 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
606 session = cmdproc->session; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
607 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
608 group_id = atoi(cmd->params[3]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
609 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
610 group_name = gaim_url_decode(cmd->params[2]); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
611 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
612 group = msn_group_new(session, group_id, group_name); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
613 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
614 msn_groups_add(session->groups, group); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
615 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
616 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
617 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
618 blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 619 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
620 GaimConnection *gc; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
621 const char *list_name; |
5309 | 622 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
623 gc = cmdproc->session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
624 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
625 if (cmdproc->session->protocol_ver >= 8) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
626 list_name = cmd->params[0]; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
627 else |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
628 list_name = cmd->params[2]; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
629 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
630 if (!g_ascii_strcasecmp(list_name, "AL")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
631 { |
5309 | 632 /* |
633 * If the current setting is AL, messages from users who | |
634 * are not in BL will be delivered. | |
635 * | |
636 * In other words, deny some. | |
637 */ | |
8175 | 638 gc->account->perm_deny = GAIM_PRIVACY_DENY_USERS; |
5309 | 639 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
640 else |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
641 { |
5309 | 642 /* If the current setting is BL, only messages from people |
643 * who are in the AL will be delivered. | |
644 * | |
645 * In other words, permit some. | |
646 */ | |
8175 | 647 gc->account->perm_deny = GAIM_PRIVACY_ALLOW_USERS; |
5309 | 648 } |
649 } | |
650 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
651 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
652 bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
653 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
654 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
655 GaimConnection *gc; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
656 const char *passport, *type, *value; |
6695 | 657 GaimBuddy *b; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
658 MsnUser *user; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
659 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
660 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
661 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
662 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
663 if (cmd->param_count == 4) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
664 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
665 passport = cmd->params[1]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
666 type = cmd->params[2]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
667 value = cmd->params[3]; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
668 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
669 else if (cmd->param_count == 2) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
670 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
671 passport = msn_user_get_passport(session->last_user_added); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
672 type = cmd->params[0]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
673 value = cmd->params[1]; |
6701
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 else |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
676 return; |
5963
eb336b2c451f
[gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
677 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
678 user = msn_users_find_with_passport(session->users, passport); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
679 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
680 if (value != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
681 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
682 if (!strcmp(type, "MOB")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
683 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
684 if (!strcmp(value, "Y") || !strcmp(value, "N")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
685 { |
8255
4de49af535b3
[gaim-migrate @ 8978]
Christian Hammond <chipx86@chipx86.com>
parents:
8175
diff
changeset
|
686 user->mobile = (!strcmp(value, "Y") ? TRUE : FALSE); |
5375
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
687 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
688 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
689 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
690 if (GAIM_BUDDY_IS_ONLINE(b)) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
691 { |
5375
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
692 serv_got_update(gc, (char *)passport, |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
693 1, 0, 0, 0, b->uc); |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
694 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
695 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
696 } |
d8ebee2f749c
[gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents:
5373
diff
changeset
|
697 } |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
698 else if (!strcmp(type, "PHH")) |
7134 | 699 msn_user_set_home_phone(user, gaim_url_decode(value)); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
700 else if (!strcmp(type, "PHW")) |
7134 | 701 msn_user_set_work_phone(user, gaim_url_decode(value)); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
702 else if (!strcmp(type, "PHM")) |
7134 | 703 msn_user_set_mobile_phone(user, gaim_url_decode(value)); |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
704 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
705 } |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
706 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
707 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
708 fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 709 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
710 GaimConnection *gc; |
5309 | 711 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
712 gc = cmdproc->session->account->gc; |
5309 | 713 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
714 serv_got_update(gc, (char *)cmd->params[0], 0, 0, 0, 0, 0); |
5309 | 715 } |
716 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
717 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
718 iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 719 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
720 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
721 GaimConnection *gc; |
6800
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
722 MsnUser *user; |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
723 MsnObject *msnobj; |
5309 | 724 int status = 0; |
725 const char *state, *passport, *friend; | |
6695 | 726 GaimBuddy *b; |
5309 | 727 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
728 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
729 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
730 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
731 state = cmd->params[1]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
732 passport = cmd->params[2]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
733 friend = gaim_url_decode(cmd->params[3]); |
5309 | 734 |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
735 user = msn_users_find_with_passport(session->users, passport); |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
736 |
6833
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
737 serv_got_alias(gc, (char *)passport, (char *)friend); |
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
738 |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
739 msn_user_set_name(user, friend); |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
740 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
741 if (session->protocol_ver >= 9 && cmd->param_count == 6) |
6800
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
742 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
743 msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[5])); |
6800
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
744 msn_user_set_object(user, msnobj); |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
745 } |
8f228a7d5076
[gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents:
6779
diff
changeset
|
746 |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
747 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
748 status |= ((((b->uc) >> 1) & 0xF0) << 1); |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5358
diff
changeset
|
749 |
5309 | 750 if (!g_ascii_strcasecmp(state, "BSY")) |
751 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
752 else if (!g_ascii_strcasecmp(state, "IDL")) | |
753 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
754 else if (!g_ascii_strcasecmp(state, "BRB")) | |
755 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
756 else if (!g_ascii_strcasecmp(state, "AWY")) | |
757 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
758 else if (!g_ascii_strcasecmp(state, "PHN")) | |
759 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
760 else if (!g_ascii_strcasecmp(state, "LUN")) | |
761 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
762 | |
763 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
764 } | |
765 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
766 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
767 ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
768 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
769 cmdproc->payload_cb = NULL; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
770 cmdproc->servconn->payload_len = atoi(cmd->params[2]); |
5960
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
771 } |
03bf7c905782
[gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents:
5933
diff
changeset
|
772 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
773 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
774 lsg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 775 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
776 MsnSession *session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
777 MsnGroup *group; |
6695 | 778 GaimGroup *g; |
5309 | 779 const char *name; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
780 int num_groups, group_id; |
5309 | 781 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
782 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
783 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
784 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
785 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
786 group_id = atoi(cmd->params[0]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
787 name = gaim_url_decode(cmd->params[1]); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
788 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
789 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
790 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
791 num_groups = atoi(cmd->params[3]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
792 group_id = atoi(cmd->params[4]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
793 name = gaim_url_decode(cmd->params[5]); |
5309 | 794 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
795 if (num_groups == 0) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
796 return; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
797 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
798 if (!strcmp(name, "~")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
799 name = _("Buddies"); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
800 } |
5323
29754a7d94e5
[gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
801 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
802 group = msn_group_new(session, group_id, name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
803 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
804 msn_groups_add(session->groups, group); |
5309 | 805 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
806 if ((g = gaim_find_group(name)) == NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
807 { |
5309 | 808 g = gaim_group_new(name); |
809 gaim_blist_add_group(g, NULL); | |
810 } | |
811 } | |
812 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
813 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
814 lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 815 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
816 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
817 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
818 GaimConnection *gc; |
5768 | 819 const char *passport = NULL; |
820 const char *friend = NULL; | |
5309 | 821 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
822 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
823 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
824 gc = gaim_account_get_connection(account); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
825 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
826 if (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
827 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
828 const char *group_nums; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
829 int list_op; |
5309 | 830 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
831 passport = cmd->params[0]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
832 friend = gaim_url_decode(cmd->params[1]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
833 list_op = atoi(cmd->params[2]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
834 group_nums = cmd->params[3]; |
5309 | 835 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
836 if (list_op & MSN_LIST_FL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
837 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
838 MsnUser *user; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
839 char **c; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
840 char **tokens; |
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 user = msn_user_new(session, passport, friend); |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
843 |
7934
28609aa6c865
[gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents:
7820
diff
changeset
|
844 /* Ensure we have a friendly name set. */ |
28609aa6c865
[gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents:
7820
diff
changeset
|
845 msn_user_set_name(user, friend); |
28609aa6c865
[gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents:
7820
diff
changeset
|
846 |
8029 | 847 tokens = g_strsplit((group_nums ? group_nums : ""), ",", -1); |
5309 | 848 |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
849 gaim_debug_misc("msn", "Fetching group IDs from '%s'\n", |
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
850 group_nums); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
851 for (c = tokens; *c != NULL; c++) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
852 { |
6767
926d539938ca
[gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
853 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
|
854 msn_user_add_group_id(user, atoi(*c)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
855 } |
5309 | 856 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
857 g_strfreev(tokens); |
5309 | 858 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
859 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
860 g_slist_append(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
861 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
862 session->last_user_added = user; |
5309 | 863 } |
864 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
865 if (list_op & MSN_LIST_AL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
866 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
867 /* These are users who are allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
868 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
869 if (g_slist_find_custom(account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
870 (GCompareFunc)strcmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
871 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
872 gaim_privacy_deny_remove(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
873 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
874 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
875 gaim_privacy_permit_add(account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
876 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
877 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
878 if (list_op & MSN_LIST_BL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
879 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
880 /* These are users who are not allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
881 gaim_privacy_deny_add(account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
882 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
883 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
884 if (list_op & MSN_LIST_RL_OP) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
885 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
886 /* These are users who have us on their contact list. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
887 |
5309 | 888 gboolean new_entry = TRUE; |
889 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
890 if (g_slist_find_custom(account->permit, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
891 (GCompareFunc)g_ascii_strcasecmp) || |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
892 g_slist_find_custom(account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
893 (GCompareFunc)g_ascii_strcasecmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
894 { |
5309 | 895 new_entry = FALSE; |
896 } | |
897 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
898 if (new_entry) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
899 { |
5309 | 900 MsnPermitAdd *pa; |
901 char msg[MSN_BUF_LEN]; | |
902 | |
903 pa = g_new0(MsnPermitAdd, 1); | |
904 pa->user = msn_user_new(session, passport, friend); | |
905 pa->gc = gc; | |
906 | |
7934
28609aa6c865
[gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents:
7820
diff
changeset
|
907 /* Ensure we have a friendly name set. */ |
28609aa6c865
[gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents:
7820
diff
changeset
|
908 msn_user_set_name(pa->user, friend); |
28609aa6c865
[gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents:
7820
diff
changeset
|
909 |
5309 | 910 g_snprintf(msg, sizeof(msg), |
911 _("The user %s (%s) wants to add you to their " | |
912 "buddy list."), | |
913 msn_user_get_passport(pa->user), | |
914 msn_user_get_name(pa->user)); | |
915 | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
916 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
917 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
918 G_CALLBACK(msn_accept_add_cb), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
919 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5479
diff
changeset
|
920 G_CALLBACK(msn_cancel_add_cb)); |
5309 | 921 } |
922 } | |
923 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
924 session->num_users++; |
5309 | 925 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
926 if (session->num_users == session->total_users) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
927 { |
7590
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7566
diff
changeset
|
928 msn_user_set_buddy_icon(session->user, |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7566
diff
changeset
|
929 gaim_account_get_buddy_icon(session->account)); |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7566
diff
changeset
|
930 |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7566
diff
changeset
|
931 if (!msn_session_change_status(session, "NLN")) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
932 return; |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
933 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
934 gaim_connection_set_state(gc, GAIM_CONNECTED); |
5456
40e976d42028
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
935 serv_finish_login(gc); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
936 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
937 if (session->lists.allow == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
938 session->lists.allow = g_slist_copy(account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
939 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
940 session->lists.allow = g_slist_concat(session->lists.allow, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
941 account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
942 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
943 if (session->lists.block == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
944 session->lists.block = g_slist_copy(account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
945 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
946 session->lists.block = g_slist_concat(session->lists.block, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
947 account->deny); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
948 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
949 while (session->lists.forward != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
950 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
951 MsnUser *user = session->lists.forward->data; |
6777
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
952 GSList *buddies; |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
953 GSList *sl; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
954 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
955 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
956 g_slist_remove(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
957 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
958 add_buddy(cmdproc, user); |
6777
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
959 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
960 buddies = gaim_find_buddies(account, |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
961 msn_user_get_passport(user)); |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
962 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
963 /* Find all occurrences of this buddy in the wrong place. */ |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
964 for (sl = buddies; sl != NULL; sl = sl->next) |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
965 { |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
966 GaimBuddy *b = sl->data; |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
967 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
968 if (b->proto_data == NULL) |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
969 { |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
970 gaim_debug_warning("msn", |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
971 "Deleting misplaced user %s (%s) during sync " |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
972 "with server.\n", |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
973 b->name, gaim_find_buddys_group(b)->name); |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
974 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
975 gaim_blist_remove_buddy(b); |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
976 } |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
977 } |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
978 |
513fd80bcd2e
[gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents:
6773
diff
changeset
|
979 g_slist_free(buddies); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
980 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
981 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
982 session->syncing_lists = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
983 session->lists_synced = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
984 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
985 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
986 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
987 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
988 const char *list_name; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
989 int user_num; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
990 int num_users; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
991 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
992 list_name = cmd->params[1]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
993 user_num = atoi(cmd->params[3]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
994 num_users = atoi(cmd->params[4]); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
995 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
996 if (g_ascii_strcasecmp(list_name, "RL") && |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
997 user_num == 0 && num_users == 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
998 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
999 return; /* There are no users on this list. */ |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1000 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1001 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1002 if (num_users > 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1003 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1004 passport = cmd->params[5]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1005 friend = gaim_url_decode(cmd->params[6]); |
5309 | 1006 } |
1007 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1008 if (session->syncing_lists && session->lists_synced) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1009 return; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1010 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1011 if (!g_ascii_strcasecmp(list_name, "FL") && user_num != 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1012 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1013 /* These are users on our contact list. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1014 MsnUser *user; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1015 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1016 user = msn_user_new(session, passport, friend); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1017 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1018 if (cmd->param_count == 8) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1019 msn_user_add_group_id(user, atoi(cmd->params[7])); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1020 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1021 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1022 g_slist_append(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1023 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1024 else if (!g_ascii_strcasecmp(list_name, "AL") && user_num != 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1025 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1026 /* These are users who are allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1027 if (g_slist_find_custom(gc->account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1028 (GCompareFunc)strcmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1029 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1030 gaim_debug(GAIM_DEBUG_INFO, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1031 "Moving user from deny list to permit: %s (%s)\n", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1032 passport, friend); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1033 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1034 gaim_privacy_deny_remove(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1035 } |
5309 | 1036 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1037 gaim_privacy_permit_add(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1038 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1039 else if (!g_ascii_strcasecmp(list_name, "BL") && user_num != 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1040 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1041 /* These are users who are not allowed to see our status. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1042 gaim_privacy_deny_add(gc->account, passport, TRUE); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1043 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1044 else if (!g_ascii_strcasecmp(list_name, "RL")) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1045 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1046 /* These are users who have us on their contact list. */ |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1047 if (user_num > 0) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1048 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1049 gboolean new_entry = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1050 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1051 if (g_slist_find_custom(gc->account->permit, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1052 (GCompareFunc)g_ascii_strcasecmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1053 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1054 new_entry = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1055 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1056 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1057 if (g_slist_find_custom(gc->account->deny, passport, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1058 (GCompareFunc)g_ascii_strcasecmp)) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1059 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1060 new_entry = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1061 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1062 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1063 if (new_entry) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1064 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1065 MsnPermitAdd *pa; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1066 char msg[MSN_BUF_LEN]; |
5309 | 1067 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1068 gaim_debug(GAIM_DEBUG_WARNING, "msn", |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1069 "Unresolved MSN RL entry: %s\n", passport); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1070 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1071 pa = g_new0(MsnPermitAdd, 1); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1072 pa->user = msn_user_new(session, passport, friend); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1073 pa->gc = gc; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1074 |
7941
14b8dc2f5408
[gaim-migrate @ 8612]
Christian Hammond <chipx86@chipx86.com>
parents:
7934
diff
changeset
|
1075 msn_user_set_name(pa->user, friend); |
14b8dc2f5408
[gaim-migrate @ 8612]
Christian Hammond <chipx86@chipx86.com>
parents:
7934
diff
changeset
|
1076 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1077 g_snprintf(msg, sizeof(msg), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1078 _("The user %s (%s) wants to add you to their " |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1079 "buddy list."), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1080 msn_user_get_passport(pa->user), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1081 msn_user_get_name(pa->user)); |
5309 | 1082 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1083 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1084 _("Authorize"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1085 G_CALLBACK(msn_accept_add_cb), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1086 _("Deny"), |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1087 G_CALLBACK(msn_cancel_add_cb)); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1088 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1089 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1090 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1091 if (user_num != num_users) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1092 return; /* This isn't the last one in the RL. */ |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1093 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1094 /* 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
|
1095 if (!session->lists_synced) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1096 { |
7590
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7566
diff
changeset
|
1097 if (!msn_session_change_status(session, "NLN")) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1098 return; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1099 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1100 gaim_connection_set_state(gc, GAIM_CONNECTED); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1101 serv_finish_login(gc); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1102 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1103 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1104 if (session->lists.allow == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1105 session->lists.allow = g_slist_copy(gc->account->permit); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1106 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1107 session->lists.allow = g_slist_concat(session->lists.allow, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1108 gc->account->permit); |
5406
9acf4832c0dc
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5385
diff
changeset
|
1109 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1110 if (session->lists.block == NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1111 session->lists.block = g_slist_copy(gc->account->deny); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1112 else |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1113 session->lists.block = g_slist_concat(session->lists.block, |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1114 gc->account->deny); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1115 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1116 while (session->lists.forward != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1117 { |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1118 MsnUser *user = session->lists.forward->data; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1119 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1120 session->lists.forward = |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1121 g_slist_remove(session->lists.forward, user); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1122 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1123 add_buddy(cmdproc, user); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1124 } |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1125 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1126 session->syncing_lists = FALSE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1127 session->lists_synced = TRUE; |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1128 } |
5309 | 1129 } |
1130 } | |
1131 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1132 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1133 nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 1134 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1135 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1136 GaimConnection *gc; |
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1137 MsnUser *user; |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1138 MsnObject *msnobj; |
5309 | 1139 const char *state; |
1140 const char *passport; | |
1141 const char *friend; | |
1142 int status = 0; | |
1143 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1144 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1145 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1146 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1147 state = cmd->params[0]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1148 passport = cmd->params[1]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1149 friend = gaim_url_decode(cmd->params[2]); |
5309 | 1150 |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1151 user = msn_users_find_with_passport(session->users, passport); |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1152 |
6833
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
1153 serv_got_alias(gc, (char *)passport, (char *)friend); |
ccfbd7c552ba
[gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents:
6830
diff
changeset
|
1154 |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1155 msn_user_set_name(user, friend); |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1156 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1157 if (session->protocol_ver >= 9 && cmd->param_count == 5) |
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1158 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1159 msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[4])); |
6829
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1160 msn_user_set_object(user, msnobj); |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1161 } |
dff2d0a282e7
[gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents:
6828
diff
changeset
|
1162 |
5309 | 1163 if (!g_ascii_strcasecmp(state, "BSY")) |
1164 status |= UC_UNAVAILABLE | (MSN_BUSY << 1); | |
1165 else if (!g_ascii_strcasecmp(state, "IDL")) | |
1166 status |= UC_UNAVAILABLE | (MSN_IDLE << 1); | |
1167 else if (!g_ascii_strcasecmp(state, "BRB")) | |
1168 status |= UC_UNAVAILABLE | (MSN_BRB << 1); | |
1169 else if (!g_ascii_strcasecmp(state, "AWY")) | |
1170 status |= UC_UNAVAILABLE | (MSN_AWAY << 1); | |
1171 else if (!g_ascii_strcasecmp(state, "PHN")) | |
1172 status |= UC_UNAVAILABLE | (MSN_PHONE << 1); | |
1173 else if (!g_ascii_strcasecmp(state, "LUN")) | |
1174 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); | |
1175 | |
1176 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status); | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1177 } |
5309 | 1178 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1179 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1180 not_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1181 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1182 cmdproc->payload_cb = NULL; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1183 cmdproc->servconn->payload_len = atoi(cmd->params[1]); |
5309 | 1184 } |
1185 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1186 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1187 prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5961
fc8ba872a43f
[gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents:
5960
diff
changeset
|
1188 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1189 MsnSession *session; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1190 const char *type, *value; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1191 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1192 session = cmdproc->session; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1193 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1194 type = cmd->params[2]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1195 value = cmd->params[3]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1196 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1197 if (cmd->param_count == 4) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1198 { |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1199 if (!strcmp(type, "PHH")) |
7134 | 1200 msn_user_set_home_phone(session->user, gaim_url_decode(value)); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1201 else if (!strcmp(type, "PHW")) |
7134 | 1202 msn_user_set_work_phone(session->user, gaim_url_decode(value)); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1203 else if (!strcmp(type, "PHM")) |
7134 | 1204 msn_user_set_mobile_phone(session->user, gaim_url_decode(value)); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1205 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1206 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1207 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1208 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1209 rea_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 1210 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1211 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1212 GaimConnection *gc; |
7162 | 1213 const char *friend; |
5309 | 1214 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1215 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1216 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1217 friend = gaim_url_decode(cmd->params[3]); |
5309 | 1218 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1219 gaim_connection_set_display_name(gc, friend); |
5309 | 1220 } |
1221 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1222 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1223 reg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1224 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1225 MsnSession *session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1226 MsnGroup *group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1227 int group_id; |
7162 | 1228 const char *group_name; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1229 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1230 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1231 group_id = atoi(cmd->params[2]); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1232 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1233 group_name = gaim_url_decode(cmd->params[3]); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1234 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1235 group = msn_groups_find_with_id(session->groups, group_id); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1236 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1237 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
|
1238 msn_group_get_name(group), group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1239 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1240 if (group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1241 msn_group_set_name(group, group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1242 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5312
diff
changeset
|
1243 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1244 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1245 rem_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1246 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1247 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1248 const char *passport; |
6772
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1249 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1250 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1251 passport = cmd->params[3]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1252 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1253 if (cmd->param_count == 5) |
6772
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1254 { |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1255 MsnUser *user; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1256 int group_id = atoi(cmd->params[4]); |
6772
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1257 |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1258 user = msn_users_find_with_passport(session->users, passport); |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1259 |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1260 msn_user_remove_group_id(user, group_id); |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6767
diff
changeset
|
1261 } |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1262 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1263 /* I hate this. */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1264 /* shx: it won't be here for long. */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1265 if (session->moving_buddy) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1266 { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1267 MsnGroup *group, *old_group; |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1268 const char *friendly; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1269 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1270 group = msn_groups_find_with_name(session->groups, |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1271 session->dest_group_name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1272 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1273 old_group = session->old_group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1274 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1275 session->moving_buddy = FALSE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1276 session->old_group = NULL; |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1277 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1278 if (group == NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1279 { |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1280 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1281 "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
|
1282 session->dest_group_name, passport); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1283 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1284 g_free(session->dest_group_name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1285 session->dest_group_name = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1286 } |
5327
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1287 |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1288 g_free(session->dest_group_name); |
b716ffc25d2d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5326
diff
changeset
|
1289 session->dest_group_name = NULL; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1290 |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1291 if ((friendly = msn_user_get_name(session->moving_user)) == NULL) |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1292 friendly = passport; |
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6833
diff
changeset
|
1293 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1294 msn_cmdproc_send(cmdproc, "ADD", "FL %s %s %d", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1295 passport, gaim_url_encode(friendly), |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1296 msn_group_get_id(group)); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1297 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1298 if (cmdproc->error) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1299 return; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1300 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1301 if (old_group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1302 msn_group_remove_user(old_group, session->moving_user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1303 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1304 msn_user_unref(session->moving_user); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1305 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1306 session->moving_user = NULL; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1307 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1308 if (old_group != NULL && |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1309 msn_users_get_count(msn_group_get_users(old_group)) <= 0) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1310 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1311 msn_cmdproc_send(cmdproc, "REM", "%s", "%d", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1312 msn_group_get_id(old_group)); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1313 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1314 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1315 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1316 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1317 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1318 rmg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1319 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1320 MsnSession *session; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1321 MsnGroup *group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1322 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1323 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1324 group = msn_groups_find_with_id(session->groups, atoi(cmd->params[2])); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1325 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1326 if (group != NULL) |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1327 msn_groups_remove(session->groups, group); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1328 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5509
diff
changeset
|
1329 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1330 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1331 syn_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1332 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1333 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1334 GaimConnection *gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1335 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1336 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1337 gc = gaim_account_get_connection(session->account); |
6701
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 (session->protocol_ver >= 8) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1340 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1341 if (cmd->param_count == 2) |
8613
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1342 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1343 char *buf; |
8613
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1344 |
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1345 /* |
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1346 * This can happen if we sent a SYN with an up-to-date |
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1347 * buddy list revision, but we send 0 to get a full list. |
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1348 * So, error out. |
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1349 */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1350 buf = g_strdup_printf( |
8613
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1351 _("Your MSN buddy list for %s is temporarily unavailable. " |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1352 "Please wait and try again."), |
8614
563d47350c7e
[gaim-migrate @ 9365]
Christian Hammond <chipx86@chipx86.com>
parents:
8613
diff
changeset
|
1353 gaim_account_get_username(session->account)); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1354 |
8613
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1355 gaim_connection_error(gc, buf); |
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1356 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1357 g_free(buf); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1358 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1359 return; |
8613
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1360 } |
b0ceb2a9e122
[gaim-migrate @ 9364]
Christian Hammond <chipx86@chipx86.com>
parents:
8583
diff
changeset
|
1361 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1362 session->total_users = atoi(cmd->params[2]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1363 session->total_groups = atoi(cmd->params[3]); |
7289
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1364 |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1365 if (session->total_users == 0) |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1366 { |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1367 gaim_connection_set_state(gc, GAIM_CONNECTED); |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1368 serv_finish_login(gc); |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1369 |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1370 session->syncing_lists = FALSE; |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1371 session->lists_synced = TRUE; |
ab2085024a29
[gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
1372 } |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1373 } |
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 |
5309 | 1376 /************************************************************************** |
1377 * Misc commands | |
1378 **************************************************************************/ | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1379 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1380 url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 1381 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1382 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1383 GaimAccount *account; |
5309 | 1384 const char *rru; |
1385 const char *url; | |
1386 md5_state_t st; | |
1387 md5_byte_t di[16]; | |
1388 FILE *fd; | |
1389 char buf[2048]; | |
1390 char buf2[3]; | |
1391 char sendbuf[64]; | |
1392 int i; | |
1393 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1394 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1395 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1396 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1397 rru = cmd->params[1]; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1398 url = cmd->params[2]; |
5309 | 1399 |
1400 g_snprintf(buf, sizeof(buf), "%s%lu%s", | |
1401 session->passport_info.mspauth, | |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1402 time(NULL) - session->passport_info.sl, |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1403 gaim_account_get_password(account)); |
5309 | 1404 |
1405 md5_init(&st); | |
1406 md5_append(&st, (const md5_byte_t *)buf, strlen(buf)); | |
1407 md5_finish(&st, di); | |
1408 | |
1409 memset(sendbuf, 0, sizeof(sendbuf)); | |
1410 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1411 for (i = 0; i < 16; i++) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1412 { |
5309 | 1413 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); |
1414 strcat(sendbuf, buf2); | |
1415 } | |
1416 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1417 if (session->passport_info.file != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1418 { |
5309 | 1419 unlink(session->passport_info.file); |
1420 g_free(session->passport_info.file); | |
1421 } | |
1422 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1423 if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1424 { |
5309 | 1425 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
1426 "Error opening temp passport file: %s\n", | |
1427 strerror(errno)); | |
1428 } | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1429 else |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1430 { |
5309 | 1431 fputs("<html>\n" |
1432 "<head>\n" | |
1433 "<noscript>\n" | |
1434 "<meta http-equiv=\"Refresh\" content=\"0; " | |
1435 "url=http://www.hotmail.com\">\n" | |
1436 "</noscript>\n" | |
1437 "</head>\n\n", | |
1438 fd); | |
1439 | |
1440 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); | |
1441 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", | |
1442 url); | |
1443 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); | |
1444 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1445 gaim_account_get_username(account)); |
5309 | 1446 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1447 gaim_account_get_username(account)); |
5309 | 1448 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", |
1449 session->passport_info.sid); | |
1450 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", | |
1451 session->passport_info.kv); | |
1452 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); | |
1453 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", | |
1454 time(NULL) - session->passport_info.sl); | |
1455 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", | |
1456 rru); | |
1457 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", | |
1458 session->passport_info.mspauth); | |
1459 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", | |
1460 sendbuf); /* TODO Digest me (huh? -- ChipX86) */ | |
1461 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); | |
7699 | 1462 fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n"); |
5309 | 1463 fprintf(fd, "</form></body>\n"); |
1464 fprintf(fd, "</html>\n"); | |
1465 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1466 if (fclose(fd)) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1467 { |
5309 | 1468 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
1469 "Error closing temp passport file: %s\n", | |
1470 strerror(errno)); | |
1471 | |
1472 unlink(session->passport_info.file); | |
1473 g_free(session->passport_info.file); | |
1474 } | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1475 else |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1476 { |
5309 | 1477 /* |
1478 * Renaming file with .html extension, so that the | |
1479 * win32 open_url will work. | |
1480 */ | |
1481 char *tmp; | |
1482 | |
1483 if ((tmp = g_strdup_printf("%s.html", | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1484 session->passport_info.file)) != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1485 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1486 if (rename(session->passport_info.file, tmp) == 0) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1487 { |
5309 | 1488 g_free(session->passport_info.file); |
1489 session->passport_info.file = tmp; | |
1490 } | |
1491 else | |
1492 g_free(tmp); | |
1493 } | |
1494 } | |
1495 } | |
1496 } | |
1497 /************************************************************************** | |
1498 * Switchboards | |
1499 **************************************************************************/ | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1500 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1501 rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 1502 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1503 MsnSession *session; |
5309 | 1504 MsnSwitchBoard *swboard; |
1505 MsnUser *user; | |
1506 const char *session_id; | |
1507 char *host, *c; | |
1508 int port; | |
1509 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1510 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1511 session_id = cmd->params[0]; |
5309 | 1512 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1513 host = g_strdup(cmd->params[1]); |
5309 | 1514 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1515 if ((c = strchr(host, ':')) != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1516 { |
5309 | 1517 *c = '\0'; |
1518 port = atoi(c + 1); | |
1519 } | |
1520 else | |
1521 port = 1863; | |
1522 | |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1523 if (session->http_method) |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1524 port = 80; |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1525 |
5309 | 1526 swboard = msn_switchboard_new(session); |
1527 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1528 user = msn_user_new(session, cmd->params[4], NULL); |
5309 | 1529 |
1530 msn_switchboard_set_invited(swboard, TRUE); | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1531 msn_switchboard_set_session_id(swboard, cmd->params[0]); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1532 msn_switchboard_set_auth_key(swboard, cmd->params[3]); |
5309 | 1533 msn_switchboard_set_user(swboard, user); |
1534 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1535 if (!msn_switchboard_connect(swboard, host, port)) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1536 { |
5309 | 1537 gaim_debug(GAIM_DEBUG_ERROR, "msn", |
1538 "Unable to connect to switchboard on %s, port %d\n", | |
1539 host, port); | |
1540 | |
1541 g_free(host); | |
1542 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1543 return; |
5309 | 1544 } |
1545 | |
1546 g_free(host); | |
1547 } | |
1548 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1549 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1550 xfr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) |
5309 | 1551 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1552 MsnSession *session; |
5309 | 1553 MsnSwitchBoard *swboard; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1554 GaimConnection *gc; |
5309 | 1555 char *host; |
1556 char *c; | |
1557 int port; | |
1558 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1559 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1560 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1561 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1562 if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1563 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1564 gaim_connection_error(gc, _("Got invalid XFR")); |
7188
2ff225547cf4
[gaim-migrate @ 7757]
Christian Hammond <chipx86@chipx86.com>
parents:
7162
diff
changeset
|
1565 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1566 return; |
5309 | 1567 } |
1568 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1569 host = g_strdup(cmd->params[2]); |
5309 | 1570 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1571 if ((c = strchr(host, ':')) != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1572 { |
5309 | 1573 *c = '\0'; |
1574 port = atoi(c + 1); | |
1575 } | |
1576 else | |
1577 port = 1863; | |
1578 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1579 if (!strcmp(cmd->params[1], "SB")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1580 { |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1581 swboard = msn_session_find_unused_switch(session); |
5309 | 1582 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1583 if (swboard == NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1584 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1585 gaim_debug_error("msn", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1586 "Received an XFR SB request when there's no unused " |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1587 "switchboards!\n"); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1588 return; |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1589 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1590 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1591 msn_switchboard_set_auth_key(swboard, cmd->params[4]); |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1592 |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1593 if (session->http_method) |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1594 port = 80; |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1595 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1596 if (!msn_switchboard_connect(swboard, host, port)) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1597 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1598 gaim_debug_error("msn", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1599 "Unable to connect to switchboard on %s, port %d\n", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1600 host, port); |
5309 | 1601 |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1602 g_free(host); |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1603 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1604 return; |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1605 } |
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1606 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1607 else if (!strcmp(cmd->params[1], "NS")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1608 { |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1609 if (!msn_notification_connect(session->notification_conn, host, |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1610 port)) |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1611 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1612 gaim_connection_error(gc, _("Unable to transfer to " |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
1613 "notification server")); |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
1614 |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8614
diff
changeset
|
1615 g_free(host); |
5309 | 1616 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1617 return; |
5385
150cf1615098
[gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents:
5375
diff
changeset
|
1618 } |
5309 | 1619 } |
1620 | |
1621 g_free(host); | |
1622 } | |
1623 | |
1624 /************************************************************************** | |
1625 * Message Types | |
1626 **************************************************************************/ | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1627 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1628 profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
5309 | 1629 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1630 MsnSession *session; |
5309 | 1631 const char *value; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1632 const char *passport; |
5309 | 1633 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1634 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1635 passport = msg->passport; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1636 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1637 if (strcmp(passport, "Hotmail")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1638 { |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1639 /* This isn't an official message. */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1640 return; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1641 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1642 |
5309 | 1643 if ((value = msn_message_get_attr(msg, "kv")) != NULL) |
1644 session->passport_info.kv = g_strdup(value); | |
1645 | |
1646 if ((value = msn_message_get_attr(msg, "sid")) != NULL) | |
1647 session->passport_info.sid = g_strdup(value); | |
1648 | |
1649 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) | |
1650 session->passport_info.mspauth = g_strdup(value); | |
1651 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1652 if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1653 session->passport_info.client_ip = g_strdup(value); |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1654 |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1655 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1656 session->passport_info.client_port = ntohs(atoi(value)); |
5309 | 1657 } |
1658 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1659 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1660 initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
5309 | 1661 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1662 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1663 GaimConnection *gc; |
5309 | 1664 GHashTable *table; |
1665 const char *unread; | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1666 const char *passport; |
5309 | 1667 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1668 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1669 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1670 passport = msg->passport; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1671 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1672 if (strcmp(passport, "Hotmail")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1673 { |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1674 /* This isn't an official message. */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1675 return; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1676 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1677 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1678 if (!gaim_account_get_check_mail(session->account)) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1679 return; |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1680 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1681 if (session->passport_info.file == NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1682 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1683 msn_cmdproc_send(cmdproc, "URL", "%s", "INBOX"); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1684 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1685 msn_cmdproc_queue_message(cmdproc, "URL", msg); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1686 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1687 return; |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1688 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1689 |
5309 | 1690 table = msn_message_get_hashtable_from_body(msg); |
1691 | |
1692 unread = g_hash_table_lookup(table, "Inbox-Unread"); | |
1693 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1694 if (unread != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1695 { |
7190
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1696 int count = atoi(unread); |
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1697 |
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1698 if (count != 0) |
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1699 { |
7699 | 1700 const char *passport = msn_user_get_passport(session->user); |
1701 const char *file = session->passport_info.file; | |
1702 gchar *url; | |
1703 while (*file && *file == '/') | |
1704 ++file; | |
1705 url = g_strconcat ("file:///", file, 0); | |
7820 | 1706 gaim_notify_emails(gc, count, FALSE, NULL, NULL, |
1707 &passport, (const char **)&url, NULL, NULL); | |
7699 | 1708 g_free (url); |
7190
13c725566078
[gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents:
7188
diff
changeset
|
1709 } |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1710 } |
5309 | 1711 |
1712 g_hash_table_destroy(table); | |
1713 } | |
1714 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1715 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1716 email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
5309 | 1717 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1718 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1719 GaimConnection *gc; |
5309 | 1720 GHashTable *table; |
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1721 char *from, *subject, *tmp; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1722 const char *passport; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1723 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1724 session = cmdproc->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1725 gc = session->account->gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1726 passport = msg->passport; |
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1727 |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1728 from = subject = NULL; |
5309 | 1729 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1730 if (strcmp(passport, "Hotmail")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1731 { |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1732 /* This isn't an official message. */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1733 return; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1734 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1735 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1736 if (!gaim_account_get_check_mail(session->account)) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1737 return; |
5520
11be8ae32937
[gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1738 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1739 if (session->passport_info.file == NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1740 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1741 msn_cmdproc_send(cmdproc, "URL", "%s", "INBOX"); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1742 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1743 msn_cmdproc_queue_message(cmdproc, "URL", msg); |
5506
4f72b611f0ee
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1744 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1745 return; |
5358
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1746 } |
91db34a45cbe
[gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents:
5353
diff
changeset
|
1747 |
5309 | 1748 table = msn_message_get_hashtable_from_body(msg); |
1749 | |
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1750 tmp = g_hash_table_lookup(table, "From"); |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1751 if (tmp != NULL) |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1752 from = gaim_mime_decode_field(tmp); |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1753 |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1754 tmp = g_hash_table_lookup(table, "Subject"); |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1755 if (tmp != NULL) |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1756 subject = gaim_mime_decode_field(tmp); |
5309 | 1757 |
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1758 if (from != NULL && subject != NULL) |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1759 gaim_notify_email(gc, subject, from, msn_user_get_passport(session->user), |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1760 session->passport_info.file, NULL, NULL); |
5309 | 1761 |
8657
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1762 if (from != NULL) |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1763 g_free(from); |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1764 |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1765 if (subject != NULL) |
4a1e87c50d6f
[gaim-migrate @ 9409]
Christian Hammond <chipx86@chipx86.com>
parents:
8652
diff
changeset
|
1766 g_free(subject); |
7817 | 1767 |
5309 | 1768 g_hash_table_destroy(table); |
1769 } | |
1770 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1771 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1772 system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1773 { |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1774 GHashTable *table; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1775 const char *type_s; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1776 const char *passport; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1777 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1778 passport = msg->passport; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1779 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1780 if (strcmp(passport, "Hotmail")) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1781 { |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1782 /* This isn't an official message. */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1783 return; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1784 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1785 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1786 table = msn_message_get_hashtable_from_body(msg); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1787 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1788 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1789 { |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1790 int type = atoi(type_s); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1791 char buf[MSN_BUF_LEN]; |
6308 | 1792 int minutes; |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1793 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1794 switch (type) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1795 { |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1796 case 1: |
6308 | 1797 minutes = atoi(g_hash_table_lookup(table, "Arg1")); |
1798 g_snprintf(buf, sizeof(buf), ngettext( | |
1799 "The MSN server will shut down for maintenance " | |
1800 "in %d minute. You will automatically be " | |
1801 "signed out at that time. Please finish any " | |
1802 "conversations in progress.\n\nAfter the " | |
1803 "maintenance has been completed, you will be " | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1804 "able to successfully sign in.", |
6308 | 1805 "The MSN server will shut down for maintenance " |
1806 "in %d minutes. You will automatically be " | |
1807 "signed out at that time. Please finish any " | |
1808 "conversations in progress.\n\nAfter the " | |
1809 "maintenance has been completed, you will be " | |
1810 "able to successfully sign in.", minutes), | |
1811 minutes); | |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1812 default: |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1813 break; |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1814 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1815 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
1816 if (*buf != '\0') |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1817 gaim_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1818 } |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1819 |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1820 g_hash_table_destroy(table); |
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1821 } |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1822 |
5333
bbbf616bd924
[gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1823 static gboolean |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1824 connect_cb(MsnServConn *servconn) |
5309 | 1825 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1826 MsnCmdProc *cmdproc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1827 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1828 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1829 GaimConnection *gc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1830 char **a, **c, *vers; |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1831 size_t i; |
5309 | 1832 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1833 g_return_val_if_fail(servconn != NULL, FALSE); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1834 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1835 cmdproc = servconn->cmdproc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1836 session = servconn->session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1837 account = session->account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1838 gc = gaim_account_get_connection(account); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1839 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1840 /* Allocate an array for CVR0, NULL, and all the versions */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1841 a = c = g_new0(char *, session->protocol_ver - 8 + 3); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1842 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1843 for (i = session->protocol_ver; i >= 8; i--) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1844 *c++ = g_strdup_printf("MSNP%d", i); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1845 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1846 *c++ = g_strdup("CVR0"); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1847 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1848 vers = g_strjoinv(" ", a); |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1849 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1850 msn_cmdproc_send(cmdproc, "VER", "%s", vers); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1851 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1852 g_strfreev(a); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1853 g_free(vers); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1854 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1855 if (cmdproc->error) |
5309 | 1856 return FALSE; |
1857 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5520
diff
changeset
|
1858 session->user = msn_user_new(session, |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1859 gaim_account_get_username(account), NULL); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1860 |
5566
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1861 gaim_connection_update_progress(gc, _("Syncing with server"), |
9896e9068bc4
[gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
1862 4, MSN_CONNECT_STEPS); |
5309 | 1863 |
1864 return TRUE; | |
1865 } | |
1866 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1867 void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1868 msn_notification_init(void) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1869 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1870 cbs_table = msn_table_new(); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1871 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1872 /* Register the command callbacks. */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1873 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1874 /* Syncing */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1875 msn_table_add_cmd(cbs_table, NULL, "GTC", NULL); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1876 msn_table_add_cmd(cbs_table, NULL, "BLP", blp_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1877 msn_table_add_cmd(cbs_table, NULL, "PRP", prp_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1878 msn_table_add_cmd(cbs_table, NULL, "LSG", lsg_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1879 msn_table_add_cmd(cbs_table, NULL, "LST", lst_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1880 msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1881 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1882 /* Syncronous */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1883 /* msn_table_add_cmd(cbs_table, "CHG", "CHG", chg_cmd); */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1884 msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1885 msn_table_add_cmd(cbs_table, "ADD", "ADD", add_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1886 msn_table_add_cmd(cbs_table, "ADD", "ILN", iln_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1887 msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1888 msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1889 msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1890 msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1891 msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1892 msn_table_add_cmd(cbs_table, "INF", "INF", inf_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1893 msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1894 msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1895 /* msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1896 /* msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1897 msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1898 msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1899 msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1900 msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1901 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1902 /* Asyncronous */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1903 msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1904 msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1905 msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1906 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1907 msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1908 msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1909 msn_table_add_cmd(cbs_table, NULL, "ADD", add_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1910 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1911 msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1912 msn_table_add_cmd(cbs_table, NULL, "QNG", NULL); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1913 msn_table_add_cmd(cbs_table, NULL, "FLN", fln_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1914 msn_table_add_cmd(cbs_table, NULL, "NLN", nln_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1915 msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1916 msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1917 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1918 msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1919 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1920 msn_table_add_error(cbs_table, "ADD", add_error); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1921 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1922 /* Register the message type callbacks. */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1923 msn_table_add_msg_type(cbs_table, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1924 "text/x-msmsgsprofile", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1925 profile_msg); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1926 msn_table_add_msg_type(cbs_table, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1927 "text/x-msmsgsinitialemailnotification", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1928 initial_email_msg); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1929 msn_table_add_msg_type(cbs_table, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1930 "text/x-msmsgsemailnotification", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1931 email_msg); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1932 msn_table_add_msg_type(cbs_table, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1933 "application/x-msmsgssystemmessage", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1934 system_msg); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1935 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1936 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1937 void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1938 msn_notification_end(void) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1939 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1940 msn_table_destroy(cbs_table); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1941 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1942 |
5309 | 1943 MsnServConn * |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1944 msn_notification_new(MsnSession *session) |
5309 | 1945 { |
1946 MsnServConn *notification; | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1947 MsnCmdProc *cmdproc; |
5309 | 1948 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1949 notification = msn_servconn_new(session, MSN_SERVER_NS); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1950 cmdproc = notification->cmdproc; |
5309 | 1951 |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5768
diff
changeset
|
1952 msn_servconn_set_connect_cb(notification, connect_cb); |
5309 | 1953 |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1954 if (session->http_method) |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1955 notification->http_data->server_type = "NS"; |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7274
diff
changeset
|
1956 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8669
diff
changeset
|
1957 cmdproc->cbs_table = cbs_table; |
5309 | 1958 |
1959 return notification; | |
1960 } | |
8583
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1961 |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1962 gboolean |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1963 msn_notification_connect(MsnServConn *notification, const char *host, int port) |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1964 { |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1965 g_return_val_if_fail(notification != NULL, FALSE); |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1966 |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1967 return msn_servconn_connect(notification, host, port); |
fc27237783ee
[gaim-migrate @ 9333]
Christian Hammond <chipx86@chipx86.com>
parents:
8569
diff
changeset
|
1968 } |