annotate src/protocols/msn/notification.c @ 7566:b43cc6a7936e

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