annotate src/protocols/msn/msn.c @ 5166:cab5cd204956

[gaim-migrate @ 5530] This is that stuff that's supposed to make msn work gooder on OSX. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Apr 2003 18:04:38 +0000
parents b31ad163de3b
children 092b418b5012
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
1 /**
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
2 * @file msn.c The MSN protocol plugin
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
3 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
4 * gaim
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
5 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
6 * Parts Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org>
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
7 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
8 * This program is free software; you can redistribute it and/or modify
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
9 * it under the terms of the GNU General Public License as published by
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
11 * (at your option) any later version.
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
12 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
13 * This program is distributed in the hope that it will be useful,
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
16 * GNU General Public License for more details.
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
17 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
18 * You should have received a copy of the GNU General Public License
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
19 * along with this program; if not, write to the Free Software
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
21 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
22 */
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
23 #include "msn.h"
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
24
4546
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
25 #ifdef _WIN32
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
26 #include "win32dep.h"
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
27 #endif
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
28
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
29 #define BUDDY_ALIAS_MAXLEN 388
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
30
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
31 static struct prpl *my_protocol = NULL;
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
32
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
33 /* for win32 compatability */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
34 G_MODULE_IMPORT GSList *connections;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
35
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
36 static void msn_login_callback(gpointer, gint, GaimInputCondition);
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
37 static void msn_login_xfr_connect(gpointer, gint, GaimInputCondition);
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
38
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
39 #if 0
4546
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
40 static struct msn_file_transfer *find_mft_by_cookie(struct gaim_connection *gc, unsigned long cookie);
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
41 static struct msn_file_transfer *find_mft_by_xfer(struct gaim_connection *gc, struct file_transfer *xfer);
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
42 #endif
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 static char *msn_normalize(const char *s)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 static char buf[BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 g_return_val_if_fail(s != NULL, NULL);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49
3504
d7cefb94a978 [gaim-migrate @ 3568]
Sean Egan <seanegan@gmail.com>
parents: 3493
diff changeset
50 g_snprintf(buf, sizeof(buf), "%s%s", s, strchr(s, '@') ? "" : "@hotmail.com");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 return buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
55 char *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
56 handle_errcode(char *buf, gboolean show)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 int errcode;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 static char msg[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 buf[4] = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 errcode = atoi(buf);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 switch (errcode) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 case 200:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
66 g_snprintf(msg, sizeof(msg), _("Syntax Error (probably a Gaim bug)"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 case 201:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
69 g_snprintf(msg, sizeof(msg), _("Invalid Parameter (probably a Gaim bug)"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 case 205:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
72 g_snprintf(msg, sizeof(msg), _("Invalid User"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 case 206:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
75 g_snprintf(msg, sizeof(msg), _("Fully Qualified Domain Name missing"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 case 207:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
78 g_snprintf(msg, sizeof(msg), _("Already Login"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 case 208:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
81 g_snprintf(msg, sizeof(msg), _("Invalid Username"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 case 209:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
84 g_snprintf(msg, sizeof(msg), _("Invalid Friendly Name"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 case 210:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
87 g_snprintf(msg, sizeof(msg), _("List Full"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 case 215:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
90 g_snprintf(msg, sizeof(msg), _("Already there"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 case 216:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
93 g_snprintf(msg, sizeof(msg), _("Not on list"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 break;
2842
cf0f0153e2da [gaim-migrate @ 2855]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
95 case 217:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
96 g_snprintf(msg, sizeof(msg), _("User is offline"));
2842
cf0f0153e2da [gaim-migrate @ 2855]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
97 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 case 218:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
99 g_snprintf(msg, sizeof(msg), _("Already in the mode"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 case 219:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
102 g_snprintf(msg, sizeof(msg), _("Already in opposite list"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 case 280:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
105 g_snprintf(msg, sizeof(msg), _("Switchboard failed"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 case 281:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
108 g_snprintf(msg, sizeof(msg), _("Notify Transfer failed"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 case 300:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
112 g_snprintf(msg, sizeof(msg), _("Required fields missing"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 case 302:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
115 g_snprintf(msg, sizeof(msg), _("Not logged in"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 case 500:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
119 g_snprintf(msg, sizeof(msg), _("Internal server error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 case 501:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
122 g_snprintf(msg, sizeof(msg), _("Database server error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 case 510:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
125 g_snprintf(msg, sizeof(msg), _("File operation error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 case 520:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
128 g_snprintf(msg, sizeof(msg), _("Memory allocation error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 case 600:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
132 g_snprintf(msg, sizeof(msg), _("Server busy"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 case 601:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
135 g_snprintf(msg, sizeof(msg), _("Server unavailable"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 case 602:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
138 g_snprintf(msg, sizeof(msg), _("Peer Notification server down"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 case 603:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
141 g_snprintf(msg, sizeof(msg), _("Database connect error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 case 604:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
144 g_snprintf(msg, sizeof(msg), _("Server is going down (abandon ship)"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 case 707:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
148 g_snprintf(msg, sizeof(msg), _("Error creating connection"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 case 711:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
151 g_snprintf(msg, sizeof(msg), _("Unable to write"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 case 712:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
154 g_snprintf(msg, sizeof(msg), _("Session overload"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 case 713:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
157 g_snprintf(msg, sizeof(msg), _("User is too active"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 case 714:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
160 g_snprintf(msg, sizeof(msg), _("Too many sessions"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 case 715:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
163 g_snprintf(msg, sizeof(msg), _("Not expected"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 case 717:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
166 g_snprintf(msg, sizeof(msg), _("Bad friend file"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 case 911:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
170 g_snprintf(msg, sizeof(msg), _("Authentication failed"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172 case 913:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
173 g_snprintf(msg, sizeof(msg), _("Not allowed when offline"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174 break;
3073
22c82a341c32 [gaim-migrate @ 3087]
Sean Egan <seanegan@gmail.com>
parents: 3065
diff changeset
175 case 920:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
176 g_snprintf(msg, sizeof(msg), _("Not accepting new users"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 break;
3073
22c82a341c32 [gaim-migrate @ 3087]
Sean Egan <seanegan@gmail.com>
parents: 3065
diff changeset
178 case 924:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
179 g_snprintf(msg, sizeof(msg), _("User unverified"));
3073
22c82a341c32 [gaim-migrate @ 3087]
Sean Egan <seanegan@gmail.com>
parents: 3065
diff changeset
180 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 default:
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
182 g_snprintf(msg, sizeof(msg), _("Unknown Error Code"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 if (show)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
187 do_error_dialog(msg, NULL, GAIM_ERROR);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 return msg;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
192
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
193 char *url_decode(const char *msg)
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
194 {
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
195 static char buf[MSN_BUF_LEN];
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
196 int i, j = 0;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
197
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
198 bzero(buf, sizeof(buf));
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
199 for (i = 0; i < strlen(msg); i++) {
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
200 char hex[3];
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
201 if (msg[i] != '%') {
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
202 buf[j++] = msg[i];
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
203 continue;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
204 }
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
205 strncpy(hex, msg + ++i, 2); hex[2] = 0;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
206 /* i is pointing to the start of the number */
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
207 i++; /* now it's at the end and at the start of the for loop
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
208 will be at the next character */
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
209 buf[j++] = strtol(hex, NULL, 16);
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
210 }
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
211 buf[j] = 0;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
212
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
213 return buf;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
214 }
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
215
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
216 static char *url_encode(const char *msg)
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
217 {
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
218 static char buf[MSN_BUF_LEN];
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
219 int i, j = 0;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
220
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
221 bzero(buf, sizeof(buf));
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
222 for (i = 0; i < strlen(msg); i++) {
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
223 if (isalnum(msg[i]))
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
224 buf[j++] = msg[i];
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
225 else {
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
226 sprintf(buf + j, "%%%02x", (unsigned char)msg[i]);
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
227 j += 3;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
228 }
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
229 }
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
230 buf[j] = 0;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
231
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
232 return buf;
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
233 }
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
234
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 static void handle_hotmail(struct gaim_connection *gc, char *data)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 {
2932
3827e4cd665c [gaim-migrate @ 2945]
Rob Flynn <gaim@robflynn.com>
parents: 2889
diff changeset
237 char login_url[2048];
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
238 char buf[MSN_BUF_LEN];
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
239 struct msn_data *md = gc->proto_data;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
240
3293
3e37cfdcca73 [gaim-migrate @ 3311]
Sean Egan <seanegan@gmail.com>
parents: 3279
diff changeset
241 if (strchr(gc->username, '@') != strstr(gc->username, "@hotmail.com"))
3e37cfdcca73 [gaim-migrate @ 3311]
Sean Egan <seanegan@gmail.com>
parents: 3279
diff changeset
242 /* We can only get Hotmail notification from hotmail users */
3e37cfdcca73 [gaim-migrate @ 3311]
Sean Egan <seanegan@gmail.com>
parents: 3279
diff changeset
243 return;
3e37cfdcca73 [gaim-migrate @ 3311]
Sean Egan <seanegan@gmail.com>
parents: 3279
diff changeset
244
3195
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
245 if (!md->passport) {
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
246 g_snprintf(buf, sizeof(buf), "URL %u INBOX\r\n", ++md->trId);
2932
3827e4cd665c [gaim-migrate @ 2945]
Rob Flynn <gaim@robflynn.com>
parents: 2889
diff changeset
247
3195
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
248 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2152
diff changeset
249 return;
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2152
diff changeset
250 }
3195
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
251 } else {
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
252 g_snprintf(login_url, sizeof(login_url), "%s", md->passport);
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
253
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
254 if (strstr(data, "Content-Type: text/x-msmsgsinitialemailnotification;")) {
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
255 char *x = strstr(data, "Inbox-Unread:");
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
256 if (!x) return;
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
257 x += strlen("Inbox-Unread: ");
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
258 connection_has_mail(gc, atoi(x), NULL, NULL, login_url);
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
259 } else if (strstr(data, "Content-Type: text/x-msmsgsemailnotification;")) {
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
260 char *from = strstr(data, "From:");
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
261 char *subject = strstr(data, "Subject:");
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
262 char *x;
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
263 if (!from || !subject) {
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
264 connection_has_mail(gc, 1, NULL, NULL, login_url);
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
265 return;
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
266 }
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
267 from += strlen("From: ");
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
268 x = strstr(from, "\r\n"); *x = 0;
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
269 subject += strlen("Subject: ");
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
270 x = strstr(subject, "\r\n"); *x = 0;
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
271 connection_has_mail(gc, -1, from, subject, login_url);
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
272 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 struct msn_add_permit {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 struct gaim_connection *gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 char *user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 char *friend;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3720
diff changeset
282 static void msn_accept_add(struct msn_add_permit *map)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 {
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
284 if(g_slist_find(connections, map->gc)) {
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
285 struct msn_data *md = map->gc->proto_data;
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
286 char buf[MSN_BUF_LEN];
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
287
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
288 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
289
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
290 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
291 hide_login_progress(map->gc, _("Write error"));
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
292 signoff(map->gc);
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
293 return;
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
294 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
295 gaim_privacy_permit_add(map->gc->account, map->user);
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
296 build_allow_list(); /* er. right. we'll need to have a thing for this in CUI too */
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
297 show_got_added(map->gc, NULL, map->user, map->friend, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 }
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
299
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3720
diff changeset
300 g_free(map->user);
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3720
diff changeset
301 g_free(map->friend);
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3720
diff changeset
302 g_free(map);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304
3730
a20bf3d247ff [gaim-migrate @ 3868]
Sean Egan <seanegan@gmail.com>
parents: 3720
diff changeset
305 static void msn_cancel_add(struct msn_add_permit *map)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 {
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
307 if(g_slist_find(connections, map->gc)) {
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
308 struct msn_data *md = map->gc->proto_data;
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
309 char buf[MSN_BUF_LEN];
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
310
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
311 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
312 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
313 hide_login_progress(map->gc, _("Write error"));
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
314 signoff(map->gc);
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
315 return;
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
316 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
317 gaim_privacy_deny_add(map->gc->account, map->user);
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
318 build_block_list();
3118
712bc3205d9a [gaim-migrate @ 3133]
Sean Egan <seanegan@gmail.com>
parents: 3117
diff changeset
319 }
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
320
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 g_free(map->user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 g_free(map->friend);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 g_free(map);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
326 static int msn_process_main(struct gaim_connection *gc, char *buf)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 struct msn_data *md = gc->proto_data;
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
329 char sendbuf[MSN_BUF_LEN];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
331 if (!g_ascii_strncasecmp(buf, "ADD", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 char *list, *user, *friend, *tmp = buf;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
333 struct msn_add_permit *ap;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
334 GSList *perm = gc->account->permit;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 char msg[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 list = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 user = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 GET_NEXT(tmp);
3323
3e6e54051e67 [gaim-migrate @ 3341]
Sean Egan <seanegan@gmail.com>
parents: 3322
diff changeset
346 friend = url_decode(tmp);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
348 if (g_ascii_strcasecmp(list, "RL"))
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
349 return 1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
351 while (perm) {
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
352 if (!gaim_utf8_strcasecmp(perm->data, user))
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
353 return 1;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
354 perm = perm->next;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
355 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
356
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
357 ap = g_new0(struct msn_add_permit, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 ap->user = g_strdup(user);
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
359 ap->friend = g_strdup(friend);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 ap->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361
3299
a184a80b1e15 [gaim-migrate @ 3317]
Sean Egan <seanegan@gmail.com>
parents: 3296
diff changeset
362 g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add %s to his or her buddy list."),
3323
3e6e54051e67 [gaim-migrate @ 3341]
Sean Egan <seanegan@gmail.com>
parents: 3322
diff changeset
363 ap->user, ap->friend, ap->gc->username);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
365 // do_ask_dialog(msg, NULL, ap, _("Authorize"), msn_accept_add, _("Deny"), msn_cancel_add, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
366 } else if (!g_ascii_strncasecmp(buf, "BLP", 3)) {
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
367 char *type, *tmp = buf;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
368
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
369 GET_NEXT(tmp);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
370 GET_NEXT(tmp);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
371 GET_NEXT(tmp);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
372 type = tmp;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
373
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
374 if (!g_ascii_strcasecmp(type, "AL")) {
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
375 /* If the current setting is AL, messages
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
376 * from users who are not in BL will be delivered
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
377 *
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
378 * In other words, deny some */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
379 gc->account->permdeny = DENY_SOME;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
380 } else {
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
381 /* If the current
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
382 * setting is BL, only messages from people who are in the AL will be
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
383 * delivered.
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
384 *
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
385 * In other words, permit some */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
386 gc->account->permdeny = PERMIT_SOME;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
387 }
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
388 } else if (!g_ascii_strncasecmp(buf, "BPR", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
389 } else if (!g_ascii_strncasecmp(buf, "CHG", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
390 } else if (!g_ascii_strncasecmp(buf, "CHL", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 char *hash = buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 char buf2[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 md5_state_t st;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 md5_byte_t di[16];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 GET_NEXT(hash);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398 GET_NEXT(hash);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 md5_init(&st);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 md5_append(&st, (const md5_byte_t *)hash, strlen(hash));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 md5_append(&st, (const md5_byte_t *)"Q1P7W2E4J9R8U3S5", strlen("Q1P7W2E4J9R8U3S5"));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 md5_finish(&st, di);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
405 g_snprintf(sendbuf, sizeof(sendbuf), "QRY %u msmsgs@msnmsgr.com 32\r\n", ++md->trId);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 for (i = 0; i < 16; i++) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
408 strcat(sendbuf, buf2);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
411 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
412 hide_login_progress(gc, _("Unable to write to server"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 debug_printf("\n");
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
417 } else if (!g_ascii_strncasecmp(buf, "FLN", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418 char *usr = buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420 GET_NEXT(usr);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4729
diff changeset
421 serv_got_update(gc, usr, 0, 0, 0, 0, 0);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
422 } else if (!g_ascii_strncasecmp(buf, "GTC", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
423 } else if (!g_ascii_strncasecmp(buf, "INF", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
424 } else if (!g_ascii_strncasecmp(buf, "ILN", 3)) {
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
425 char *state, *user, *friend, *tmp = buf;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
426 int status = 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 state = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 user = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436 GET_NEXT(tmp);
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
437 friend = url_decode(tmp);
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
438
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
439 serv_got_alias(gc, user, friend);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
441 if (!g_ascii_strcasecmp(state, "BSY")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
442 status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
443 } else if (!g_ascii_strcasecmp(state, "IDL")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
444 status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
445 } else if (!g_ascii_strcasecmp(state, "BRB")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
446 status |= UC_UNAVAILABLE | (MSN_BRB << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
447 } else if (!g_ascii_strcasecmp(state, "AWY")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
448 status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
449 } else if (!g_ascii_strcasecmp(state, "PHN")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
450 status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
451 } else if (!g_ascii_strcasecmp(state, "LUN")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
452 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4729
diff changeset
455 serv_got_update(gc, user, 1, 0, 0, 0, status);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
456 } else if (!g_ascii_strncasecmp(buf, "LST", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457 char *which, *who, *friend, *tmp = buf;
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
458 struct msn_add_permit *ap; /* for any as yet undealt with buddies who've added you to their buddy list when you were off-line. How dare they! */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
459 GSList *perm = gc->account->permit; /* current permit list */
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
460 GSList *denyl = gc->account->deny;
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
461 char msg[MSN_BUF_LEN];
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
462 int new = 1;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
463 int pos, tot;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 which = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 GET_NEXT(tmp);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
471 pos = strtol(tmp, NULL, 10);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 GET_NEXT(tmp);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
473 tot = strtol(tmp, NULL, 10);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 who = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
478 friend = url_decode(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
480 if (!g_ascii_strcasecmp(which, "FL") && pos) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481 struct msn_buddy *b = g_new0(struct msn_buddy, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482 b->user = g_strdup(who);
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
483 b->friend = g_strdup(friend);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484 md->fl = g_slist_append(md->fl, b);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
485 } else if (!g_ascii_strcasecmp(which, "AL") && pos) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
486 if (g_slist_find_custom(gc->account->deny, who,
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
487 (GCompareFunc)strcmp)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
488 debug_printf("moving from deny to permit: %s", who);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
489 gaim_privacy_deny_remove(gc->account, who);
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
490 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
491 gaim_privacy_permit_add(gc->account, who);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
492 } else if (!g_ascii_strcasecmp(which, "BL") && pos) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
493 gaim_privacy_deny_add(gc->account, who);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
494 } else if (!g_ascii_strcasecmp(which, "RL")) {
3121
025a8042dd73 [gaim-migrate @ 3136]
Sean Egan <seanegan@gmail.com>
parents: 3119
diff changeset
495 if (pos) {
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
496 while(perm) {
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
497 if(!g_ascii_strcasecmp(perm->data, who))
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
498 new = 0;
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
499 perm = perm->next;
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
500 }
3018
63628fddf121 [gaim-migrate @ 3031]
Sean Egan <seanegan@gmail.com>
parents: 3013
diff changeset
501 while(denyl) {
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
502 if(!g_ascii_strcasecmp(denyl->data, who))
3018
63628fddf121 [gaim-migrate @ 3031]
Sean Egan <seanegan@gmail.com>
parents: 3013
diff changeset
503 new = 0;
63628fddf121 [gaim-migrate @ 3031]
Sean Egan <seanegan@gmail.com>
parents: 3013
diff changeset
504 denyl = denyl->next;
63628fddf121 [gaim-migrate @ 3031]
Sean Egan <seanegan@gmail.com>
parents: 3013
diff changeset
505 }
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
506 if(new) {
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
507 debug_printf("Unresolved MSN RL entry\n");
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
508 ap = g_new0(struct msn_add_permit, 1);
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
509 ap->user = g_strdup(who);
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
510 ap->friend = g_strdup(friend);
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
511 ap->gc = gc;
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
512
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
513 g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add you to their buddy list"),ap->user, ap->friend);
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
514 do_ask_dialog(msg, NULL, ap, _("Authorize"), msn_accept_add, _("Deny"), msn_cancel_add, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
515 }
3121
025a8042dd73 [gaim-migrate @ 3136]
Sean Egan <seanegan@gmail.com>
parents: 3119
diff changeset
516 }
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
517
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
518 if (pos != tot)
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
519 return 1; /* this isn't the last one in the RL, so return. */
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
520
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
521 g_snprintf(sendbuf, sizeof(sendbuf), "CHG %u NLN\r\n", ++md->trId);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
522 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
523 hide_login_progress(gc, _("Unable to write"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
524 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
525 return 0;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
526 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
527
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
528 account_online(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
529 serv_finish_login(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
530
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
531 md->permit = g_slist_copy(gc->account->permit);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
532 md->deny = g_slist_copy(gc->account->deny);
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
533
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 while (md->fl) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 struct msn_buddy *mb = md->fl->data;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
536 struct buddy *b = gaim_find_buddy(gc->account, mb->user);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 md->fl = g_slist_remove(md->fl, mb);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
538 if(!b) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
539 struct group *g;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
540 printf("I'm adding %s now..\n", mb->user);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
541 if (!(g = gaim_find_group(_("Buddies")))) {
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
542 printf("How could I not exitst!?!\n");
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
543 g = gaim_group_new(_("Buddies"));
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
544 gaim_blist_add_group(g, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
545 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
546 b = gaim_buddy_new(gc->account, mb->user, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
547 gaim_blist_add_buddy(b,g,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
548 }
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
549 serv_got_alias(gc, mb->user, mb->friend);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 g_free(mb->user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551 g_free(mb->friend);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
552 g_free(mb);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
553 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554 }
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
555 } else if (!g_ascii_strncasecmp(buf, "MSG", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 char *user, *tmp = buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 int length;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 user = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
563
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565 length = atoi(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
567 md->msg = TRUE;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
568 md->msguser = g_strdup(user);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
569 md->msglen = length;
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
570 } else if (!g_ascii_strncasecmp(buf, "NLN", 3)) {
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
571 char *state, *user, *friend, *tmp = buf;
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
572 int status = 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
573
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
574 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
575 state = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
577 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 user = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
579
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580 GET_NEXT(tmp);
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
581 friend = url_decode(tmp);
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
582
4227
a614423c648f [gaim-migrate @ 4471]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
583 serv_got_alias(gc, user, friend);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
585 if (!g_ascii_strcasecmp(state, "BSY")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
586 status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
587 } else if (!g_ascii_strcasecmp(state, "IDL")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
588 status |= UC_UNAVAILABLE | (MSN_IDLE << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
589 } else if (!g_ascii_strcasecmp(state, "BRB")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
590 status |= UC_UNAVAILABLE | (MSN_BRB << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
591 } else if (!g_ascii_strcasecmp(state, "AWY")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
592 status |= UC_UNAVAILABLE | (MSN_AWAY << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
593 } else if (!g_ascii_strcasecmp(state, "PHN")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
594 status |= UC_UNAVAILABLE | (MSN_PHONE << 1);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
595 } else if (!g_ascii_strcasecmp(state, "LUN")) {
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
596 status |= UC_UNAVAILABLE | (MSN_LUNCH << 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
598
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4729
diff changeset
599 serv_got_update(gc, user, 1, 0, 0, 0, status);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
600 } else if (!g_ascii_strncasecmp(buf, "OUT", 3)) {
2887
704e1685f89b [gaim-migrate @ 2900]
Rob Flynn <gaim@robflynn.com>
parents: 2870
diff changeset
601 char *tmp = buf;
704e1685f89b [gaim-migrate @ 2900]
Rob Flynn <gaim@robflynn.com>
parents: 2870
diff changeset
602
704e1685f89b [gaim-migrate @ 2900]
Rob Flynn <gaim@robflynn.com>
parents: 2870
diff changeset
603 GET_NEXT(tmp);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
604 if (!g_ascii_strncasecmp(tmp, "OTH", 3)) {
2889
fccda160c078 [gaim-migrate @ 2902]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2888
diff changeset
605 hide_login_progress(gc, _("You have been disconnected. You have "
fccda160c078 [gaim-migrate @ 2902]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2888
diff changeset
606 "signed on from another location."));
fccda160c078 [gaim-migrate @ 2902]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2888
diff changeset
607 signoff(gc);
fccda160c078 [gaim-migrate @ 2902]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2888
diff changeset
608 return 0;
2887
704e1685f89b [gaim-migrate @ 2900]
Rob Flynn <gaim@robflynn.com>
parents: 2870
diff changeset
609 }
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
610 } else if (!g_ascii_strncasecmp(buf, "PRP", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
611 } else if (!g_ascii_strncasecmp(buf, "QNG", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
612 } else if (!g_ascii_strncasecmp(buf, "QRY", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
613 } else if (!g_ascii_strncasecmp(buf, "REA", 3)) {
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
614 char *friend, *tmp = buf;
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
615
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
616 GET_NEXT(tmp);
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
617 GET_NEXT(tmp);
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
618 GET_NEXT(tmp);
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
619 GET_NEXT(tmp);
3456
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3448
diff changeset
620
b48065e52337 [gaim-migrate @ 3503]
Sean Egan <seanegan@gmail.com>
parents: 3448
diff changeset
621 friend = url_decode(tmp);
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
622
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
623 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
624 } else if (!g_ascii_strncasecmp(buf, "REM", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
625 } else if (!g_ascii_strncasecmp(buf, "RNG", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 struct msn_switchboard *ms;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 char *sessid, *ssaddr, *auth, *user;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 int port, i = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629 char *tmp = buf;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632 sessid = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635 ssaddr = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 auth = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 user = tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 while (ssaddr[i] && ssaddr[i] != ':') i++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647 if (ssaddr[i] == ':') {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 char *x = &ssaddr[i + 1];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 ssaddr[i] = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 port = atoi(x);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 } else
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 port = 1863;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 ms = g_new0(struct msn_switchboard, 1);
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
655 if (proxy_connect(gc->account, ssaddr, port, msn_rng_connect, ms) != 0) {
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
656 g_free(ms);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
657 return 1;
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
658 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 ms->user = g_strdup(user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 ms->sessid = g_strdup(sessid);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 ms->auth = g_strdup(auth);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662 ms->gc = gc;
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
663 } else if (!g_ascii_strncasecmp(buf, "URL", 3)) {
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
664 char *tmp = buf;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
665 FILE *fd;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
666 md5_state_t st;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
667 md5_byte_t di[16];
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
668 int i;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
669 char buf2[64];
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
670 char sendbuf[64];
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
671 char hippy[2048];
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
672 char *rru;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
673 char *passport;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
674
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
675 GET_NEXT(tmp);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
676 GET_NEXT(tmp);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
677 rru = tmp;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
678 GET_NEXT(tmp);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
679 passport = tmp;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
680
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
681 g_snprintf(hippy, sizeof(hippy), "%s%lu%s", md->mspauth, time(NULL) - md->sl, gc->password);
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
682
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
683 md5_init(&st);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
684 md5_append(&st, (const md5_byte_t *)hippy, strlen(hippy));
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
685 md5_finish(&st, di);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
686
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
687 bzero(sendbuf, sizeof(sendbuf));
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
688 for (i = 0; i < 16; i++) {
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
689 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
690 strcat(sendbuf, buf2);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
691 }
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
692
3195
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
693 if (md->passport) {
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
694 unlink(md->passport);
3231
b913fc07e18a [gaim-migrate @ 3248]
Jim Seymour <jseymour>
parents: 3200
diff changeset
695 g_free(md->passport);
3195
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
696 }
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
697
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
698 if( (fd = gaim_mkstemp(&(md->passport))) == NULL ) {
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
699 debug_printf("Error opening temp file: %s\n", strerror(errno));
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
700 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
701 else {
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
702 fputs("<html>\n"
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
703 "<head>\n"
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
704 "<noscript>\n"
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
705 "<meta http-equiv=Refresh content=\"0; url=http://www.hotmail.com\">\n"
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
706 "</noscript>\n"
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
707 "</head>\n\n", fd);
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
708
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
709 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
710 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", passport);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
711 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
712 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", gc->username);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
713 fprintf(fd, "<input type=\"hidden\" name=\"username\" value=\"%s\">\n", gc->username);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
714 fprintf(fd, "<input type=\"hidden\" name=\"sid\" value=\"%s\">\n", md->sid);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
715 fprintf(fd, "<input type=\"hidden\" name=\"kv\" value=\"%s\">\n", md->kv);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
716 fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
717 fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", time(NULL) - md->sl);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
718 fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", rru);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
719 fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", md->mspauth);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
720 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", sendbuf); // Digest me
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
721 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
722 fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
723 fprintf(fd, "</form></body>\n");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
724 fprintf(fd, "</html>\n");
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
725 if (fclose(fd)) {
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
726 debug_printf("Error closing temp file: %s\n", strerror(errno));
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
727 unlink(md->passport);
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
728 g_free(md->passport);
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
729 }
4462
ff6c275a57d4 [gaim-migrate @ 4737]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4460
diff changeset
730 else {
4464
e926d3bdfd14 [gaim-migrate @ 4739]
Christian Hammond <chipx86@chipx86.com>
parents: 4463
diff changeset
731 /*
e926d3bdfd14 [gaim-migrate @ 4739]
Christian Hammond <chipx86@chipx86.com>
parents: 4463
diff changeset
732 * Renaming file with .html extension, so that
e926d3bdfd14 [gaim-migrate @ 4739]
Christian Hammond <chipx86@chipx86.com>
parents: 4463
diff changeset
733 * win32 open_url will work.
e926d3bdfd14 [gaim-migrate @ 4739]
Christian Hammond <chipx86@chipx86.com>
parents: 4463
diff changeset
734 */
e926d3bdfd14 [gaim-migrate @ 4739]
Christian Hammond <chipx86@chipx86.com>
parents: 4463
diff changeset
735 char *tmp;
e926d3bdfd14 [gaim-migrate @ 4739]
Christian Hammond <chipx86@chipx86.com>
parents: 4463
diff changeset
736 if ((tmp = g_strdup_printf("%s.html", md->passport)) != NULL) {
e926d3bdfd14 [gaim-migrate @ 4739]
Christian Hammond <chipx86@chipx86.com>
parents: 4463
diff changeset
737 if (rename(md->passport, tmp) == 0) {
4462
ff6c275a57d4 [gaim-migrate @ 4737]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4460
diff changeset
738 g_free(md->passport);
ff6c275a57d4 [gaim-migrate @ 4737]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4460
diff changeset
739 md->passport = tmp;
ff6c275a57d4 [gaim-migrate @ 4737]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4460
diff changeset
740 } else
ff6c275a57d4 [gaim-migrate @ 4737]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4460
diff changeset
741 g_free(tmp);
ff6c275a57d4 [gaim-migrate @ 4737]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4460
diff changeset
742 }
ff6c275a57d4 [gaim-migrate @ 4737]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4460
diff changeset
743 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
744 }
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
745 } else if (!g_ascii_strncasecmp(buf, "SYN", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
746 } else if (!g_ascii_strncasecmp(buf, "USR", 3)) {
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
747 } else if (!g_ascii_strncasecmp(buf, "XFR", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748 char *host = strstr(buf, "SB");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750 int i = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 gboolean switchboard = TRUE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
752 char *tmp;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
754 if (!host) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755 host = strstr(buf, "NS");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
756 if (!host) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
757 hide_login_progress(gc, _("Got invalid XFR\n"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
759 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761 switchboard = FALSE;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764 GET_NEXT(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
765 while (host[i] && host[i] != ':') i++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 if (host[i] == ':') {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
767 tmp = &host[i + 1];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 host[i] = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 while (isdigit(*tmp)) tmp++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
770 *tmp++ = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
771 port = atoi(&host[i + 1]);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
772 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
773 port = 1863;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
774 tmp = host;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
775 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
776 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
777
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
778 if (switchboard) {
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
779 struct msn_switchboard *ms;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
780
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
781 GET_NEXT(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
782
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
783 ms = msn_switchboard_connect(gc, host, port);
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
784
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
785 if (ms == NULL)
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
786 return 1;
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
787
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
788 ms->auth = g_strdup(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
789 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
790 close(md->fd);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
791 gaim_input_remove(md->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
792 md->inpa = 0;
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
793 if (proxy_connect(gc->account, host, port, msn_login_xfr_connect, gc) != 0) {
4599
221fb7143cd4 [gaim-migrate @ 4884]
Luke Schierer <lschiere@pidgin.im>
parents: 4546
diff changeset
794 hide_login_progress(gc, _("Error transferring"));
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
795 signoff(gc);
2740
68ad186943e0 [gaim-migrate @ 2753]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2739
diff changeset
796 return 0;
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
797 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
798 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
799 } else if (isdigit(*buf)) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
800 handle_errcode(buf, TRUE);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
801 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802 debug_printf("Unhandled message!\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803 }
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
804
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
805 return 1;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
806 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
807
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
808 static void msn_process_main_msg(struct gaim_connection *gc, char *msg)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
809 {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
810 struct msn_data *md = gc->proto_data;
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
811 char *skiphead;
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
812 char *content;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
813
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
814 content = strstr(msg, "Content-Type: ");
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
815
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
816 if ((content) && (!g_ascii_strncasecmp(content, "Content-Type: text/x-msmsgsprofile",
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
817 strlen("Content-Type: text/x-msmsgsprofile")))) {
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
818
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
819 char *kv,*sid,*mspauth;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
820
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
821 kv = strstr(msg, "kv: ");
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
822 sid = strstr(msg, "sid: ");
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
823 mspauth = strstr(msg, "MSPAuth: ");
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
824
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
825 if (kv) {
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
826 char *tmp;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
827
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
828 kv += strlen("kv: ");
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
829 tmp = strstr(kv, "\r\n"); *tmp = 0;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
830 md->kv = g_strdup(kv);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
831 }
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
832
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
833 if (sid) {
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
834 char *tmp;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
835
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
836 sid += strlen("sid: ");
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
837 tmp = strstr(sid, "\r\n"); *tmp = 0;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
838 md->sid = g_strdup(sid);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
839 }
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
840
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
841 if (mspauth) {
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
842 char *tmp;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
843
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
844 mspauth += strlen("MSPAuth: ");
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
845 tmp = strstr(mspauth, "\r\n"); *tmp = 0;
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
846 md->mspauth = g_strdup(mspauth);
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
847 }
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
848
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
849 }
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
850
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
851
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
852
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
853 if (!g_ascii_strcasecmp(md->msguser, "hotmail")) {
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
854 handle_hotmail(gc, msg);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
855 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
856 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
857
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
858
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
859 skiphead = strstr(msg, "\r\n\r\n");
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
860 if (!skiphead || !skiphead[4])
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
861 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
862 skiphead += 4;
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
863 strip_linefeed(skiphead);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
864
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
865 serv_got_im(gc, md->msguser, skiphead, 0, time(NULL), -1);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
866 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
867
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
868 static void msn_callback(gpointer data, gint source, GaimInputCondition cond)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
869 {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
870 struct gaim_connection *gc = data;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
871 struct msn_data *md = gc->proto_data;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
872 char buf[MSN_BUF_LEN];
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
873 int cont = 1;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
874 int len;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
875
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
876 len = read(md->fd, buf, sizeof(buf));
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
877 if (len <= 0) {
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
878 hide_login_progress_error(gc, _("Error reading from server"));
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
879 signoff(gc);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
880 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
881 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
882
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
883 md->rxqueue = g_realloc(md->rxqueue, len + md->rxlen);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
884 memcpy(md->rxqueue + md->rxlen, buf, len);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
885 md->rxlen += len;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
886
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
887 while (cont) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
888 if (!md->rxlen)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
889 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
890
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
891 if (md->msg) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
892 char *msg;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
893 if (md->msglen > md->rxlen)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
894 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
895 msg = md->rxqueue;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
896 md->rxlen -= md->msglen;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
897 if (md->rxlen) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
898 md->rxqueue = g_memdup(msg + md->msglen, md->rxlen);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
899 } else {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
900 md->rxqueue = NULL;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
901 msg = g_realloc(msg, md->msglen + 1);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
902 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
903 msg[md->msglen] = 0;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
904 md->msglen = 0;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
905 md->msg = FALSE;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
906
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
907 msn_process_main_msg(gc, msg);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
908
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
909 g_free(md->msguser);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
910 g_free(msg);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
911 } else {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
912 char *end = md->rxqueue;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
913 int cmdlen;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
914 char *cmd;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
915 int i = 0;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
916
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
917 while (i + 1 < md->rxlen) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
918 if (*end == '\r' && end[1] == '\n')
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
919 break;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
920 end++; i++;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
921 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
922 if (i + 1 == md->rxlen)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
923 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
924
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
925 cmdlen = end - md->rxqueue + 2;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
926 cmd = md->rxqueue;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
927 md->rxlen -= cmdlen;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
928 if (md->rxlen) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
929 md->rxqueue = g_memdup(cmd + cmdlen, md->rxlen);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
930 } else {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
931 md->rxqueue = NULL;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
932 cmd = g_realloc(cmd, cmdlen + 1);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
933 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
934 cmd[cmdlen] = 0;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
935
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
936 debug_printf("MSN S: %s", cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
937 g_strchomp(cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
938 cont = msn_process_main(gc, cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
939
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
940 g_free(cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
941 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
942 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
943 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
944
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
945 static void msn_login_xfr_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
946 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
947 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
948 struct msn_data *md;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
949 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
950
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
951 if (!g_slist_find(connections, gc)) {
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
952 close(source);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
953 return;
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
954 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
955
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
956 md = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
957
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
958 if (md->fd != source)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
959 md->fd = source;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
960
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
961 if (md->fd == -1) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
962 hide_login_progress(gc, _("Unable to connect to Notification Server"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
963 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
964 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
965 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
966
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
967 g_snprintf(buf, sizeof(buf), "VER %u MSNP5\r\n", ++md->trId);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
968 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
969 hide_login_progress(gc, _("Unable to talk to Notification Server"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
970 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
971 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
972 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
973
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
974 md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_login_callback, gc);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
975 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
976
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
977 static int msn_process_login(struct gaim_connection *gc, char *buf)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
978 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
979 struct msn_data *md = gc->proto_data;
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
980 char sendbuf[MSN_BUF_LEN];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
981
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
982 if (!g_ascii_strncasecmp(buf, "VER", 3)) {
2226
2a09a177ed5f [gaim-migrate @ 2236]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2219
diff changeset
983 /* we got VER, check to see that MSNP5 is in the list, then send INF */
2a09a177ed5f [gaim-migrate @ 2236]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2219
diff changeset
984 if (!strstr(buf, "MSNP5")) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
985 hide_login_progress(gc, _("Protocol not supported"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
986 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
987 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
988 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
989
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
990 g_snprintf(sendbuf, sizeof(sendbuf), "INF %u\r\n", ++md->trId);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
991 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
992 hide_login_progress(gc, _("Unable to request INF\n"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
993 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
994 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
995 }
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
996 } else if (!g_ascii_strncasecmp(buf, "INF", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
997 /* check to make sure we can use md5 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
998 if (!strstr(buf, "MD5")) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
999 hide_login_progress(gc, _("Unable to login using MD5"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1000 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1001 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1002 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1003
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1004 g_snprintf(sendbuf, sizeof(sendbuf), "USR %u MD5 I %s\r\n", ++md->trId, gc->username);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1005 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1006 hide_login_progress(gc, _("Unable to send USR\n"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1007 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1008 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1009 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1010
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1011 set_login_progress(gc, 3, _("Requesting to send password"));
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
1012 } else if (!g_ascii_strncasecmp(buf, "USR", 3)) {
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1013 char *resp, *friend, *tmp = buf;
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1014
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1015 GET_NEXT(tmp);
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1016 GET_NEXT(tmp);
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1017 resp = tmp;
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1018 GET_NEXT(tmp);
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1019 GET_NEXT(tmp);
3323
3e6e54051e67 [gaim-migrate @ 3341]
Sean Egan <seanegan@gmail.com>
parents: 3322
diff changeset
1020 friend = url_decode(tmp);
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1021 GET_NEXT(tmp);
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1022
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1023 /* so here, we're either getting the challenge or the OK */
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
1024 if (!g_ascii_strcasecmp(resp, "OK")) {
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1025 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend);
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1026
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1027 g_snprintf(sendbuf, sizeof(sendbuf), "SYN %u 0\r\n", ++md->trId);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1028 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1029 hide_login_progress(gc, _("Unable to write"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1030 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1031 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1032 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1033
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1034 gaim_input_remove(md->inpa);
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1035 md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_callback, gc);
2739
7aeedbf29a96 [gaim-migrate @ 2752]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2738
diff changeset
1036 return 0;
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
1037 } else if (!g_ascii_strcasecmp(resp, "MD5")) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1038 char buf2[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1039 md5_state_t st;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1040 md5_byte_t di[16];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1041 int i;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1042
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1043 g_snprintf(buf2, sizeof(buf2), "%s%s", friend, gc->password);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1044
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1045 md5_init(&st);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1046 md5_append(&st, (const md5_byte_t *)buf2, strlen(buf2));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1047 md5_finish(&st, di);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1048
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1049 g_snprintf(sendbuf, sizeof(sendbuf), "USR %u MD5 S ", ++md->trId);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1050 for (i = 0; i < 16; i++) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1051 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1052 strcat(sendbuf, buf2);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1053 }
3321
1a1a4243a12c [gaim-migrate @ 3339]
Adam Fritzler <mid@auk.cx>
parents: 3299
diff changeset
1054 strcat(sendbuf, "\r\n");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1055
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1056 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1057 hide_login_progress(gc, _("Unable to send password"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1058 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1059 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1060 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1061
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1062 set_login_progress(gc, 4, _("Password sent"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1063 }
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
1064 } else if (!g_ascii_strncasecmp(buf, "XFR", 3)) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1065 char *host = strstr(buf, "NS");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1066 int port;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1067 int i = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1068
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1069 if (!host) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1070 hide_login_progress(gc, _("Got invalid XFR\n"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1071 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1072 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1073 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1074
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1075 GET_NEXT(host);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1076 while (host[i] && host[i] != ':') i++;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1077 if (host[i] == ':') {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1078 char *x = &host[i + 1];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1079 host[i] = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1080 port = atoi(x);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1081 } else
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1082 port = 1863;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1083
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1084 close(md->fd);
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1085 gaim_input_remove(md->inpa);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1086 md->inpa = 0;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1087 md->fd = 0;
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
1088 md->sl = time(NULL);
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
1089 if (proxy_connect(gc->account, host, port, msn_login_xfr_connect, gc) != 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1090 hide_login_progress(gc, _("Unable to transfer"));
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
1091 signoff(gc);
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
1092 }
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1093 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1094 } else {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1095 if (isdigit(*buf))
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1096 hide_login_progress(gc, handle_errcode(buf, FALSE));
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1097 else
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1098 hide_login_progress(gc, _("Unable to parse message"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1099 signoff(gc);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1100 return 0;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1101 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1102
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1103 return 1;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1104 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1105
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1106 static void msn_login_callback(gpointer data, gint source, GaimInputCondition cond)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1107 {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1108 struct gaim_connection *gc = data;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1109 struct msn_data *md = gc->proto_data;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1110 char buf[MSN_BUF_LEN];
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1111 int cont = 1;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1112 int len;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1113
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1114 len = read(md->fd, buf, sizeof(buf));
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1115 if (len <= 0) {
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1116 hide_login_progress(gc, _("Error reading from server"));
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1117 signoff(gc);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1118 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1119 }
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1120
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1121 md->rxqueue = g_realloc(md->rxqueue, len + md->rxlen);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1122 memcpy(md->rxqueue + md->rxlen, buf, len);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1123 md->rxlen += len;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1124
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1125 while (cont) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1126 char *end = md->rxqueue;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1127 int cmdlen;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1128 char *cmd;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1129 int i = 0;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1130
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1131 if (!md->rxlen)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1132 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1133
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1134 while (i + 1 < md->rxlen) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1135 if (*end == '\r' && end[1] == '\n')
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1136 break;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1137 end++; i++;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1138 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1139 if (i + 1 == md->rxlen)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1140 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1141
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1142 cmdlen = end - md->rxqueue + 2;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1143 cmd = md->rxqueue;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1144 md->rxlen -= cmdlen;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1145 if (md->rxlen) {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1146 md->rxqueue = g_memdup(cmd + cmdlen, md->rxlen);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1147 } else {
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1148 md->rxqueue = NULL;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1149 cmd = g_realloc(cmd, cmdlen + 1);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1150 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1151 cmd[cmdlen] = 0;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1152
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1153 debug_printf("MSN S: %s", cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1154 g_strchomp(cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1155 cont = msn_process_login(gc, cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1156
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1157 g_free(cmd);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1158 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1159 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1160
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1161 static void msn_login_connect(gpointer data, gint source, GaimInputCondition cond)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1162 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1163 struct gaim_connection *gc = data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1164 struct msn_data *md;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1165 char buf[1024];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1166
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1167 if (!g_slist_find(connections, gc)) {
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1168 close(source);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1169 return;
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2170
diff changeset
1170 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1171
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1172 md = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1173
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1174 if (md->fd != source)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1175 md->fd = source;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1176
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1177 if (md->fd == -1) {
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1178 hide_login_progress(gc, _("Unable to connect"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1179 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1180 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1181 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1182
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1183 g_snprintf(buf, sizeof(buf), "VER %u MSNP5\r\n", ++md->trId);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1184 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1185 hide_login_progress(gc, _("Unable to write to server"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1186 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1187 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1188 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1189
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1190 md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_login_callback, gc);
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1191 set_login_progress(gc, 2,_("Synching with server"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1192 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1193
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1194 static void msn_login(struct gaim_account *account)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1195 {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1196 struct gaim_connection *gc = new_gaim_conn(account);
4460
23af9ba33ca4 [gaim-migrate @ 4735]
Nathan Walp <nwalp@pidgin.im>
parents: 4459
diff changeset
1197 gc->proto_data = g_new0(struct msn_data, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1198
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1199 set_login_progress(gc, 1, _("Connecting"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1200
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1201 g_snprintf(gc->username, sizeof(gc->username), "%s", msn_normalize(gc->username));
4455
c7aae8902e5e [gaim-migrate @ 4730]
Nathan Walp <nwalp@pidgin.im>
parents: 4452
diff changeset
1202
4634
d19872836812 [gaim-migrate @ 4941]
Nathan Walp <nwalp@pidgin.im>
parents: 4606
diff changeset
1203 if (proxy_connect(account, account->proto_opt[USEROPT_MSNSERVER][0] ?
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1204 account->proto_opt[USEROPT_MSNSERVER] : MSN_SERVER,
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1205 account->proto_opt[USEROPT_MSNPORT][0] ?
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1206 atoi(account->proto_opt[USEROPT_MSNPORT]) : MSN_PORT,
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1207 msn_login_connect, gc) != 0) {
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1208 hide_login_progress(gc, _("Unable to connect"));
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
1209 signoff(gc);
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
1210 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1211 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1212
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1213 static void msn_close(struct gaim_connection *gc)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1214 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1215 struct msn_data *md = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1216 close(md->fd);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1217 if (md->inpa)
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
1218 gaim_input_remove(md->inpa);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1219 g_free(md->rxqueue);
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1220 if (md->msg)
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
1221 g_free(md->msguser);
3195
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
1222 if (md->passport) {
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
1223 unlink(md->passport);
3231
b913fc07e18a [gaim-migrate @ 3248]
Jim Seymour <jseymour>
parents: 3200
diff changeset
1224 g_free(md->passport);
3195
92a763567ddc [gaim-migrate @ 3212]
Sean Egan <seanegan@gmail.com>
parents: 3175
diff changeset
1225 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1226 while (md->switches)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1227 msn_kill_switch(md->switches->data);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1228 while (md->fl) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1229 struct msn_buddy *tmp = md->fl->data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1230 md->fl = g_slist_remove(md->fl, tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1231 g_free(tmp->user);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1232 g_free(tmp->friend);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1233 g_free(tmp);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1234 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1235 g_slist_free(md->permit);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1236 g_slist_free(md->deny);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1237 g_free(md);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1238 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1239
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
1240 static int msn_send_typing(struct gaim_connection *gc, char *who, int typing) {
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1241 struct msn_switchboard *ms = msn_find_switch(gc, who);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1242 char header[MSN_BUF_LEN] = "MIME-Version: 1.0\r\n"
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1243 "Content-Type: text/x-msmsgscontrol\r\n"
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1244 "TypingUser: ";
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1245 char buf [MSN_BUF_LEN];
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
1246 if (!ms || !typing)
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
1247 return 0;
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1248 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s%s\r\n\r\n\r\n",
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1249 ++ms->trId,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1250 strlen(header) + strlen("\r\n\r\n\r\n") + strlen(gc->username),
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1251 header, gc->username);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1252 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1253 msn_kill_switch(ms);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1254 return MSN_TYPING_SEND_TIMEOUT;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1255 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
1256
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
1257 #if 0
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1258 static void msn_file_transfer_cancel(struct gaim_connection *gc,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1259 struct file_transfer *xfer)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1260 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1261 struct msn_data *md = gc->proto_data;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1262 struct msn_file_transfer *mft = find_mft_by_xfer(gc, xfer);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1263 struct msn_switchboard *ms = msn_find_switch(gc, mft->sn);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1264 char header[MSN_BUF_LEN];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1265 char buf[MSN_BUF_LEN];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1266
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1267 if (!ms || !mft)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1268 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1269 debug_printf("Eep! Returning from msn_file_transfer_cancel early");
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1270 return;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1271 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1272
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1273 g_snprintf(header, sizeof(header),
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1274 "MIME-Version: 1.0\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1275 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1276 "Invitation-Command: CANCEL\r\n"
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1277 "Invitation-Cookie: %lu\r\n"
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1278 "Cancel-Code: REJECT\r\n",
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1279 (unsigned long)mft->cookie);
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1280
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1281 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s\r\n\r\n",
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1282 ++ms->trId, strlen(header) + strlen("\r\n\r\n"),
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1283 header);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1284
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1285 md->file_transfers = g_slist_remove(md->file_transfers, mft);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1286
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1287 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1288 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1289 debug_printf("Uh oh! Killing switch.\n");
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1290 msn_kill_switch(ms);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1291 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1292 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1293
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1294 static void msn_file_transfer_in(struct gaim_connection *gc,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1295 struct file_transfer *xfer, int offset)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1296 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1297 struct msn_file_transfer *mft = find_mft_by_xfer(gc, xfer);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1298 struct msn_switchboard *ms = msn_find_switch(gc, mft->sn);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1299 char header[MSN_BUF_LEN];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1300 char buf[MSN_BUF_LEN];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1301
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1302 if (!ms || !mft)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1303 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1304 debug_printf("Eep! Returning from msn_file_transfer_in early");
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1305 return;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1306 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1307
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1308 g_snprintf(header, sizeof(header),
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1309 "MIME-Version: 1.0\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1310 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1311 "Invitation-Command: ACCEPT\r\n"
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1312 "Invitation-Cookie: %lu\r\n"
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1313 "Launch-Application: FALSE\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1314 "Request-Data: IP-Address:\r\n",
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1315 (unsigned long)mft->cookie);
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1316
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1317 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s\r\n\r\n",
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1318 ++ms->trId, strlen(header) + strlen("\r\n\r\n"),
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1319 header);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1320
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1321 if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1322 msn_kill_switch(ms);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1323 return;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1324 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1325
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1326 mft->xfer = xfer;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1327 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1328
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1329 static void msn_file_transfer_out(struct gaim_connection *gc,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1330 struct file_transfer *xfer,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1331 const char *name, int totfiles, int totsize)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1332 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1333 struct msn_file_transfer *mft = find_mft_by_xfer(gc, xfer);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1334 struct msn_switchboard *ms = msn_find_switch(gc, mft->sn);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1335 char header[MSN_BUF_LEN];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1336 char buf[MSN_BUF_LEN];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1337 struct stat sb;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1338
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1339 if (!ms)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1340 return;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1341
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1342 if (totfiles > 1)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1343 return;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1344
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1345 if (stat(name, &sb) == -1)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1346 return;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1347
5166
cab5cd204956 [gaim-migrate @ 5530]
Mark Doliner <mark@kingant.net>
parents: 5155
diff changeset
1348 mft->cookie = 1 + (guint32)(4294967295.0 * rand() / (RAND_MAX + 1.0));
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1349
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1350 g_snprintf(header, sizeof(header),
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1351 "MIME-Version: 1.0\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1352 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1353 "Application-Name: File Transfer\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1354 "Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1355 "Invitation-Command: INVITE\r\n"
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1356 "Invitation-Cookie: %lu\r\n"
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1357 "Application-File: %s\r\n"
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1358 "Application-FileSize: %ld\r\n",
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1359 (unsigned long)mft->cookie, name, sb.st_size);
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1360
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1361 g_snprintf(buf, sizeof(buf), "MSG %u A %d\r\n%s\r\n\r\n",
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1362 ++ms->trId,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1363 strlen(header) + strlen("\r\n\r\n"),
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1364 header);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1365
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1366 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1367 msn_kill_switch(ms);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1368
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1369 debug_printf("\n");
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1370 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1371
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1372 static void msn_file_transfer_done(struct gaim_connection *gc,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1373 struct file_transfer *xfer)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1374 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1375 struct msn_data *md = (struct msn_data *)gc->proto_data;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1376 struct msn_file_transfer *mft = find_mft_by_xfer(gc, xfer);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1377 char buf[MSN_BUF_LEN];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1378
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1379 g_snprintf(buf, sizeof(buf), "BYE 16777989\r\n");
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1380
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1381 msn_write(mft->fd, buf, strlen(buf));
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1382
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1383 md->file_transfers = g_slist_remove(md->file_transfers, mft);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1384
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1385 gaim_input_remove(mft->inpa);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1386
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1387 close(mft->fd);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1388
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1389 g_free(mft->filename);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1390 g_free(mft->sn);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1391 g_free(mft);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1392 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1393
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1394 static size_t msn_file_transfer_read(struct gaim_connection *gc,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1395 struct file_transfer *xfer, int fd,
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1396 char **buf)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1397 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1398 unsigned char header[3];
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1399 size_t len, size;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1400
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1401 if (read(fd, header, sizeof(header)) < 3)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1402 return 0;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1403
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1404 if (header[0] != 0) {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1405 debug_printf("Invalid header[0]: %d. Aborting.\n", header[0]);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1406 return 0;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1407 }
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1408
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1409 size = header[1] | (header[2] << 8);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1410
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1411 *buf = g_new0(char, size);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1412
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1413 for (len = 0; len < size; len += read(fd, *buf + len, size - len));
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1414
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1415 return len;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1416 }
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
1417 #endif
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1418
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
1419 static int msn_send_im(struct gaim_connection *gc, const char *who, const char *message, int len, int flags)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1420 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1421 struct msn_data *md = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1422 struct msn_switchboard *ms = msn_find_switch(gc, who);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1423 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1424
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1425 if (ms) {
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1426 char *send;
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1427
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1428 if (ms->txqueue) {
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1429 debug_printf("appending to queue\n");
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1430 ms->txqueue = g_slist_append(ms->txqueue, g_strdup(message));
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1431 return 1;
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1432 }
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1433
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2600
diff changeset
1434 send = add_cr(message);
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1435 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s%s", ++ms->trId,
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1436 strlen(MIME_HEADER) + strlen(send),
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1437 MIME_HEADER, send);
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2600
diff changeset
1438 g_free(send);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1439 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1440 msn_kill_switch(ms);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1441 debug_printf("\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1442 } else if (strcmp(who, gc->username)) {
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1443 g_snprintf(buf, MSN_BUF_LEN, "XFR %u SB\r\n", ++md->trId);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1444 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1445 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1446 signoff(gc);
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2273
diff changeset
1447 return 1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1448 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1449
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1450 ms = g_new0(struct msn_switchboard, 1);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1451 md->switches = g_slist_append(md->switches, ms);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1452 ms->user = g_strdup(who);
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1453 ms->txqueue = g_slist_append(ms->txqueue, g_strdup(message));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1454 ms->gc = gc;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1455 ms->fd = -1;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1456 } else
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1457 /* in msn you can't send messages to yourself, so we'll fake like we received it ;) */
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2842
diff changeset
1458 serv_got_im(gc, who, message, flags | IM_FLAG_GAIMUSER, time(NULL), -1);
2303
f5bf315e6104 [gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2273
diff changeset
1459 return 1;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1460 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1461
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1462 static int msn_chat_send(struct gaim_connection *gc, int id, char *message)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1463 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1464 struct msn_switchboard *ms = msn_find_switch_by_id(gc, id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1465 char buf[MSN_BUF_LEN];
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1466 char *send;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1467
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1468 if (!ms)
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1469 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1470
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2600
diff changeset
1471 send = add_cr(message);
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1472 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s%s", ++ms->trId,
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1473 strlen(MIME_HEADER) + strlen(send),
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1474 MIME_HEADER, send);
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2600
diff changeset
1475 g_free(send);
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1476 if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1477 msn_kill_switch(ms);
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1478 return 0;
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1479 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1480 debug_printf("\n");
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1481 serv_got_chat_in(gc, id, gc->username, 0, message, time(NULL));
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2162
diff changeset
1482 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1483 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1484
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1485 static void msn_chat_invite(struct gaim_connection *gc, int id, const char *msg, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1486 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1487 struct msn_switchboard *ms = msn_find_switch_by_id(gc, id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1488 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1489
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1490 if (!ms)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1491 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1492
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1493 g_snprintf(buf, sizeof(buf), "CAL %u %s\r\n", ++ms->trId, who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1494 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1495 msn_kill_switch(ms);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1496 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1497
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1498 static void msn_chat_leave(struct gaim_connection *gc, int id)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1499 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1500 struct msn_switchboard *ms = msn_find_switch_by_id(gc, id);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1501 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1502
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1503 if (!ms)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1504 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1505
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2600
diff changeset
1506 g_snprintf(buf, sizeof(buf), "OUT\r\n");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1507 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1508 msn_kill_switch(ms);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1509 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1510
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
1511 static GList *msn_away_states(struct gaim_connection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1512 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1513 GList *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1514
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1515 m = g_list_append(m, _("Available"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1516 m = g_list_append(m, _("Away From Computer"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1517 m = g_list_append(m, _("Be Right Back"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1518 m = g_list_append(m, _("Busy"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1519 m = g_list_append(m, _("On The Phone"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1520 m = g_list_append(m, _("Out To Lunch"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
1521 m = g_list_append(m, _("Hidden"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1522
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1523 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1524 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1525
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1526 static void msn_set_away(struct gaim_connection *gc, char *state, char *msg)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1527 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1528 struct msn_data *md = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1529 char buf[MSN_BUF_LEN];
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1530 const char *away;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1531
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
1532 if (gc->away) {
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
1533 g_free(gc->away);
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
1534 gc->away = NULL;
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
1535 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1536
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1537 if (msg) {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
1538 gc->away = g_strdup("");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1539 away = "AWY";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1540 } else if (state) {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
1541 gc->away = g_strdup("");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1542
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
1543 if (!strcmp(state, _("Away From Computer")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1544 away = "AWY";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
1545 else if (!strcmp(state, _("Be Right Back")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1546 away = "BRB";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
1547 else if (!strcmp(state, _("Busy")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1548 away = "BSY";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
1549 else if (!strcmp(state, _("On The Phone")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1550 away = "PHN";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
1551 else if (!strcmp(state, _("Out To Lunch")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1552 away = "LUN";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
1553 else if (!strcmp(state, _("Hidden")))
2152
f631cfc8e824 [gaim-migrate @ 2162]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2123
diff changeset
1554 away = "HDN";
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1555 else {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
1556 g_free(gc->away);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1557 gc->away = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1558 away = "NLN";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1559 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1560 } else if (gc->is_idle)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1561 away = "IDL";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1562 else
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1563 away = "NLN";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1564
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1565 g_snprintf(buf, sizeof(buf), "CHG %u %s\r\n", ++md->trId, away);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1566 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1567 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1568 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1569 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1570 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1571 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1572
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1573 static void msn_set_idle(struct gaim_connection *gc, int idle)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1574 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1575 struct msn_data *md = gc->proto_data;
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1576 char buf[64];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1577
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1578 if (gc->away)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1579 return;
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1580 g_snprintf(buf, sizeof(buf),
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1581 idle ? "CHG %d IDL\r\n" : "CHG %u NLN\r\n", ++md->trId);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1582 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1583 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1584 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1585 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1586 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1587 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1588
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
1589 static const char *msn_list_icon(struct gaim_account *a, struct buddy *b)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1590 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
1591 return "msn";
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
1592 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1593
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1594 static void msn_list_emblems(struct buddy *b, char **se, char **sw, char **nw, char **ne)
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1595 {
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5022
diff changeset
1596 if (b->present == GAIM_BUDDY_OFFLINE)
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1597 *se = "offline";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1598 else if (b->uc >> 1 == 2 || b->uc >> 1 == 6)
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1599 *se = "occupied";
5022
7e5f449de3b8 [gaim-migrate @ 5358]
Sean Egan <seanegan@gmail.com>
parents: 4966
diff changeset
1600 else if (b->uc)
7e5f449de3b8 [gaim-migrate @ 5358]
Sean Egan <seanegan@gmail.com>
parents: 4966
diff changeset
1601 *se = "away";
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1602 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
1603
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1604 static char *msn_get_away_text(int s)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1605 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1606 switch (s) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1607 case MSN_BUSY :
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1608 return _("Busy");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1609 case MSN_BRB :
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4599
diff changeset
1610 return _("Be Right Back");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1611 case MSN_AWAY :
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4599
diff changeset
1612 return _("Away From Computer");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1613 case MSN_PHONE :
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4599
diff changeset
1614 return _("On The Phone");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1615 case MSN_LUNCH :
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4599
diff changeset
1616 return _("Out To Lunch");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1617 case MSN_IDLE :
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1618 return _("Idle");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1619 default:
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1620 return _("Available");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1621 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1622 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1623
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
1624 #if 0
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1625 static void msn_ask_send_file(struct gaim_connection *gc, char *destsn)
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1626 {
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1627 struct msn_data *md = (struct msn_data *)gc->proto_data;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1628 struct msn_file_transfer *mft = g_new0(struct msn_file_transfer, 1);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1629
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1630 mft->type = MFT_SENDFILE_OUT;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1631 mft->sn = g_strdup(destsn);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1632 mft->gc = gc;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1633
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1634 md->file_transfers = g_slist_append(md->file_transfers, mft);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1635
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1636 mft->xfer = transfer_out_add(gc, mft->sn);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1637 }
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
1638 #endif
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4729
diff changeset
1639 static char *msn_status_text(struct buddy *b) {
4723
39068784aa08 [gaim-migrate @ 5035]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
1640 if (b->uc & UC_UNAVAILABLE)
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4732
diff changeset
1641 return g_strdup(msn_get_away_text(b->uc >> 1));
4723
39068784aa08 [gaim-migrate @ 5035]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
1642 return NULL;
39068784aa08 [gaim-migrate @ 5035]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
1643 }
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1644
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4729
diff changeset
1645 static char *msn_tooltip_text(struct buddy *b) {
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5022
diff changeset
1646 if (GAIM_BUDDY_IS_ONLINE(b))
4920
a7f77d07783b [gaim-migrate @ 5254]
Sean Egan <seanegan@gmail.com>
parents: 4916
diff changeset
1647 return g_strdup_printf(_("<b>Status:</b> %s"), msn_get_away_text(b->uc >> 1));
4921
d5c136474f26 [gaim-migrate @ 5255]
Nathan Walp <nwalp@pidgin.im>
parents: 4920
diff changeset
1648
d5c136474f26 [gaim-migrate @ 5255]
Nathan Walp <nwalp@pidgin.im>
parents: 4920
diff changeset
1649 return NULL;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4723
diff changeset
1650 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4723
diff changeset
1651
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5068
diff changeset
1652 static GList *msn_buddy_menu(struct gaim_connection *gc, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1653 {
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2169
diff changeset
1654 GList *m = NULL;
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
1655 #if 0
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2169
diff changeset
1656 struct proto_buddy_menu *pbm;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
1657 struct buddy *b = gaim_find_buddy(gc->account, who);
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2169
diff changeset
1658 static char buf[MSN_BUF_LEN];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1659
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1660 pbm = g_new0(struct proto_buddy_menu, 1);
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1661 pbm->label = _("Send File");
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1662 pbm->callback = msn_ask_send_file;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1663 pbm->gc = gc;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1664 m = g_list_append(m, pbm);
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
1665
2501
227cc42ffa6e [gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
1666 if (!b || !(b->uc >> 1))
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2169
diff changeset
1667 return m;
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
1668 #endif
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1669
4723
39068784aa08 [gaim-migrate @ 5035]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
1670
2170
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2169
diff changeset
1671
c24595d3c364 [gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2169
diff changeset
1672 return m;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1673 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1674
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1675 static void msn_add_buddy(struct gaim_connection *gc, const char *name)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1676 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1677 struct msn_data *md = gc->proto_data;
2588
a3117e29317d [gaim-migrate @ 2601]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
1678 char *who = msn_normalize(name);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1679 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1680 GSList *l = md->fl;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1681
2600
8aade06646b5 [gaim-migrate @ 2613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1682 if (who[0] == '@')
8aade06646b5 [gaim-migrate @ 2613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1683 /* how did this happen? */
8aade06646b5 [gaim-migrate @ 2613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1684 return;
8aade06646b5 [gaim-migrate @ 2613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
1685
2953
fa76b0156259 [gaim-migrate @ 2966]
Rob Flynn <gaim@robflynn.com>
parents: 2952
diff changeset
1686 if (strchr(who, ' '))
2952
7a32dca869a8 [gaim-migrate @ 2965]
Rob Flynn <gaim@robflynn.com>
parents: 2932
diff changeset
1687 /* This is a broken blist entry. */
7a32dca869a8 [gaim-migrate @ 2965]
Rob Flynn <gaim@robflynn.com>
parents: 2932
diff changeset
1688 return;
7a32dca869a8 [gaim-migrate @ 2965]
Rob Flynn <gaim@robflynn.com>
parents: 2932
diff changeset
1689
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1690 while (l) {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1691 struct msn_buddy *b = l->data;
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4745
diff changeset
1692 if (!gaim_utf8_strcasecmp(who, b->user))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1693 break;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1694 l = l->next;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1695 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1696 if (l)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1697 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1698
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1699 g_snprintf(buf, sizeof(buf), "ADD %u FL %s %s\r\n", ++md->trId, who, who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1700 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1701 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1702 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1703 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1704 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1705 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1706
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2665
diff changeset
1707 static void msn_rem_buddy(struct gaim_connection *gc, char *who, char *group)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1708 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1709 struct msn_data *md = gc->proto_data;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1710 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1711
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1712 g_snprintf(buf, sizeof(buf), "REM %u FL %s\r\n", ++md->trId, who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1713 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1714 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1715 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1716 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1717 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1718 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1719
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1720 static void msn_act_id(gpointer data, char *entry)
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1721 {
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1722 struct gaim_connection *gc = data;
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1723 struct msn_data *md = gc->proto_data;
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1724 char buf[MSN_BUF_LEN];
3323
3e6e54051e67 [gaim-migrate @ 3341]
Sean Egan <seanegan@gmail.com>
parents: 3322
diff changeset
1725 char *alias;
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1726
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3456
diff changeset
1727 if (!entry || *entry == '\0')
3448
0a0cc45267d4 [gaim-migrate @ 3490]
Sean Egan <seanegan@gmail.com>
parents: 3447
diff changeset
1728 alias = g_strdup("");
0a0cc45267d4 [gaim-migrate @ 3490]
Sean Egan <seanegan@gmail.com>
parents: 3447
diff changeset
1729 else
3642
5e50f6746509 [gaim-migrate @ 3766]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1730 alias = g_strdup(entry);
3323
3e6e54051e67 [gaim-migrate @ 3341]
Sean Egan <seanegan@gmail.com>
parents: 3322
diff changeset
1731
3e6e54051e67 [gaim-migrate @ 3341]
Sean Egan <seanegan@gmail.com>
parents: 3322
diff changeset
1732 if (strlen(alias) >= BUDDY_ALIAS_MAXLEN) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1733 do_error_dialog(_("New MSN friendly name too long."), NULL, GAIM_ERROR);
3020
c3a29bd2a2d7 [gaim-migrate @ 3033]
Sean Egan <seanegan@gmail.com>
parents: 3018
diff changeset
1734 return;
c3a29bd2a2d7 [gaim-migrate @ 3033]
Sean Egan <seanegan@gmail.com>
parents: 3018
diff changeset
1735 }
c3a29bd2a2d7 [gaim-migrate @ 3033]
Sean Egan <seanegan@gmail.com>
parents: 3018
diff changeset
1736
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1737 g_snprintf(buf, sizeof(buf), "REA %u %s %s\r\n", ++md->trId, gc->username, url_encode(alias));
3323
3e6e54051e67 [gaim-migrate @ 3341]
Sean Egan <seanegan@gmail.com>
parents: 3322
diff changeset
1738 g_free(alias);
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1739 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1740 hide_login_progress(gc, _("Write error"));
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1741 signoff(gc);
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1742 return;
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1743 }
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1744 }
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1745
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1746 static void msn_show_set_friendly_name(struct gaim_connection *gc)
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1747 {
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1748 do_prompt_dialog(_("Set Friendly Name:"), gc->displayname, gc, msn_act_id, NULL);
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1749 }
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1750
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1751 static GList *msn_actions(struct gaim_connection *gc)
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1752 {
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1753 GList *m = NULL;
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1754 struct proto_actions_menu *pam;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1755
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1756 pam = g_new0(struct proto_actions_menu, 1);
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1757 pam->label = _("Set Friendly Name");
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1758 pam->callback = msn_show_set_friendly_name;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1759 pam->gc = gc;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4321
diff changeset
1760 m = g_list_append(m, pam);
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1761
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1762 return m;
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1763 }
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1764
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1765 static void msn_convo_closed(struct gaim_connection *gc, char *who)
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1766 {
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1767 struct msn_switchboard *ms = msn_find_switch(gc, who);
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1768
4069
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1769 if (ms) {
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1770 char sendbuf[256];
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1771
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1772 g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n", gc->username);
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1773
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1774 msn_write(ms->fd, sendbuf, strlen(sendbuf));
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1775
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1776 msn_kill_switch(ms);
4069
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
1777 }
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1778 }
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
1779
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1780 static void msn_keepalive(struct gaim_connection *gc)
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1781 {
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1782 struct msn_data *md = gc->proto_data;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1783 char buf[MSN_BUF_LEN];
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1784
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2600
diff changeset
1785 g_snprintf(buf, sizeof(buf), "PNG\r\n");
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1786 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1787 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1788 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1789 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1790 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1791 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1792
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1793 static void msn_set_permit_deny(struct gaim_connection *gc)
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1794 {
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1795 struct msn_data *md = gc->proto_data;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1796 char buf[MSN_BUF_LEN];
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1797 GSList *s, *t = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1798
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1799 if (gc->account->permdeny == PERMIT_ALL || gc->account->permdeny == DENY_SOME)
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1800 g_snprintf(buf, sizeof(buf), "BLP %u AL\r\n", ++md->trId);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1801 else
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1802 g_snprintf(buf, sizeof(buf), "BLP %u BL\r\n", ++md->trId);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1803
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1804 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1805 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1806 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1807 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1808 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1809
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1810 /* this is safe because we'll always come here after we've gotten the list off the server,
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1811 * and data is never removed. So if the lengths are equal we don't know about anyone locally
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1812 * and so there's no sense in going through them all. */
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1813 if (g_slist_length(gc->account->permit) == g_slist_length(md->permit)) {
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1814 g_slist_free(md->permit);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1815 md->permit = NULL;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1816 }
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1817 if (g_slist_length(gc->account->deny) == g_slist_length(md->deny)) {
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1818 g_slist_free(md->deny);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1819 md->deny = NULL;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1820 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1821 if (!md->permit && !md->deny)
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1822 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1823
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1824 if (md->permit) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1825 s = g_slist_nth(gc->account->permit, g_slist_length(md->permit));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1826 while (s) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1827 char *who = s->data;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1828 s = s->next;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1829 if (!strchr(who, '@')) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1830 t = g_slist_append(t, who);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1831 continue;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1832 }
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1833 if (g_slist_find(md->deny, who)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1834 t = g_slist_append(t, who);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1835 continue;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1836 }
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1837 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, who, who);
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1838 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1839 hide_login_progress(gc, _("Write error"));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1840 signoff(gc);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1841 return;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1842 }
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1843 }
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1844 while (t) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1845 gaim_privacy_permit_remove(gc->account, t->data);
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1846 t = t->next;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1847 }
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1848 if (t)
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1849 g_slist_free(t);
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1850 t = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1851 g_slist_free(md->permit);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1852 md->permit = NULL;
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1853 }
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1854
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1855 if (md->deny) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1856 s = g_slist_nth(gc->account->deny, g_slist_length(md->deny));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1857 while (s) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1858 char *who = s->data;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1859 s = s->next;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1860 if (!strchr(who, '@')) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1861 t = g_slist_append(t, who);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1862 continue;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1863 }
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1864 if (g_slist_find(md->deny, who)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1865 t = g_slist_append(t, who);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1866 continue;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1867 }
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1868 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, who, who);
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1869 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1870 hide_login_progress(gc, _("Write error"));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1871 signoff(gc);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1872 return;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1873 }
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1874 }
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1875 while (t) {
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1876 gaim_privacy_deny_remove(gc->account, t->data);
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1877 t = t->next;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1878 }
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1879 if (t)
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1880 g_slist_free(t);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1881 g_slist_free(md->deny);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1882 md->deny = NULL;
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1883 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1884 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1885
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1886 static void msn_add_permit(struct gaim_connection *gc, const char *who)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1887 {
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1888 struct msn_data *md = gc->proto_data;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1889 char buf[MSN_BUF_LEN];
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1890
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1891 if (!strchr(who, '@')) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1892 g_snprintf(buf, sizeof(buf),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1893 _("An MSN screenname must be in the form \"user@server.com\". "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1894 "Perhaps you meant %s@hotmail.com. No changes were made to your "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1895 "allow list."), who);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1896 do_error_dialog(_("Invalid MSN screenname"), buf, GAIM_ERROR);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1897 gaim_privacy_permit_remove(gc->account, who);
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1898 return;
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1899 }
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1900
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1901 if (g_slist_find_custom(gc->account->deny, who, (GCompareFunc)strcmp)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1902 debug_printf("MSN: Moving %s from BL to AL\n", who);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1903 gaim_privacy_deny_remove(gc->account, who);
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1904 g_snprintf(buf, sizeof(buf), "REM %u BL %s\r\n", ++md->trId, who);
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1905 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1906 hide_login_progress(gc, _("Write error"));
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1907 signoff(gc);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1908 return;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1909 }
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1910 }
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1911 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, who, who);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1912 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1913 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1914 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1915 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1916 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1917 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1918
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1919 static void msn_rem_permit(struct gaim_connection *gc, const char *who)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1920 {
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1921 struct msn_data *md = gc->proto_data;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1922 char buf[MSN_BUF_LEN];
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1923
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1924 g_snprintf(buf, sizeof(buf), "REM %u AL %s\r\n", ++md->trId, who);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1925 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1926 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1927 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1928 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1929 }
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1930
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1931 gaim_privacy_deny_add(gc->account, who);
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1932 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, who, who);
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1933 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1934 hide_login_progress(gc, _("Write error"));
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1935 signoff(gc);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1936 return;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1937 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1938 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1939
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1940 static void msn_add_deny(struct gaim_connection *gc, const char *who)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1941 {
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1942 struct msn_data *md = gc->proto_data;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1943 char buf[MSN_BUF_LEN];
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1944
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1945 if (!strchr(who, '@')) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1946 g_snprintf(buf, sizeof(buf),
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1947 _("An MSN screenname must be in the form \"user@server.com\". "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1948 "Perhaps you meant %s@hotmail.com. No changes were made to your "
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1949 "block list."), who);
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3375
diff changeset
1950 do_error_dialog(_("Invalid MSN screenname"), buf, GAIM_ERROR);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1951 gaim_privacy_deny_remove(gc->account, who);
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1952 return;
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1953 }
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1954
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1955 if (g_slist_find_custom(gc->account->permit, who, (GCompareFunc)strcmp)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1956 debug_printf("MSN: Moving %s from AL to BL\n", who);
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1957 gaim_privacy_permit_remove(gc->account, who);
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1958 g_snprintf(buf, sizeof(buf), "REM %u AL %s\r\n", ++md->trId, who);
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1959 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1960 hide_login_progress(gc, _("Write error"));
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1961 signoff(gc);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1962 return;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1963 }
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1964 }
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1965
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1966
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1967 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, who, who);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1968 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1969 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1970 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1971 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1972 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1973 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1974
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1975 static void msn_rem_deny(struct gaim_connection *gc, const char *who)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1976 {
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1977 struct msn_data *md = gc->proto_data;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1978 char buf[MSN_BUF_LEN];
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1979
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1980 g_snprintf(buf, sizeof(buf), "REM %u BL %s\r\n", ++md->trId, who);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1981 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1982 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1983 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1984 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1985 }
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1986
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
1987 gaim_privacy_permit_add(gc->account, who);
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
1988 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, who, who);
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1989 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
1990 hide_login_progress(gc, _("Write error"));
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1991 signoff(gc);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1992 return;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1993 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1994 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1995
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1996 static void msn_buddy_free(struct buddy *b)
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1997 {
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1998 if (b->proto_data)
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1999 g_free(b->proto_data);
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
2000 }
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
2001
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
2002 G_MODULE_EXPORT void msn_init(struct prpl *ret)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2003 {
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2004 struct proto_user_opt *puo;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2005 ret->protocol = PROTO_MSN;
2153
0befa2d2e540 [gaim-migrate @ 2163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2152
diff changeset
2006 ret->options = OPT_PROTO_MAIL_CHECK;
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2007 ret->name = g_strdup("MSN");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2008 ret->list_icon = msn_list_icon;
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4793
diff changeset
2009 ret->list_emblems = msn_list_emblems;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2010 ret->buddy_menu = msn_buddy_menu;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2011 ret->login = msn_login;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2012 ret->close = msn_close;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2013 ret->send_im = msn_send_im;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
2014 ret->send_typing = msn_send_typing;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2015 ret->away_states = msn_away_states;
4723
39068784aa08 [gaim-migrate @ 5035]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2016 ret->status_text = msn_status_text;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4723
diff changeset
2017 ret->tooltip_text = msn_tooltip_text;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2018 ret->set_away = msn_set_away;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2019 ret->set_idle = msn_set_idle;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2020 ret->add_buddy = msn_add_buddy;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2021 ret->remove_buddy = msn_rem_buddy;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2022 ret->chat_send = msn_chat_send;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2023 ret->chat_invite = msn_chat_invite;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2024 ret->chat_leave = msn_chat_leave;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2025 ret->normalize = msn_normalize;
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
2026 ret->actions = msn_actions;
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2588
diff changeset
2027 ret->convo_closed = msn_convo_closed;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
2028 ret->keepalive = msn_keepalive;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
2029 ret->set_permit_deny = msn_set_permit_deny;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
2030 ret->add_permit = msn_add_permit;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
2031 ret->rem_permit = msn_rem_permit;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
2032 ret->add_deny = msn_add_deny;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
2033 ret->rem_deny = msn_rem_deny;
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
2034 ret->buddy_free = msn_buddy_free;
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
2035
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
2036 #if 0
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
2037 ret->file_transfer_cancel = msn_file_transfer_cancel;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
2038 ret->file_transfer_in = msn_file_transfer_in;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
2039 ret->file_transfer_out = msn_file_transfer_out;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
2040 ret->file_transfer_done = msn_file_transfer_done;
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
2041 ret->file_transfer_read = msn_file_transfer_read;
4508
4c40fccbd7c9 [gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
2042 #endif
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2043
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2044 puo = g_new0(struct proto_user_opt, 1);
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4921
diff changeset
2045 puo->label = g_strdup(_("Login Server:"));
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2046 puo->def = g_strdup(MSN_SERVER);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2047 puo->pos = USEROPT_MSNSERVER;
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2048 ret->user_opts = g_list_append(ret->user_opts, puo);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2049
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2050 puo = g_new0(struct proto_user_opt, 1);
4115
474265997752 [gaim-migrate @ 4332]
Luke Schierer <lschiere@pidgin.im>
parents: 4112
diff changeset
2051 puo->label = g_strdup(_("Port:"));
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2052 puo->def = g_strdup("1863");
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2053 puo->pos = USEROPT_MSNPORT;
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2054 ret->user_opts = g_list_append(ret->user_opts, puo);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2055
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2056 my_protocol = ret;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2057 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2058
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2059 #ifndef STATIC
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2060
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
2061 G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2062 {
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2063 msn_init(prpl);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
2064 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2065 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2066
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
2067 G_MODULE_EXPORT void gaim_plugin_remove()
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2068 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2069 struct prpl *p = find_prpl(PROTO_MSN);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2070 if (p == my_protocol)
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2071 unload_protocol(p);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2072 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2073
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
2074 G_MODULE_EXPORT char *name()
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2075 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2076 return "MSN";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2077 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2078
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
2079 G_MODULE_EXPORT char *description()
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2080 {
2162
a464da684307 [gaim-migrate @ 2172]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2153
diff changeset
2081 return PRPL_DESC("MSN");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2082 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2083
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2084 #endif