annotate src/protocols/msn/notification.c @ 7941:14b8dc2f5408

[gaim-migrate @ 8612] We're setting the friendly name manually in more places. Fixes bug #864327 committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 27 Dec 2003 19:39:06 +0000
parents 28609aa6c865
children f82aa9301ed5
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);
7941
14b8dc2f5408 [gaim-migrate @ 8612]
Christian Hammond <chipx86@chipx86.com>
parents: 7934
diff changeset
939 msn_user_set_name(user, friend);
5457
c8c290021b7b [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
940
c8c290021b7b [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
941 pa = g_new0(MsnPermitAdd, 1);
c8c290021b7b [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
942 pa->user = user;
c8c290021b7b [gaim-migrate @ 5845]
Christian Hammond <chipx86@chipx86.com>
parents: 5456
diff changeset
943 pa->gc = gc;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
944
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
945 g_snprintf(msg, sizeof(msg),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
946 _("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
947 passport, friend, gaim_account_get_username(account));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
948
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
949 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2,
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
950 _("Authorize"), G_CALLBACK(msn_accept_add_cb),
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
951 _("Deny"), G_CALLBACK(msn_cancel_add_cb));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
952
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
953 return TRUE;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
956 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
957 adg_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
958 size_t param_count)
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
959 {
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
960 MsnGroup *group;
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
961 MsnSession *session = servconn->session;
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
962 gint group_id;
7162
d14e026611c0 [gaim-migrate @ 7729]
Nathan Walp <nwalp@pidgin.im>
parents: 7134
diff changeset
963 const char *group_name;
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
964
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
965 group_id = atoi(params[3]);
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
966
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
967 group_name = gaim_url_decode(params[2]);
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
968
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
969 group = msn_group_new(session, group_id, group_name);
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
970
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
971 msn_groups_add(session->groups, group);
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
972
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
973 return TRUE;
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
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
976 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
977 blp_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
978 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
979 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
980 GaimConnection *gc = servconn->session->account->gc;
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
981 const char *list_name;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
982
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
983 if (servconn->session->protocol_ver >= 8)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
984 list_name = params[0];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
985 else
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
986 list_name = params[2];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
987
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
988 if (!g_ascii_strcasecmp(list_name, "AL")) {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
989 /*
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
990 * If the current setting is AL, messages from users who
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
991 * are not in BL will be delivered.
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
992 *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
993 * In other words, deny some.
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
994 */
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
995 gc->account->perm_deny = DENY_SOME;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
996 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
997 else {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
998 /* If the current setting is BL, only messages from people
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
999 * who are in the AL will be delivered.
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1000 *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1001 * In other words, permit some.
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1002 */
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
1003 gc->account->perm_deny = PERMIT_SOME;
5309
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1006 return TRUE;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1009 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1010 bpr_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1011 size_t param_count)
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1012 {
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1013 MsnSession *session = servconn->session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1014 GaimConnection *gc = session->account->gc;
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1015 const char *passport, *type, *value;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6380
diff changeset
1016 GaimBuddy *b;
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1017 MsnUser *user;
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1018
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1019 if (param_count == 4)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1020 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1021 passport = params[1];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1022 type = params[2];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1023 value = params[3];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1024 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1025 else if (param_count == 2)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1026 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1027 passport = msn_user_get_passport(session->last_user_added);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1028 type = params[0];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1029 value = params[1];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1030 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1031 else
5963
eb336b2c451f [gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents: 5962
diff changeset
1032 return TRUE;
eb336b2c451f [gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents: 5962
diff changeset
1033
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1034 user = msn_users_find_with_passport(session->users, passport);
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1035
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1036 if (value != NULL) {
5375
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1037 if (!strcmp(type, "MOB")) {
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1038 if (!strcmp(value, "Y")) {
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1039 user->mobile = TRUE;
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1040
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1041 if ((b = gaim_find_buddy(gc->account, passport)) != NULL) {
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1042 if (GAIM_BUDDY_IS_ONLINE(b)) {
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1043 serv_got_update(gc, (char *)passport,
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1044 1, 0, 0, 0, b->uc);
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 }
d8ebee2f749c [gaim-migrate @ 5751]
Christian Hammond <chipx86@chipx86.com>
parents: 5373
diff changeset
1048 }
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1049 else if (!strcmp(type, "PHH"))
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1050 msn_user_set_home_phone(user, gaim_url_decode(value));
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1051 else if (!strcmp(type, "PHW"))
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1052 msn_user_set_work_phone(user, gaim_url_decode(value));
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1053 else if (!strcmp(type, "PHM"))
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1054 msn_user_set_mobile_phone(user, gaim_url_decode(value));
5361
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
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1057 return TRUE;
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
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1060 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1061 fln_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1062 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1063 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1064 GaimConnection *gc = servconn->session->account->gc;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1065
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1066 serv_got_update(gc, (char *)params[0], 0, 0, 0, 0, 0);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1067
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1068 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1069 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1070
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1071 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1072 iln_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1073 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1074 {
6800
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1075 MsnSession *session = servconn->session;
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1076 GaimConnection *gc = session->account->gc;
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1077 MsnUser *user;
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1078 MsnObject *msnobj;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1079 int status = 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1080 const char *state, *passport, *friend;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6380
diff changeset
1081 GaimBuddy *b;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1082
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1083 state = params[1];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1084 passport = params[2];
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1085 friend = gaim_url_decode(params[3]);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1086
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1087 user = msn_users_find_with_passport(session->users, passport);
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1088
6833
ccfbd7c552ba [gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents: 6830
diff changeset
1089 serv_got_alias(gc, (char *)passport, (char *)friend);
ccfbd7c552ba [gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents: 6830
diff changeset
1090
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1091 msn_user_set_name(user, friend);
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1092
6800
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1093 if (session->protocol_ver >= 9 && param_count == 6)
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1094 {
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1095 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
1096 msn_user_set_object(user, msnobj);
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1097 }
8f228a7d5076 [gaim-migrate @ 7340]
Christian Hammond <chipx86@chipx86.com>
parents: 6779
diff changeset
1098
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1099 if ((b = gaim_find_buddy(gc->account, passport)) != NULL)
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1100 status |= ((((b->uc) >> 1) & 0xF0) << 1);
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5358
diff changeset
1101
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1102 if (!g_ascii_strcasecmp(state, "BSY"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1103 status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1104 else if (!g_ascii_strcasecmp(state, "IDL"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1105 status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1106 else if (!g_ascii_strcasecmp(state, "BRB"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1107 status |= UC_UNAVAILABLE | (MSN_BRB << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1108 else if (!g_ascii_strcasecmp(state, "AWY"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1109 status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1110 else if (!g_ascii_strcasecmp(state, "PHN"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1111 status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1112 else if (!g_ascii_strcasecmp(state, "LUN"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1113 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1114
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1115 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1116
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1117 return TRUE;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1120 static gboolean
5960
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1121 ipg_cmd(MsnServConn *servconn, const char *command, const char **params,
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1122 size_t param_count)
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1123 {
5963
eb336b2c451f [gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents: 5962
diff changeset
1124 /* GaimConnection *gc = servconn->session->account->gc; */
5960
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1125
5962
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1126 servconn->parsing_multiline = TRUE;
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1127 servconn->multiline_type = MSN_MULTILINE_IPG;
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1128 servconn->multiline_len = atoi(params[0]);
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1129
5960
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1130 servconn->msg_passport = NULL;
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1131 servconn->msg_friendly = NULL;
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1132
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1133 return TRUE;
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
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
1136 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1137 lsg_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1138 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1139 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1140 MsnSession *session = servconn->session;
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1141 MsnGroup *group;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6380
diff changeset
1142 GaimGroup *g;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1143 const char *name;
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1144 int num_groups, group_id;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1145
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1146 if (session->protocol_ver >= 8)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1147 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1148 group_id = atoi(params[0]);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1149 name = gaim_url_decode(params[1]);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1150 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1151 else
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1152 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1153 num_groups = atoi(params[3]);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1154 group_id = atoi(params[4]);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1155 name = gaim_url_decode(params[5]);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1156
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1157 if (num_groups == 0)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1158 return TRUE;
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1159
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1160 if (!strcmp(name, "~"))
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1161 name = _("Buddies");
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1162 }
5323
29754a7d94e5 [gaim-migrate @ 5695]
Christian Hammond <chipx86@chipx86.com>
parents: 5322
diff changeset
1163
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1164 group = msn_group_new(session, group_id, name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1165
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1166 msn_groups_add(session->groups, group);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1167
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1168 if ((g = gaim_find_group(name)) == NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1169 g = gaim_group_new(name);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1170 gaim_blist_add_group(g, NULL);
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1173 return TRUE;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1176 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1177 lst_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1178 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1179 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1180 MsnSession *session = servconn->session;
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1181 GaimAccount *account = session->account;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1182 GaimConnection *gc = gaim_account_get_connection(account);
5768
9c367309b33c [gaim-migrate @ 6193]
Nathan Walp <nwalp@pidgin.im>
parents: 5762
diff changeset
1183 const char *passport = NULL;
9c367309b33c [gaim-migrate @ 6193]
Nathan Walp <nwalp@pidgin.im>
parents: 5762
diff changeset
1184 const char *friend = NULL;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1185
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1186 if (session->protocol_ver >= 8)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1187 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1188 const char *group_nums;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1189 int list_op;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1190
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1191 passport = params[0];
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1192 friend = gaim_url_decode(params[1]);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1193 list_op = atoi(params[2]);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1194 group_nums = params[3];
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1195
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1196 if (list_op & MSN_LIST_FL_OP)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1197 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1198 MsnUser *user;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1199 char **c;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1200 char **tokens;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1201
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1202 user = msn_user_new(session, passport, friend);
5406
9acf4832c0dc [gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents: 5385
diff changeset
1203
7934
28609aa6c865 [gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents: 7820
diff changeset
1204 /* Ensure we have a friendly name set. */
28609aa6c865 [gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents: 7820
diff changeset
1205 msn_user_set_name(user, friend);
28609aa6c865 [gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents: 7820
diff changeset
1206
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1207 tokens = g_strsplit(group_nums, ",", -1);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1208
6767
926d539938ca [gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
1209 gaim_debug_misc("msn", "Fetching group IDs from '%s'\n",
926d539938ca [gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
1210 group_nums);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1211 for (c = tokens; *c != NULL; c++)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1212 {
6767
926d539938ca [gaim-migrate @ 7304]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
1213 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
1214 msn_user_add_group_id(user, atoi(*c));
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1215 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1216
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1217 g_strfreev(tokens);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1218
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1219 session->lists.forward =
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1220 g_slist_append(session->lists.forward, user);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1221
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1222 session->last_user_added = user;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1223 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1224
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1225 if (list_op & MSN_LIST_AL_OP)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1226 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1227 /* These are users who are allowed to see our status. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1228
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1229 if (g_slist_find_custom(account->deny, passport,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1230 (GCompareFunc)strcmp))
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1231 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1232 gaim_privacy_deny_remove(gc->account, passport, TRUE);
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
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1235 gaim_privacy_permit_add(account, passport, TRUE);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1236 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1237
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1238 if (list_op & MSN_LIST_BL_OP)
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 /* These are users who are not allowed to see our status. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1241 gaim_privacy_deny_add(account, passport, TRUE);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1242 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1243
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1244 if (list_op & MSN_LIST_RL_OP)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1245 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1246 /* These are users who have us on their contact list. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1247
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1248 gboolean new_entry = TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1249
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1250 if (g_slist_find_custom(account->permit, passport,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1251 (GCompareFunc)g_ascii_strcasecmp) ||
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1252 g_slist_find_custom(account->deny, passport,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1253 (GCompareFunc)g_ascii_strcasecmp))
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1254 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1255 new_entry = FALSE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1256 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1257
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1258 if (new_entry)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1259 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1260 MsnPermitAdd *pa;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1261 char msg[MSN_BUF_LEN];
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 pa = g_new0(MsnPermitAdd, 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1264 pa->user = msn_user_new(session, passport, friend);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1265 pa->gc = gc;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1266
7934
28609aa6c865 [gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents: 7820
diff changeset
1267 /* Ensure we have a friendly name set. */
28609aa6c865 [gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents: 7820
diff changeset
1268 msn_user_set_name(pa->user, friend);
28609aa6c865 [gaim-migrate @ 8605]
Christian Hammond <chipx86@chipx86.com>
parents: 7820
diff changeset
1269
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1270 g_snprintf(msg, sizeof(msg),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1271 _("The user %s (%s) wants to add you to their "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1272 "buddy list."),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1273 msn_user_get_passport(pa->user),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1274 msn_user_get_name(pa->user));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1275
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
1276 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2,
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
1277 _("Authorize"),
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
1278 G_CALLBACK(msn_accept_add_cb),
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
1279 _("Deny"),
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5479
diff changeset
1280 G_CALLBACK(msn_cancel_add_cb));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1281 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1282 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1283
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1284 session->num_users++;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1285
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1286 if (session->num_users == session->total_users)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1287 {
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7566
diff changeset
1288 msn_user_set_buddy_icon(session->user,
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7566
diff changeset
1289 gaim_account_get_buddy_icon(session->account));
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7566
diff changeset
1290
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7566
diff changeset
1291 if (!msn_session_change_status(session, "NLN"))
5456
40e976d42028 [gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
1292 return FALSE;
40e976d42028 [gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
1293
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
1294 gaim_connection_set_state(gc, GAIM_CONNECTED);
5456
40e976d42028 [gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
1295 serv_finish_login(gc);
6701
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.allow == NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1298 session->lists.allow = 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.allow = g_slist_concat(session->lists.allow,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1301 account->permit);
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 if (session->lists.block == NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1304 session->lists.block = g_slist_copy(account->permit);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1305 else
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1306 session->lists.block = g_slist_concat(session->lists.block,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1307 account->deny);
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 while (session->lists.forward != NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1310 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1311 MsnUser *user = session->lists.forward->data;
6777
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1312 GSList *buddies;
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1313 GSList *sl;
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1314
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1315 session->lists.forward =
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1316 g_slist_remove(session->lists.forward, user);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1317
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1318 add_buddy(servconn, user);
6777
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 buddies = gaim_find_buddies(account,
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1321 msn_user_get_passport(user));
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1322
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1323 /* Find all occurrences of this buddy in the wrong place. */
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1324 for (sl = buddies; sl != NULL; sl = sl->next)
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1325 {
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1326 GaimBuddy *b = sl->data;
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1327
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1328 if (b->proto_data == NULL)
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1329 {
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1330 gaim_debug_warning("msn",
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1331 "Deleting misplaced user %s (%s) during sync "
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1332 "with server.\n",
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1333 b->name, gaim_find_buddys_group(b)->name);
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1334
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1335 gaim_blist_remove_buddy(b);
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1336 }
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1337 }
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1338
513fd80bcd2e [gaim-migrate @ 7315]
Christian Hammond <chipx86@chipx86.com>
parents: 6773
diff changeset
1339 g_slist_free(buddies);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1340 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1341
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1342 session->syncing_lists = FALSE;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1343 session->lists_synced = TRUE;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1344 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1345 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1346 else
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1347 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1348 const char *list_name;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1349 int user_num;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1350 int num_users;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1351
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1352 list_name = params[1];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1353 user_num = atoi(params[3]);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1354 num_users = atoi(params[4]);
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 (g_ascii_strcasecmp(list_name, "RL") &&
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1357 user_num == 0 && num_users == 0)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1358 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1359 return TRUE; /* There are no users on this list. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1360 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1361
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1362 if (num_users > 0)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1363 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1364 passport = params[5];
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1365 friend = gaim_url_decode(params[6]);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1366 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1367
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1368 if (session->syncing_lists && session->lists_synced)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1369 return TRUE;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1370
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1371 if (!g_ascii_strcasecmp(list_name, "FL") && user_num != 0)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1372 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1373 /* These are users on our contact list. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1374 MsnUser *user;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1375
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1376 user = msn_user_new(session, passport, friend);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1377
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1378 if (param_count == 8)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1379 msn_user_add_group_id(user, atoi(params[7]));
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1380
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1381 session->lists.forward =
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1382 g_slist_append(session->lists.forward, user);
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 else if (!g_ascii_strcasecmp(list_name, "AL") && user_num != 0)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1385 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1386 /* These are users who are allowed to see our status. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1387 if (g_slist_find_custom(gc->account->deny, passport,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1388 (GCompareFunc)strcmp))
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1389 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1390 gaim_debug(GAIM_DEBUG_INFO, "msn",
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1391 "Moving user from deny list to permit: %s (%s)\n",
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1392 passport, friend);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1393
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1394 gaim_privacy_deny_remove(gc->account, passport, TRUE);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1395 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1396
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1397 gaim_privacy_permit_add(gc->account, passport, TRUE);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1398 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1399 else if (!g_ascii_strcasecmp(list_name, "BL") && user_num != 0)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1400 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1401 /* These are users who are not allowed to see our status. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1402 gaim_privacy_deny_add(gc->account, passport, TRUE);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1403 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1404 else if (!g_ascii_strcasecmp(list_name, "RL"))
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1405 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1406 /* These are users who have us on their contact list. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1407 if (user_num > 0)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1408 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1409 gboolean new_entry = TRUE;
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->permit, 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 (g_slist_find_custom(gc->account->deny, passport,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1418 (GCompareFunc)g_ascii_strcasecmp))
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1419 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1420 new_entry = FALSE;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1421 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1422
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1423 if (new_entry)
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 MsnPermitAdd *pa;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1426 char msg[MSN_BUF_LEN];
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1427
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1428 gaim_debug(GAIM_DEBUG_WARNING, "msn",
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1429 "Unresolved MSN RL entry: %s\n", passport);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1430
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1431 pa = g_new0(MsnPermitAdd, 1);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1432 pa->user = msn_user_new(session, passport, friend);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1433 pa->gc = gc;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1434
7941
14b8dc2f5408 [gaim-migrate @ 8612]
Christian Hammond <chipx86@chipx86.com>
parents: 7934
diff changeset
1435 msn_user_set_name(pa->user, friend);
14b8dc2f5408 [gaim-migrate @ 8612]
Christian Hammond <chipx86@chipx86.com>
parents: 7934
diff changeset
1436
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1437 g_snprintf(msg, sizeof(msg),
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1438 _("The user %s (%s) wants to add you to their "
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1439 "buddy list."),
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1440 msn_user_get_passport(pa->user),
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1441 msn_user_get_name(pa->user));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1442
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1443 gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1444 _("Authorize"),
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1445 G_CALLBACK(msn_accept_add_cb),
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1446 _("Deny"),
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1447 G_CALLBACK(msn_cancel_add_cb));
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 }
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 if (user_num != num_users)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1452 return TRUE; /* This isn't the last one in the RL. */
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1453
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1454 /* 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
1455 if (!session->lists_synced)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1456 {
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7566
diff changeset
1457 if (!msn_session_change_status(session, "NLN"))
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1458 return FALSE;
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 gaim_connection_set_state(gc, GAIM_CONNECTED);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1461 serv_finish_login(gc);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1462 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1463
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1464 if (session->lists.allow == NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1465 session->lists.allow = g_slist_copy(gc->account->permit);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1466 else
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1467 session->lists.allow = g_slist_concat(session->lists.allow,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1468 gc->account->permit);
5406
9acf4832c0dc [gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents: 5385
diff changeset
1469
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1470 if (session->lists.block == NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1471 session->lists.block = g_slist_copy(gc->account->deny);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1472 else
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1473 session->lists.block = g_slist_concat(session->lists.block,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1474 gc->account->deny);
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 while (session->lists.forward != NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1477 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1478 MsnUser *user = session->lists.forward->data;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1479
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1480 session->lists.forward =
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1481 g_slist_remove(session->lists.forward, user);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1482
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1483 add_buddy(servconn, user);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1484 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1485
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1486 session->syncing_lists = FALSE;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1487 session->lists_synced = TRUE;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1488 }
5309
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1491 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1492 }
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 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1495 nln_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1496 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1497 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1498 MsnSession *session = servconn->session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1499 GaimConnection *gc = session->account->gc;
6829
dff2d0a282e7 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1500 MsnUser *user;
dff2d0a282e7 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1501 MsnObject *msnobj;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1502 const char *state;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1503 const char *passport;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1504 const char *friend;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1505 int status = 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1506
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1507 state = params[0];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1508 passport = params[1];
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1509 friend = gaim_url_decode(params[2]);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1510
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1511 user = msn_users_find_with_passport(session->users, passport);
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1512
6833
ccfbd7c552ba [gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents: 6830
diff changeset
1513 serv_got_alias(gc, (char *)passport, (char *)friend);
ccfbd7c552ba [gaim-migrate @ 7378]
Christian Hammond <chipx86@chipx86.com>
parents: 6830
diff changeset
1514
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1515 msn_user_set_name(user, friend);
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1516
6829
dff2d0a282e7 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1517 if (session->protocol_ver >= 9 && param_count == 5)
dff2d0a282e7 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1518 {
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1519 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
1520 msn_user_set_object(user, msnobj);
dff2d0a282e7 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1521 }
dff2d0a282e7 [gaim-migrate @ 7374]
Christian Hammond <chipx86@chipx86.com>
parents: 6828
diff changeset
1522
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1523 if (!g_ascii_strcasecmp(state, "BSY"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1524 status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1525 else if (!g_ascii_strcasecmp(state, "IDL"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1526 status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1527 else if (!g_ascii_strcasecmp(state, "BRB"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1528 status |= UC_UNAVAILABLE | (MSN_BRB << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1529 else if (!g_ascii_strcasecmp(state, "AWY"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1530 status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1531 else if (!g_ascii_strcasecmp(state, "PHN"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1532 status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1533 else if (!g_ascii_strcasecmp(state, "LUN"))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1534 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
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 serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1537
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1538 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1539 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1540
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1541 static gboolean
5961
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1542 not_cmd(MsnServConn *servconn, const char *command, const char **params,
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1543 size_t param_count)
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1544 {
5963
eb336b2c451f [gaim-migrate @ 6410]
Christian Hammond <chipx86@chipx86.com>
parents: 5962
diff changeset
1545 /* GaimConnection *gc = servconn->session->account->gc; */
5961
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1546
5962
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1547 servconn->parsing_multiline = TRUE;
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1548 servconn->multiline_type = MSN_MULTILINE_NOT;
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1549 servconn->multiline_len = atoi(params[0]);
115769a4c6fc [gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents: 5961
diff changeset
1550
5961
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1551 servconn->msg_passport = NULL;
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1552 servconn->msg_friendly = NULL;
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1553
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1554 return TRUE;
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1555 }
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1556
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
1557 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1558 prp_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1559 size_t param_count)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1560 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1561 MsnSession *session = servconn->session;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1562 const char *type, *value;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1563
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1564 type = params[2];
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1565 value = params[3];
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1566
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1567 if (param_count == 4) {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1568 if (!strcmp(type, "PHH"))
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1569 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
1570 else if (!strcmp(type, "PHW"))
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1571 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
1572 else if (!strcmp(type, "PHM"))
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1573 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
1574 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1575
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1576 return TRUE;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1577 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1578
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1579 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1580 rea_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1581 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1582 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1583 MsnSession *session = servconn->session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1584 GaimConnection *gc = session->account->gc;
7162
d14e026611c0 [gaim-migrate @ 7729]
Nathan Walp <nwalp@pidgin.im>
parents: 7134
diff changeset
1585 const char *friend;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1586
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1587 friend = gaim_url_decode(params[3]);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1588
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
1589 gaim_connection_set_display_name(gc, friend);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1590
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1591 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1592 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1593
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1594 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1595 reg_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1596 size_t param_count)
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1597 {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1598 MsnSession *session = servconn->session;
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1599 MsnGroup *group;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1600 int group_id;
7162
d14e026611c0 [gaim-migrate @ 7729]
Nathan Walp <nwalp@pidgin.im>
parents: 7134
diff changeset
1601 const char *group_name;
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_id = atoi(params[2]);
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1604
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1605 group_name = gaim_url_decode(params[3]);
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1606
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1607 group = msn_groups_find_with_id(session->groups, group_id);
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1608
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1609 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
1610 msn_group_get_name(group), group_name);
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1611
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1612 if (group != NULL)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1613 msn_group_set_name(group, group_name);
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1614
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1615 return TRUE;
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1616 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5312
diff changeset
1617
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1618 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1619 rem_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1620 size_t param_count)
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1621 {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1622 MsnSession *session = servconn->session;
6772
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1623 const char *passport = params[3];
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1624
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1625 if (param_count == 5)
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1626 {
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1627 MsnUser *user;
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1628 int group_id = atoi(params[4]);
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1629
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1630 user = msn_users_find_with_passport(session->users, passport);
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1631
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1632 msn_user_remove_group_id(user, group_id);
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6767
diff changeset
1633 }
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1634
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1635 /* I hate this. */
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1636 if (session->moving_buddy) {
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1637 MsnGroup *group, *old_group;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1638 GaimConnection *gc = session->account->gc;
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1639 const char *friendly;
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1640 char outparams[MSN_BUF_LEN];
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1641
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1642 group = msn_groups_find_with_name(session->groups,
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1643 session->dest_group_name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1644
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1645 old_group = session->old_group;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1646
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1647 session->moving_buddy = FALSE;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1648 session->old_group = NULL;
5327
b716ffc25d2d [gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents: 5326
diff changeset
1649
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1650 if (group == NULL) {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1651 gaim_debug(GAIM_DEBUG_ERROR, "msn",
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1652 "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
1653 session->dest_group_name, passport);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1654
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1655 g_free(session->dest_group_name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1656 session->dest_group_name = NULL;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1657
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1658 return TRUE;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1659 }
5327
b716ffc25d2d [gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents: 5326
diff changeset
1660
b716ffc25d2d [gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents: 5326
diff changeset
1661 g_free(session->dest_group_name);
b716ffc25d2d [gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents: 5326
diff changeset
1662 session->dest_group_name = NULL;
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1663
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1664 if ((friendly = msn_user_get_name(session->moving_user)) == NULL)
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1665 friendly = passport;
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6833
diff changeset
1666
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1667 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d",
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7015
diff changeset
1668 passport, gaim_url_encode(friendly),
6980
1da447732906 [gaim-migrate @ 7536]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1669 msn_group_get_id(group));
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1670
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1671 if (!msn_servconn_send_command(session->notification_conn,
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1672 "ADD", outparams)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1673 gaim_connection_error(gc, _("Write error"));
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1674 return FALSE;
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
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1677 if (old_group != NULL)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1678 msn_group_remove_user(old_group, session->moving_user);
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 msn_user_unref(session->moving_user);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1681
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1682 session->moving_user = NULL;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1683
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1684 if (old_group != NULL &&
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1685 msn_users_get_count(msn_group_get_users(old_group)) <= 0) {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1686
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1687 g_snprintf(outparams, sizeof(outparams), "%d",
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1688 msn_group_get_id(old_group));
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1689
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1690 if (!msn_servconn_send_command(session->notification_conn,
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1691 "RMG", outparams)) {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1692
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1693 gaim_connection_error(gc, _("Write error"));
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1694 return FALSE;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1695 }
5322
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 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1698
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1699 return TRUE;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1700 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1701
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1702 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1703 rmg_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1704 size_t param_count)
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1705 {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1706 MsnSession *session = servconn->session;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1707 MsnGroup *group;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1708
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1709 group = msn_groups_find_with_id(session->groups, atoi(params[2]));
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1710
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1711 if (group != NULL)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1712 msn_groups_remove(session->groups, group);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1713
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1714 return TRUE;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1715 }
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5509
diff changeset
1716
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1717 static gboolean
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1718 syn_cmd(MsnServConn *servconn, const char *command, const char **params,
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1719 size_t param_count)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1720 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1721 MsnSession *session = servconn->session;
7289
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1722 GaimConnection *gc = gaim_account_get_connection(session->account);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1723
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1724 if (session->protocol_ver >= 8)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1725 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1726 session->total_users = atoi(params[2]);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1727 session->total_groups = atoi(params[3]);
7289
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1728
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1729 if (session->total_users == 0)
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1730 {
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1731 gaim_connection_set_state(gc, GAIM_CONNECTED);
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1732 serv_finish_login(gc);
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1733
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1734 session->syncing_lists = FALSE;
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1735 session->lists_synced = TRUE;
ab2085024a29 [gaim-migrate @ 7870]
Christian Hammond <chipx86@chipx86.com>
parents: 7288
diff changeset
1736 }
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1737 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1738
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1739 return TRUE;
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1740 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
1741
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1742 /**************************************************************************
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1743 * Misc commands
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 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1746 url_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1747 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1748 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1749 MsnSession *session = servconn->session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1750 GaimAccount *account = session->account;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1751 const char *rru;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1752 const char *url;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1753 md5_state_t st;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1754 md5_byte_t di[16];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1755 FILE *fd;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1756 char buf[2048];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1757 char buf2[3];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1758 char sendbuf[64];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1759 int i;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1760
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1761 rru = params[1];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1762 url = params[2];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1763
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1764 g_snprintf(buf, sizeof(buf), "%s%lu%s",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1765 session->passport_info.mspauth,
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
1766 time(NULL) - session->passport_info.sl,
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
1767 gaim_account_get_password(account));
5309
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 md5_init(&st);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1770 md5_append(&st, (const md5_byte_t *)buf, strlen(buf));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1771 md5_finish(&st, di);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1772
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1773 memset(sendbuf, 0, sizeof(sendbuf));
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 for (i = 0; i < 16; i++) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1776 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1777 strcat(sendbuf, buf2);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1778 }
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 if (session->passport_info.file != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1781 unlink(session->passport_info.file);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1782 g_free(session->passport_info.file);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1783 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1784
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1785 if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1786 gaim_debug(GAIM_DEBUG_ERROR, "msn",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1787 "Error opening temp passport file: %s\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1788 strerror(errno));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1789 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1790 else {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1791 fputs("<html>\n"
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1792 "<head>\n"
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1793 "<noscript>\n"
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1794 "<meta http-equiv=\"Refresh\" content=\"0; "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1795 "url=http://www.hotmail.com\">\n"
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1796 "</noscript>\n"
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1797 "</head>\n\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1798 fd);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1799
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1800 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1801 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1802 url);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1803 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1804 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n",
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1805 gaim_account_get_username(account));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1806 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n",
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1807 gaim_account_get_username(account));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1808 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1809 session->passport_info.sid);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1810 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1811 session->passport_info.kv);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1812 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1813 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1814 time(NULL) - session->passport_info.sl);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1815 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1816 rru);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1817 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1818 session->passport_info.mspauth);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1819 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1820 sendbuf); /* TODO Digest me (huh? -- ChipX86) */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1821 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n");
7699
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1822 fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n");
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1823 fprintf(fd, "</form></body>\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1824 fprintf(fd, "</html>\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1825
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1826 if (fclose(fd)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1827 gaim_debug(GAIM_DEBUG_ERROR, "msn",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1828 "Error closing temp passport file: %s\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1829 strerror(errno));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1830
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1831 unlink(session->passport_info.file);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1832 g_free(session->passport_info.file);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1833 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1834 else {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1835 /*
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1836 * Renaming file with .html extension, so that the
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1837 * win32 open_url will work.
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1838 */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1839 char *tmp;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1840
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1841 if ((tmp = g_strdup_printf("%s.html",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1842 session->passport_info.file)) != NULL) {
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 if (rename(session->passport_info.file, tmp) == 0) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1845 g_free(session->passport_info.file);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1846 session->passport_info.file = tmp;
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 else
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1849 g_free(tmp);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1850 }
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1854 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1855 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1856 /**************************************************************************
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1857 * Switchboards
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 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1860 rng_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1861 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1862 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1863 MsnSession *session = servconn->session;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1864 MsnSwitchBoard *swboard;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1865 MsnUser *user;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1866 const char *session_id;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1867 char *host, *c;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1868 int port;
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 session_id = params[0];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1871
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1872 host = g_strdup(params[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 if ((c = strchr(host, ':')) != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1875 *c = '\0';
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1876 port = atoi(c + 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1877 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1878 else
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1879 port = 1863;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1880
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1881 if (session->http_method)
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1882 port = 80;
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1883
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1884 swboard = msn_switchboard_new(session);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1885
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1886 user = msn_user_new(session, params[4], NULL);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1887
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1888 msn_switchboard_set_invited(swboard, TRUE);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1889 msn_switchboard_set_session_id(swboard, params[0]);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1890 msn_switchboard_set_auth_key(swboard, params[3]);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1891 msn_switchboard_set_user(swboard, user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1892
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1893 if (!msn_switchboard_connect(swboard, host, port)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1894 gaim_debug(GAIM_DEBUG_ERROR, "msn",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1895 "Unable to connect to switchboard on %s, port %d\n",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1896 host, port);
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 g_free(host);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1899
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1900 return FALSE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1901 }
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 g_free(host);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1904
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1905 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1906 }
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 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1909 xfr_cmd(MsnServConn *servconn, const char *command, const char **params,
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1910 size_t param_count)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1911 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1912 MsnSession *session = servconn->session;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1913 MsnSwitchBoard *swboard;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1914 GaimConnection *gc = session->account->gc;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1915 char *host;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1916 char *c;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1917 int port;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1918
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1919 if (strcmp(params[1], "SB") && strcmp(params[1], "NS")) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1920 gaim_connection_error(gc, _("Got invalid XFR"));
7188
2ff225547cf4 [gaim-migrate @ 7757]
Christian Hammond <chipx86@chipx86.com>
parents: 7162
diff changeset
1921
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1922 return FALSE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1923 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1924
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1925 host = g_strdup(params[2]);
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 if ((c = strchr(host, ':')) != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1928 *c = '\0';
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1929 port = atoi(c + 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1930 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1931 else
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1932 port = 1863;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1933
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1934 if (!strcmp(params[1], "SB")) {
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1935 swboard = msn_session_find_unused_switch(session);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1936
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1937 if (swboard == NULL) {
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1938 gaim_debug(GAIM_DEBUG_ERROR, "msn",
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1939 "Received an XFR SB request when there's no unused "
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1940 "switchboards!\n");
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1941 return FALSE;
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1942 }
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1943
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1944 msn_switchboard_set_auth_key(swboard, params[4]);
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1945
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1946 if (session->http_method)
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1947 port = 80;
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
1948
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1949 if (!msn_switchboard_connect(swboard, host, port)) {
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1950 gaim_debug(GAIM_DEBUG_ERROR, "msn",
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1951 "Unable to connect to switchboard on %s, port %d\n",
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1952 host, port);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1953
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1954 g_free(host);
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1955
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1956 return FALSE;
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1957 }
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1958 }
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1959 else if (!strcmp(params[1], "NS")) {
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1960 msn_servconn_destroy(session->notification_conn);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1961
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1962 session->notification_conn = msn_notification_new(session, host, port);
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 if (!msn_servconn_connect(session->notification_conn)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
1965 gaim_connection_error(gc, _("Unable to transfer to "
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1966 "notification server"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1967
5385
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1968 return FALSE;
150cf1615098 [gaim-migrate @ 5761]
Christian Hammond <chipx86@chipx86.com>
parents: 5375
diff changeset
1969 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1970 }
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 g_free(host);
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 return TRUE;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1977 /**************************************************************************
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1978 * Message Types
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1979 **************************************************************************/
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1980 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
1981 profile_msg(MsnServConn *servconn, MsnMessage *msg)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1982 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1983 MsnSession *session = servconn->session;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1984 const char *value;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1985
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1986 if (strcmp(servconn->msg_passport, "Hotmail")) {
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1987 /* This isn't an official message. */
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1988 return TRUE;
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1989 }
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1990
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1991 if ((value = msn_message_get_attr(msg, "kv")) != NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1992 session->passport_info.kv = g_strdup(value);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1993
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1994 if ((value = msn_message_get_attr(msg, "sid")) != NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1995 session->passport_info.sid = g_strdup(value);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1996
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1997 if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1998 session->passport_info.mspauth = g_strdup(value);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1999
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2000 if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2001 session->passport_info.client_ip = g_strdup(value);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2002
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2003 if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL)
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2004 session->passport_info.client_port = ntohs(atoi(value));
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2005
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2006 return TRUE;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2009 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2010 initial_email_msg(MsnServConn *servconn, MsnMessage *msg)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2011 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2012 MsnSession *session = servconn->session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2013 GaimConnection *gc = session->account->gc;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2014 GHashTable *table;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2015 const char *unread;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2016
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2017 if (strcmp(servconn->msg_passport, "Hotmail")) {
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2018 /* This isn't an official message. */
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2019 return TRUE;
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2020 }
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2021
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2022 if (!gaim_account_get_check_mail(session->account))
5520
11be8ae32937 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2023 return TRUE;
11be8ae32937 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2024
5358
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2025 if (session->passport_info.file == NULL) {
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2026 msn_servconn_send_command(servconn, "URL", "INBOX");
5506
4f72b611f0ee [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2027
4f72b611f0ee [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2028 msn_servconn_queue_message(servconn, "URL", msg);
4f72b611f0ee [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2029
5358
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2030 return TRUE;
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2031 }
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2032
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2033 table = msn_message_get_hashtable_from_body(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2034
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2035 unread = g_hash_table_lookup(table, "Inbox-Unread");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2036
5520
11be8ae32937 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2037 if (unread != NULL) {
7190
13c725566078 [gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents: 7188
diff changeset
2038 int count = atoi(unread);
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 if (count != 0)
13c725566078 [gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents: 7188
diff changeset
2041 {
7699
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
2042 const char *passport = msn_user_get_passport(session->user);
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
2043 const char *file = session->passport_info.file;
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
2044 gchar *url;
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
2045 while (*file && *file == '/')
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
2046 ++file;
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
2047 url = g_strconcat ("file:///", file, 0);
7820
8e60ddc28a22 [gaim-migrate @ 8472]
Mark Doliner <mark@kingant.net>
parents: 7817
diff changeset
2048 gaim_notify_emails(gc, count, FALSE, NULL, NULL,
8e60ddc28a22 [gaim-migrate @ 8472]
Mark Doliner <mark@kingant.net>
parents: 7817
diff changeset
2049 &passport, (const char **)&url, NULL, NULL);
7699
04f9c750657f [gaim-migrate @ 8344]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
2050 g_free (url);
7190
13c725566078 [gaim-migrate @ 7759]
Christian Hammond <chipx86@chipx86.com>
parents: 7188
diff changeset
2051 }
5520
11be8ae32937 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2052 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2053
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2054 g_hash_table_destroy(table);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2055
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2056 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2057 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2058
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2059 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2060 email_msg(MsnServConn *servconn, MsnMessage *msg)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2061 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2062 MsnSession *session = servconn->session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2063 GaimConnection *gc = session->account->gc;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2064 GHashTable *table;
7817
954b986ad3e3 [gaim-migrate @ 8464]
Mark Doliner <mark@kingant.net>
parents: 7699
diff changeset
2065 char *from, *subject;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2066
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2067 if (strcmp(servconn->msg_passport, "Hotmail")) {
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2068 /* This isn't an official message. */
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2069 return TRUE;
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2070 }
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2071
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2072 if (!gaim_account_get_check_mail(session->account))
5520
11be8ae32937 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2073 return TRUE;
11be8ae32937 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2074
5358
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2075 if (session->passport_info.file == NULL) {
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2076 msn_servconn_send_command(servconn, "URL", "INBOX");
5506
4f72b611f0ee [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2077
4f72b611f0ee [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2078 msn_servconn_queue_message(servconn, "URL", msg);
4f72b611f0ee [gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
2079
5358
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2080 return TRUE;
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2081 }
91db34a45cbe [gaim-migrate @ 5734]
Christian Hammond <chipx86@chipx86.com>
parents: 5353
diff changeset
2082
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2083 table = msn_message_get_hashtable_from_body(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2084
7817
954b986ad3e3 [gaim-migrate @ 8464]
Mark Doliner <mark@kingant.net>
parents: 7699
diff changeset
2085 from = gaim_mime_decode_field(g_hash_table_lookup(table, "From"));
954b986ad3e3 [gaim-migrate @ 8464]
Mark Doliner <mark@kingant.net>
parents: 7699
diff changeset
2086 subject = gaim_mime_decode_field(g_hash_table_lookup(table, "Subject"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2087
5520
11be8ae32937 [gaim-migrate @ 5920]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
2088 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
2089 session->passport_info.file, NULL, NULL);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2090
7817
954b986ad3e3 [gaim-migrate @ 8464]
Mark Doliner <mark@kingant.net>
parents: 7699
diff changeset
2091 g_free(from);
954b986ad3e3 [gaim-migrate @ 8464]
Mark Doliner <mark@kingant.net>
parents: 7699
diff changeset
2092 g_free(subject);
954b986ad3e3 [gaim-migrate @ 8464]
Mark Doliner <mark@kingant.net>
parents: 7699
diff changeset
2093
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2094 g_hash_table_destroy(table);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2095
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2096 return TRUE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2097 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2098
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2099 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2100 system_msg(MsnServConn *servconn, MsnMessage *msg)
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2101 {
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2102 GHashTable *table;
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2103 const char *type_s;
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 if (strcmp(servconn->msg_passport, "Hotmail")) {
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2106 /* This isn't an official message. */
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2107 return TRUE;
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2108 }
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2109
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2110 table = msn_message_get_hashtable_from_body(msg);
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2111
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2112 if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) {
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2113 int type = atoi(type_s);
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2114 char buf[MSN_BUF_LEN];
6308
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2115 int minutes;
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2116
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2117 switch (type) {
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2118 case 1:
6308
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2119 minutes = atoi(g_hash_table_lookup(table, "Arg1"));
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2120 g_snprintf(buf, sizeof(buf), ngettext(
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2121 "The MSN server will shut down for maintenance "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2122 "in %d minute. You will automatically be "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2123 "signed out at that time. Please finish any "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2124 "conversations in progress.\n\nAfter the "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2125 "maintenance has been completed, you will be "
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2126 "able to successfully sign in.",
6308
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2127 "The MSN server will shut down for maintenance "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2128 "in %d minutes. You will automatically be "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2129 "signed out at that time. Please finish any "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2130 "conversations in progress.\n\nAfter the "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2131 "maintenance has been completed, you will be "
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2132 "able to successfully sign in.", minutes),
a21cf07cd8e1 [gaim-migrate @ 6807]
Mark Doliner <mark@kingant.net>
parents: 5963
diff changeset
2133 minutes);
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2134 default:
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2135 break;
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2136 }
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2137
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5406
diff changeset
2138 if (*buf != '\0')
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5406
diff changeset
2139 gaim_notify_info(servconn->session->account->gc, NULL, buf, NULL);
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2140 }
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2141
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2142 g_hash_table_destroy(table);
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2143
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2144 return TRUE;
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2145 }
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2146
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2147 static gboolean
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2148 connect_cb(gpointer data, gint source, GaimInputCondition cond)
5309
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 MsnServConn *notification = data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2151 MsnSession *session = notification->session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2152 GaimAccount *account = session->account;
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2153 GaimConnection *gc = gaim_account_get_connection(account);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2154 char proto_vers[256];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2155 size_t i;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2156
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2157 if (source == -1) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2158 gaim_connection_error(session->account->gc, _("Unable to connect"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2159 return FALSE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2160 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2161
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2162 if (notification->fd != source)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2163 notification->fd = source;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2164
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2165 proto_vers[0] = '\0';
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2166
6828
cdcb43229e33 [gaim-migrate @ 7373]
Christian Hammond <chipx86@chipx86.com>
parents: 6827
diff changeset
2167 for (i = 7; i <= session->protocol_ver; i++)
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2168 {
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2169 char old_buf[256];
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2170
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2171 strcpy(old_buf, proto_vers);
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2172
7386
414c701ef1ff [gaim-migrate @ 7981]
Luke Schierer <lschiere@pidgin.im>
parents: 7289
diff changeset
2173 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
2174 }
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2175
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2176 strncat(proto_vers, "CVR0", sizeof(proto_vers));
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2177
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2178 if (!msn_servconn_send_command(notification, "VER", proto_vers))
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2179 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2180 gaim_connection_error(gc, _("Unable to write to server"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2181 return FALSE;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2182 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2183
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2184 session->user = msn_user_new(session,
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2185 gaim_account_get_username(account), NULL);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
2186
5566
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2187 gaim_connection_update_progress(gc, _("Syncing with server"),
9896e9068bc4 [gaim-migrate @ 5968]
Christian Hammond <chipx86@chipx86.com>
parents: 5564
diff changeset
2188 4, MSN_CONNECT_STEPS);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2189
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2190 return TRUE;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2193 static void
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2194 failed_read_cb(gpointer data, gint source, GaimInputCondition cond)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2195 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2196 MsnServConn *notification = data;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2197 GaimConnection *gc;
5309
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 gc = notification->session->account->gc;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2200
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5520
diff changeset
2201 gaim_connection_error(gc, _("Error reading from server"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2202 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2203
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2204 MsnServConn *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2205 msn_notification_new(MsnSession *session, const char *server, int port)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2206 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2207 MsnServConn *notification;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2208
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2209 notification = msn_servconn_new(session);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2210
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2211 msn_servconn_set_server(notification, server, port);
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2212 msn_servconn_set_connect_cb(notification, connect_cb);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2213 msn_servconn_set_failed_read_cb(notification, failed_read_cb);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2214
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
2215 if (session->http_method)
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
2216 notification->http_data->server_type = "NS";
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7274
diff changeset
2217
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2218 if (notification_commands == NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2219 /* Register the command callbacks. */
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2220 msn_servconn_register_command(notification, "ADD", add_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2221 msn_servconn_register_command(notification, "ADG", adg_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2222 msn_servconn_register_command(notification, "BLP", blp_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2223 msn_servconn_register_command(notification, "BPR", bpr_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2224 msn_servconn_register_command(notification, "CHG", blank_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2225 msn_servconn_register_command(notification, "CHL", chl_cmd);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2226 msn_servconn_register_command(notification, "CVR", cvr_cmd);
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2227 msn_servconn_register_command(notification, "FLN", fln_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2228 msn_servconn_register_command(notification, "GTC", blank_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2229 msn_servconn_register_command(notification, "ILN", iln_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2230 msn_servconn_register_command(notification, "INF", inf_cmd);
5960
03bf7c905782 [gaim-migrate @ 6407]
Christian Hammond <chipx86@chipx86.com>
parents: 5933
diff changeset
2231 msn_servconn_register_command(notification, "IPG", ipg_cmd);
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2232 msn_servconn_register_command(notification, "LSG", lsg_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2233 msn_servconn_register_command(notification, "LST", lst_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2234 msn_servconn_register_command(notification, "MSG", msg_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2235 msn_servconn_register_command(notification, "NLN", nln_cmd);
5961
fc8ba872a43f [gaim-migrate @ 6408]
Christian Hammond <chipx86@chipx86.com>
parents: 5960
diff changeset
2236 msn_servconn_register_command(notification, "NOT", not_cmd);
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2237 msn_servconn_register_command(notification, "OUT", out_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2238 msn_servconn_register_command(notification, "PRP", prp_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2239 msn_servconn_register_command(notification, "QNG", blank_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2240 msn_servconn_register_command(notification, "QRY", blank_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2241 msn_servconn_register_command(notification, "REA", rea_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2242 msn_servconn_register_command(notification, "REG", reg_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2243 msn_servconn_register_command(notification, "REM", rem_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2244 msn_servconn_register_command(notification, "RMG", rmg_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2245 msn_servconn_register_command(notification, "RNG", rng_cmd);
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2246 msn_servconn_register_command(notification, "SYN", syn_cmd);
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2247 msn_servconn_register_command(notification, "URL", url_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2248 msn_servconn_register_command(notification, "USR", usr_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2249 msn_servconn_register_command(notification, "VER", ver_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2250 msn_servconn_register_command(notification, "XFR", xfr_cmd);
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2251 msn_servconn_register_command(notification, "_unknown_", unknown_cmd);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2252
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2253 /* Register the message type callbacks. */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2254 msn_servconn_register_msg_type(notification, "text/x-msmsgsprofile",
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2255 profile_msg);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2256 msn_servconn_register_msg_type(notification,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2257 "text/x-msmsgsinitialemailnotification",
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2258 initial_email_msg);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2259 msn_servconn_register_msg_type(notification,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2260 "text/x-msmsgsemailnotification",
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2261 email_msg);
5333
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2262 msn_servconn_register_msg_type(notification,
bbbf616bd924 [gaim-migrate @ 5708]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
2263 "application/x-msmsgssystemmessage",
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5768
diff changeset
2264 system_msg);
5309
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 /* Save these for future use. */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2267 notification_commands = notification->commands;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2268 notification_msg_types = notification->msg_types;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2269 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2270 else {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2271 g_hash_table_destroy(notification->commands);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2272 g_hash_table_destroy(notification->msg_types);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2273
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2274 notification->commands = notification_commands;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2275 notification->msg_types = notification_msg_types;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2276 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2277
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2278 return notification;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2279 }