annotate src/protocols/msn/msn.c @ 8749:d7b8eb1f0a18

[gaim-migrate @ 9504] Bumped up the plugin API version number, and added version numbers for loader plugins and protocol plugins. Authors will want to update their plugins, and possibly use GAIM_PLUGIN_API_VERSION, GAIM_PRPL_API_VERSION, and GAIM_LOADER_API_VERSION constants. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 22 Apr 2004 01:53:18 +0000
parents 92cbf9713795
children bbd8cdaf0ad5
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 *
8475
06f57183e29f [gaim-migrate @ 9208]
Christian Hammond <chipx86@chipx86.com>
parents: 8442
diff changeset
6 * Copyright (C) 2003-2004 Christian Hammond <chipx86@gnupdate.org>
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
7 *
4542
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 */
6827
1cfbb731aa1f [gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents: 6801
diff changeset
22 #include <glib.h>
1cfbb731aa1f [gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents: 6801
diff changeset
23
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
24 #include "msn.h"
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
25 #include "accountopt.h"
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
26 #include "msg.h"
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
27 #include "page.h"
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
28 #include "pluginpref.h"
5626
6275ac113622 [gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
29 #include "prefs.h"
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
30 #include "session.h"
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
31 #include "state.h"
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
32 #include "utils.h"
5717
1d140b31d4b3 [gaim-migrate @ 6138]
Nathan Walp <nwalp@pidgin.im>
parents: 5685
diff changeset
33 #include "multi.h"
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
34 #include "util.h"
4546
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
35
8333
85dbaac926a7 [gaim-migrate @ 9057]
Christian Hammond <chipx86@chipx86.com>
parents: 8298
diff changeset
36 #define BUDDY_ALIAS_MAXLEN 387
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
37
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
38 static GaimPlugin *my_protocol = NULL;
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
39
7322
ab828b8c3f22 [gaim-migrate @ 7908]
Nathan Walp <nwalp@pidgin.im>
parents: 7288
diff changeset
40 static const char *msn_normalize(const GaimAccount *account, const char *str);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
42 typedef struct
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
43 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
44 GaimConnection *gc;
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
45 const char *passport;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
46
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
47 } MsnMobileData;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
48
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
49 typedef struct
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
50 {
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
51 GaimConnection *gc;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
52 char *name;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
53
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
54 } MsnGetInfoData;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
55
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
56 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
57 msn_act_id(GaimConnection *gc, const char *entry)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
58 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
59 MsnSession *session = gc->proto_data;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
60 GaimAccount *account = gaim_connection_get_account(gc);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
61 char outparams[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
62 char *alias;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
64 if (entry == NULL || *entry == '\0')
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
65 alias = g_strdup("");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
66 else
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
67 alias = g_strdup(entry);
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
68
8333
85dbaac926a7 [gaim-migrate @ 9057]
Christian Hammond <chipx86@chipx86.com>
parents: 8298
diff changeset
69 if (strlen(alias) > BUDDY_ALIAS_MAXLEN)
85dbaac926a7 [gaim-migrate @ 9057]
Christian Hammond <chipx86@chipx86.com>
parents: 8298
diff changeset
70 {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5382
diff changeset
71 gaim_notify_error(gc, NULL,
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5382
diff changeset
72 _("Your new MSN friendly name is too long."), NULL);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
73 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
74 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
75
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
76 g_snprintf(outparams, sizeof(outparams), "%s %s",
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
77 gaim_account_get_username(account), gaim_url_encode(alias));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
79 g_free(alias);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
81 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
82 "REA", outparams)) {
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
83
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
84 gaim_connection_error(gc, _("Write error"));
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
85 return;
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
86 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
89 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
90 msn_set_prp(GaimConnection *gc, const char *type, const char *entry)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
91 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
92 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
93 char outparams[MSN_BUF_LEN];
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
94
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
95 if (entry == NULL || *entry == '\0')
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
96 g_snprintf(outparams, sizeof(outparams), "%s ", type);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
97 else
6228
36897deb064b [gaim-migrate @ 6721]
Christian Hammond <chipx86@chipx86.com>
parents: 6149
diff changeset
98 g_snprintf(outparams, sizeof(outparams), "%s %s", type,
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
99 gaim_url_encode(entry));
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
100
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
101 if (!msn_servconn_send_command(session->notification_conn,
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
102 "PRP", outparams)) {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
103
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
104 gaim_connection_error(gc, _("Write error"));
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
105 return;
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
106 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
107 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
108
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
109 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
110 msn_set_home_phone_cb(GaimConnection *gc, const char *entry)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
111 {
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
112 msn_set_prp(gc, "PHH", entry);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
113 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
114
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
115 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
116 msn_set_work_phone_cb(GaimConnection *gc, const char *entry)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
117 {
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
118 msn_set_prp(gc, "PHW", entry);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
119 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
120
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
121 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
122 msn_set_mobile_phone_cb(GaimConnection *gc, const char *entry)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
123 {
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
124 msn_set_prp(gc, "PHM", entry);
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
125 }
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
126
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
127 static void
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
128 enable_msn_pages_cb(GaimConnection *gc)
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
129 {
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
130 msn_set_prp(gc, "MOB", "Y");
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
131 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
132
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
133 static void
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
134 disable_msn_pages_cb(GaimConnection *gc)
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
135 {
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
136 msn_set_prp(gc, "MOB", "N");
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
137 }
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
138
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
139 static void
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
140 send_to_mobile_cb(MsnMobileData *data, const char *entry)
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
141 {
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
142 MsnSession *session;
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
143 MsnServConn *servconn;
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
144 MsnPage *page;
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
145 char *buf;
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
146 char *payload;
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
147 size_t len;
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
148 size_t payload_len;
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
149
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
150 session = data->gc->proto_data;
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
151 servconn = session->notification_conn;
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
152
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
153 page = msn_page_new();
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
154 msn_page_set_body(page, entry);
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
155 buf = g_strdup_printf("PGD %d %s 1 %d\r\n", ++session->trId,
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
156 data->passport, page->size);
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
157
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
158 len = strlen(buf);
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
159
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
160 payload = msn_page_gen_payload(page, &payload_len);
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
161
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
162 if (payload != NULL)
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
163 {
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
164 buf = g_realloc(buf, len + payload_len + 1);
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
165 memcpy(buf + len, payload, payload_len);
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
166 len += payload_len;
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
167 buf[len] = 0;
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
168 }
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
169
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
170 msn_page_destroy(page);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
171
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
172 if (!msn_servconn_write(servconn, buf, len))
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
173 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
174 gaim_connection_error(data->gc, _("Write error"));
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
175 }
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
176
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8595
diff changeset
177 g_free(buf);
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
178 }
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
179
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
180 static void
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
181 close_mobile_page_cb(MsnMobileData *data, const char *entry)
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
182 {
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
183 g_free(data);
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
184 }
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
185
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
186 /* -- */
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
187
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
188 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
189 msn_show_set_friendly_name(GaimConnection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 {
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
191 gaim_request_input(gc, NULL, _("Set your friendly name."),
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
192 _("This is the name that other MSN buddies will "
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
193 "see you as."),
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8691
diff changeset
194 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL,
5481
084147a0d9e4 [gaim-migrate @ 5877]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
195 _("OK"), G_CALLBACK(msn_act_id),
084147a0d9e4 [gaim-migrate @ 5877]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
196 _("Cancel"), NULL, gc);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
199 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
200 msn_show_set_home_phone(GaimConnection *gc)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
201 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
202 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
203
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
204 gaim_request_input(gc, NULL, _("Set your home phone number."), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8691
diff changeset
205 msn_user_get_home_phone(session->user), FALSE, FALSE, NULL,
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
206 _("OK"), G_CALLBACK(msn_set_home_phone_cb),
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
207 _("Cancel"), NULL, gc);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
208 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
209
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
210 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
211 msn_show_set_work_phone(GaimConnection *gc)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
212 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
213 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
214
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
215 gaim_request_input(gc, NULL, _("Set your work phone number."), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8691
diff changeset
216 msn_user_get_work_phone(session->user), FALSE, FALSE, NULL,
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
217 _("OK"), G_CALLBACK(msn_set_work_phone_cb),
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
218 _("Cancel"), NULL, gc);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
219 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
220
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
221 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
222 msn_show_set_mobile_phone(GaimConnection *gc)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
223 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
224 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
225
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
226 gaim_request_input(gc, NULL, _("Set your mobile phone number."), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8691
diff changeset
227 msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL,
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
228 _("OK"), G_CALLBACK(msn_set_mobile_phone_cb),
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
229 _("Cancel"), NULL, gc);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
230 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
231
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
232 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
233 msn_show_set_mobile_pages(GaimConnection *gc)
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
234 {
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5491
diff changeset
235 gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"),
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5491
diff changeset
236 _("Do you want to allow or disallow people on "
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5491
diff changeset
237 "your buddy list to send you MSN Mobile pages "
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5491
diff changeset
238 "to your cell phone or other mobile device?"),
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
239 -1, gc, 3,
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
240 _("Allow"), G_CALLBACK(enable_msn_pages_cb),
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
241 _("Disallow"), G_CALLBACK(disable_msn_pages_cb),
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
242 _("Cancel"), NULL);
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
243 }
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
244
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
245 static void
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
246 show_send_to_mobile_cb(GaimConnection *gc, const char *passport)
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
247 {
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
248 MsnUser *user;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
249 MsnSession *session = gc->proto_data;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
250 MsnMobileData *data;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
251
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
252 user = msn_users_find_with_passport(session->users, passport);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
253
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
254 data = g_new0(MsnMobileData, 1);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
255 data->gc = gc;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
256 data->passport = passport;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
257
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
258 gaim_request_input(gc, NULL, _("Send a mobile message."), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8691
diff changeset
259 NULL, TRUE, FALSE, NULL,
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
260 _("Page"), G_CALLBACK(send_to_mobile_cb),
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
261 _("Close"), G_CALLBACK(close_mobile_page_cb),
5491
4bcae8503866 [gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents: 5481
diff changeset
262 data);
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
263 }
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
264
6148
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
265 static void
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
266 initiate_chat_cb(GaimConnection *gc, const char *passport)
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
267 {
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
268 GaimAccount *account = gaim_connection_get_account(gc);
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
269 MsnSession *session = gc->proto_data;
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
270 MsnSwitchBoard *swboard;
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
271 MsnUser *user;
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
272
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
273 if ((swboard = msn_session_open_switchboard(session)) == NULL) {
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
274 gaim_connection_error(gc, _("Write error"));
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
275
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
276 return;
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
277 }
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
278
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
279 user = msn_user_new(session, passport, NULL);
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
280
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
281 msn_switchboard_set_user(swboard, user);
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
282
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
283 swboard->total_users = 1;
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
284
8499
467b01d02f9c [gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
285 session->last_chat_id++;
467b01d02f9c [gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
286 swboard->chat_id = session->last_chat_id;
467b01d02f9c [gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
287 swboard->chat = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
6148
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
288
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
289 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->chat),
8298
c719f9a181d4 [gaim-migrate @ 9022]
Christian Hammond <chipx86@chipx86.com>
parents: 8291
diff changeset
290 gaim_account_get_username(account), NULL);
6148
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
291 }
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
292
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
293 /**************************************************************************
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
294 * Protocol Plugin ops
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
295 **************************************************************************/
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
296
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
297 static const char *
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6657
diff changeset
298 msn_list_icon(GaimAccount *a, GaimBuddy *b)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
299 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
300 return "msn";
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
301 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
302
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
303 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6657
diff changeset
304 msn_list_emblems(GaimBuddy *b, char **se, char **sw,
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
305 char **nw, char **ne)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 {
5372
fa0217bec87e [gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents: 5369
diff changeset
307 MsnUser *user;
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
308 char *emblems[4] = { NULL, NULL, NULL, NULL };
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
309 int away_type = MSN_AWAY_TYPE(b->uc);
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
310 int i = 0;
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
311
5372
fa0217bec87e [gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents: 5369
diff changeset
312 user = b->proto_data;
fa0217bec87e [gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents: 5369
diff changeset
313
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
314 if (b->present == GAIM_BUDDY_OFFLINE)
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
315 emblems[i++] = "offline";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
316 else if (away_type == MSN_BUSY || away_type == MSN_PHONE)
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
317 emblems[i++] = "occupied";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
318 else if (away_type != 0)
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
319 emblems[i++] = "away";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
320
5378
a991ff4d5d40 [gaim-migrate @ 5754]
Christian Hammond <chipx86@chipx86.com>
parents: 5372
diff changeset
321 if (user == NULL) {
6739
2beae1058ca4 [gaim-migrate @ 7271]
Christian Hammond <chipx86@chipx86.com>
parents: 6702
diff changeset
322 emblems[0] = "offline";
5378
a991ff4d5d40 [gaim-migrate @ 5754]
Christian Hammond <chipx86@chipx86.com>
parents: 5372
diff changeset
323 }
a991ff4d5d40 [gaim-migrate @ 5754]
Christian Hammond <chipx86@chipx86.com>
parents: 5372
diff changeset
324 else if (user->mobile)
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
325 emblems[i++] = "wireless";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
326
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
327 *se = emblems[0];
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
328 *sw = emblems[1];
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
329 *nw = emblems[2];
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
330 *ne = emblems[3];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
333 static char *
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6657
diff changeset
334 msn_status_text(GaimBuddy *b)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
336 if (b->uc & UC_UNAVAILABLE)
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
337 return g_strdup(msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
339 return NULL;
2086
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
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
342 static char *
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6657
diff changeset
343 msn_tooltip_text(GaimBuddy *b)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 {
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
345 char *text = NULL;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
346
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
347 if (GAIM_BUDDY_IS_ONLINE(b)) {
8591
f96795b786d2 [gaim-migrate @ 9342]
Mark Doliner <mark@kingant.net>
parents: 8589
diff changeset
348 text = g_strdup_printf("\n<b>%s:</b> %s", _("Status"),
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
349 msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
350 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
352 return text;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
355 static GList *
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
356 msn_away_states(GaimConnection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 GList *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
360 m = g_list_append(m, _("Available"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
361 m = g_list_append(m, _("Away From Computer"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
362 m = g_list_append(m, _("Be Right Back"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
363 m = g_list_append(m, _("Busy"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
364 m = g_list_append(m, _("On The Phone"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
365 m = g_list_append(m, _("Out To Lunch"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
366 m = g_list_append(m, _("Hidden"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
371 static GList *
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
372 msn_actions(GaimConnection *gc)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
373 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
374 GList *m = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
375 struct proto_actions_menu *pam;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
376
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
377 pam = g_new0(struct proto_actions_menu, 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
378 pam->label = _("Set Friendly Name");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
379 pam->callback = msn_show_set_friendly_name;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
380 pam->gc = gc;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
381 m = g_list_append(m, pam);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
382
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
383 m = g_list_append(m, NULL);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
384
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
385 pam = g_new0(struct proto_actions_menu, 1);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
386 pam->label = _("Set Home Phone Number");
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
387 pam->callback = msn_show_set_home_phone;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
388 pam->gc = gc;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
389 m = g_list_append(m, pam);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
390
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
391 pam = g_new0(struct proto_actions_menu, 1);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
392 pam->label = _("Set Work Phone Number");
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
393 pam->callback = msn_show_set_work_phone;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
394 pam->gc = gc;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
395 m = g_list_append(m, pam);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
396
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
397 pam = g_new0(struct proto_actions_menu, 1);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
398 pam->label = _("Set Mobile Phone Number");
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
399 pam->callback = msn_show_set_mobile_phone;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
400 pam->gc = gc;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
401 m = g_list_append(m, pam);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
402
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
403 m = g_list_append(m, NULL);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
404
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
405 #if 0
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
406 pam = g_new0(struct proto_actions_menu, 1);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
407 pam->label = _("Enable/Disable Mobile Devices");
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
408 pam->callback = msn_show_set_mobile_support;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
409 pam->gc = gc;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
410 m = g_list_append(m, pam);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
411 #endif
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
412
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
413 pam = g_new0(struct proto_actions_menu, 1);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
414 pam->label = _("Allow/Disallow Mobile Pages");
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
415 pam->callback = msn_show_set_mobile_pages;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
416 pam->gc = gc;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
417 m = g_list_append(m, pam);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
418
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
419 return m;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
420 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
421
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
422 static GList *
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
423 msn_buddy_menu(GaimConnection *gc, const char *who)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
424 {
6148
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
425 GaimAccount *account = gaim_connection_get_account(gc);
5372
fa0217bec87e [gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents: 5369
diff changeset
426 MsnUser *user;
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
427 struct proto_buddy_menu *pbm;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6657
diff changeset
428 GaimBuddy *b;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
429 GList *m = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
430
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
431 b = gaim_find_buddy(gc->account, who);
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6842
diff changeset
432
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6842
diff changeset
433 g_return_val_if_fail(b != NULL, NULL);
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6842
diff changeset
434
5372
fa0217bec87e [gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents: 5369
diff changeset
435 user = b->proto_data;
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
436
5382
b18332105302 [gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents: 5379
diff changeset
437 if (user != NULL) {
b18332105302 [gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents: 5379
diff changeset
438 if (user->mobile) {
b18332105302 [gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents: 5379
diff changeset
439 pbm = g_new0(struct proto_buddy_menu, 1);
b18332105302 [gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents: 5379
diff changeset
440 pbm->label = _("Send to Mobile");
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
441 pbm->callback = show_send_to_mobile_cb;
5382
b18332105302 [gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents: 5379
diff changeset
442 pbm->gc = gc;
b18332105302 [gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents: 5379
diff changeset
443 m = g_list_append(m, pbm);
b18332105302 [gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents: 5379
diff changeset
444 }
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
445 }
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
446
6148
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
447 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
448 pbm = g_new0(struct proto_buddy_menu, 1);
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
449 pbm->label = _("Initiate Chat");
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
450 pbm->callback = initiate_chat_cb;
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
451 pbm->gc = gc;
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
452 m = g_list_append(m, pbm);
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
453 }
82e7eaa67406 [gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents: 6059
diff changeset
454
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
455 return m;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
456 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
457
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
458 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
459 msn_login(GaimAccount *account)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
460 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
461 GaimConnection *gc;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
462 MsnSession *session;
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
463 const char *username;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
464 const char *server;
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
465 gboolean http_method = FALSE;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
466 int port;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
467
7277
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
468 gc = gaim_account_get_connection(account);
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
469
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
470 if (!gaim_ssl_is_supported())
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
471 {
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
472 gaim_connection_error(gc,
8499
467b01d02f9c [gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
473 _("SSL support is needed for MSN. Please install a supported "
467b01d02f9c [gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
474 "SSL library. See http://gaim.sf.net/faq-ssl.php for more "
467b01d02f9c [gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
475 "information."));
7277
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
476
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
477 return;
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
478 }
2972dad4438b [gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents: 7262
diff changeset
479
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
480 if (gaim_account_get_bool(account, "http_method", FALSE))
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
481 {
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
482 http_method = TRUE;
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
483
7834
99ffabc6ce73 [gaim-migrate @ 8487]
Christian Hammond <chipx86@chipx86.com>
parents: 7675
diff changeset
484 gaim_debug(GAIM_DEBUG_INFO, "msn", "using http method\n");
7937
0dc286295b36 [gaim-migrate @ 8608]
Christian Hammond <chipx86@chipx86.com>
parents: 7935
diff changeset
485
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
486 server = "gateway.messenger.hotmail.com";
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
487 port = 80;
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
488 }
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
489 else
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
490 {
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
491 server = gaim_account_get_string(account, "server", MSN_SERVER);
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
492 port = gaim_account_get_int(account, "port", MSN_PORT);
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
493 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
494
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
495 session = msn_session_new(account, server, port);
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
496 session->http_method = http_method;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
497 session->prpl = my_protocol;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
498
8298
c719f9a181d4 [gaim-migrate @ 9022]
Christian Hammond <chipx86@chipx86.com>
parents: 8291
diff changeset
499 if (session->http_method)
c719f9a181d4 [gaim-migrate @ 9022]
Christian Hammond <chipx86@chipx86.com>
parents: 8291
diff changeset
500 msn_http_session_init(session);
c719f9a181d4 [gaim-migrate @ 9022]
Christian Hammond <chipx86@chipx86.com>
parents: 8291
diff changeset
501
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
502 gc->proto_data = session;
8691
0eb5161ef333 [gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents: 8677
diff changeset
503 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_FORMATTING_WBFO | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_FONTSIZE;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
504
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
505 gaim_connection_update_progress(gc, _("Connecting"), 0, MSN_CONNECT_STEPS);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
506
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
507 /* Hmm, I don't like this. */
7322
ab828b8c3f22 [gaim-migrate @ 7908]
Nathan Walp <nwalp@pidgin.im>
parents: 7288
diff changeset
508 username = msn_normalize(account, gaim_account_get_username(account));
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
509
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
510 if (strcmp(username, gaim_account_get_username(account)))
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
511 gaim_account_set_username(account, username);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
512
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
513 if (!msn_session_connect(session)) {
7981
ad5c8f01882b [gaim-migrate @ 8658]
Luke Schierer <lschiere@pidgin.im>
parents: 7956
diff changeset
514 gaim_connection_error(gc, _("Unable to connect."));
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
515
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
516 return;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
517 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
518 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
519
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
520 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
521 msn_close(GaimConnection *gc)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
522 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
523 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
524
8368
57e5ef6b7a69 [gaim-migrate @ 9095]
Christian Hammond <chipx86@chipx86.com>
parents: 8333
diff changeset
525 if (session != NULL)
57e5ef6b7a69 [gaim-migrate @ 9095]
Christian Hammond <chipx86@chipx86.com>
parents: 8333
diff changeset
526 {
57e5ef6b7a69 [gaim-migrate @ 9095]
Christian Hammond <chipx86@chipx86.com>
parents: 8333
diff changeset
527 if (session->http_method)
57e5ef6b7a69 [gaim-migrate @ 9095]
Christian Hammond <chipx86@chipx86.com>
parents: 8333
diff changeset
528 msn_http_session_uninit(session);
8298
c719f9a181d4 [gaim-migrate @ 9022]
Christian Hammond <chipx86@chipx86.com>
parents: 8291
diff changeset
529
8368
57e5ef6b7a69 [gaim-migrate @ 9095]
Christian Hammond <chipx86@chipx86.com>
parents: 8333
diff changeset
530 msn_session_destroy(session);
57e5ef6b7a69 [gaim-migrate @ 9095]
Christian Hammond <chipx86@chipx86.com>
parents: 8333
diff changeset
531 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
532
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
533 gc->proto_data = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
534 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
535
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
536 static int
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
537 msn_send_im(GaimConnection *gc, const char *who, const char *message,
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
538 GaimConvImFlags flags)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
540 GaimAccount *account = gaim_connection_get_account(gc);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
541 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
542 MsnSwitchBoard *swboard;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
543
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
544 swboard = msn_session_find_switch_with_passport(session, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
545
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
546 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
547 MsnMessage *msg;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
548 MsnUser *user;
8595
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
549 char *msgformat;
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
550 char *msgtext;
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
551
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
552 user = msn_user_new(session, who, NULL);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
553
8595
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
554 msn_import_html(message, &msgformat, &msgtext);
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
555
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
556 msg = msn_message_new();
8595
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
557 msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
558 msn_message_set_body(msg, msgtext);
8518
833dd756dcc3 [gaim-migrate @ 9257]
Christian Hammond <chipx86@chipx86.com>
parents: 8509
diff changeset
559
8595
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
560 g_free(msgformat);
1d5e31e518fc [gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents: 8591
diff changeset
561 g_free(msgtext);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
562
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
563 if (swboard != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
564 if (!msn_switchboard_send_msg(swboard, msg))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
565 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
566 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
567 else {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
568 if ((swboard = msn_session_open_switchboard(session)) == NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
569 msn_message_destroy(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
570
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
571 gaim_connection_error(gc, _("Write error"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
572
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
573 return 1;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
574 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
575
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
576 msn_switchboard_set_user(swboard, user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
577 msn_switchboard_send_msg(swboard, msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
578 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
579
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
580 msn_user_destroy(user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
581 msn_message_destroy(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
582 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
583 else {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
584 /*
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
585 * In MSN, you can't send messages to yourself, so
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
586 * we'll fake like we received it ;)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
587 */
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8368
diff changeset
588 gchar *fakemsg = gaim_escape_html(message);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
589 serv_got_typing_stopped(gc, (char *)who);
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8368
diff changeset
590 serv_got_im(gc, who, fakemsg, flags,
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6909
diff changeset
591 time(NULL));
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8368
diff changeset
592 g_free(fakemsg);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
593 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
594
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
595 return 1;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
596 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
597
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
598 static int
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
599 msn_send_typing(GaimConnection *gc, const char *who, int typing)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
600 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
601 GaimAccount *account = gaim_connection_get_account(gc);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
602 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
603 MsnSwitchBoard *swboard;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
604 MsnMessage *msg;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
605 MsnUser *user;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
606
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
607 if (!typing)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
608 return 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
609
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
610 if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
611 /* We'll just fake it, since we're sending to ourself. */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5793
diff changeset
612 serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, GAIM_TYPING);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
613
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
614 return MSN_TYPING_SEND_TIMEOUT;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
615 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
616
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
617 swboard = msn_session_find_switch_with_passport(session, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
618
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
619 if (swboard == NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
620 return 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
621
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
622 user = msn_user_new(session, who, NULL);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
623
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
624 msg = msn_message_new();
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
625 msn_message_set_content_type(msg, "text/x-msmsgscontrol");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
626 msn_message_set_charset(msg, NULL);
5505
870207a49f2f [gaim-migrate @ 5904]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
627 msn_message_set_flag(msg, 'U');
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
628 msn_message_set_attr(msg, "TypingUser",
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
629 gaim_account_get_username(account));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
630 msn_message_set_attr(msg, "User-Agent", NULL);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
631 msn_message_set_body(msg, "\r\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
632
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
633 if (!msn_switchboard_send_msg(swboard, msg))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
634 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
635
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
636 msn_user_destroy(user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
637
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
638 return MSN_TYPING_SEND_TIMEOUT;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
639 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
640
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
641 static void
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
642 msn_set_away(GaimConnection *gc, const char *state, const char *msg)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
643 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
644 MsnSession *session = gc->proto_data;
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
645 const char *away;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
647 if (gc->away != NULL)
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
648 {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
649 g_free(gc->away);
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
650 gc->away = NULL;
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
651 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
653 if (msg != NULL)
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
654 {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
655 gc->away = g_strdup("");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 away = "AWY";
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
657 }
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
658 else if (state)
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
659 {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
660 gc->away = g_strdup("");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
662 if (!strcmp(state, _("Away From Computer")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663 away = "AWY";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
664 else if (!strcmp(state, _("Be Right Back")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 away = "BRB";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
666 else if (!strcmp(state, _("Busy")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667 away = "BSY";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
668 else if (!strcmp(state, _("On The Phone")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 away = "PHN";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
670 else if (!strcmp(state, _("Out To Lunch")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671 away = "LUN";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
672 else if (!strcmp(state, _("Hidden")))
2152
f631cfc8e824 [gaim-migrate @ 2162]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2123
diff changeset
673 away = "HDN";
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
674 else
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
675 {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
676 g_free(gc->away);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677 gc->away = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678 away = "NLN";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
679 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
680 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
681 else if (gc->is_idle)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682 away = "IDL";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
683 else
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
684 away = "NLN";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
686 msn_session_change_status(session, away);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
687 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
688
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
689 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
690 msn_set_idle(GaimConnection *gc, int idle)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
691 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
692 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
693
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
694 if (gc->away != NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
695 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
696
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
697 msn_session_change_status(session, (idle ? "IDL" : "NLN"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
698 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
699
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
700 static void
6787
faa491042c66 [gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents: 6786
diff changeset
701 msn_add_buddy(GaimConnection *gc, const char *name, GaimGroup *group)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
702 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
703 MsnSession *session = gc->proto_data;
6789
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
704 MsnGroup *msn_group = NULL;
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7199
diff changeset
705 const char *who;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
706 char outparams[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
707 GSList *l;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
708
7322
ab828b8c3f22 [gaim-migrate @ 7908]
Nathan Walp <nwalp@pidgin.im>
parents: 7288
diff changeset
709 who = msn_normalize(gc->account, name);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
710
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
711 if (strchr(who, ' ')) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
712 /* This is a broken blist entry. */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
713 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
714 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
715
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
716 for (l = session->lists.forward; l != NULL; l = l->next) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
717 MsnUser *user = l->data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
718
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
719 if (!gaim_utf8_strcasecmp(who, msn_user_get_passport(user)))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
720 break;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
721 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
722
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
723 if (l != NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
724 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
725
6789
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
726 if (group != NULL)
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
727 msn_group = msn_groups_find_with_name(session->groups, group->name);
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
728
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
729 if (msn_group != NULL)
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
730 {
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
731 g_snprintf(outparams, sizeof(outparams),
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
732 "FL %s %s %d", who, who, msn_group_get_id(msn_group));
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
733 }
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
734 else
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
735 {
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
736 g_snprintf(outparams, sizeof(outparams),
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
737 "FL %s %s", who, who);
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
738 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
739
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
740 if (!msn_servconn_send_command(session->notification_conn,
6789
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
741 "ADD", outparams))
94b575afb77e [gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
742 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
743 gaim_connection_error(gc, _("Write error"));
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
744 return;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
745 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
746 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
747
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
748 static void
6702
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
749 msn_rem_buddy(GaimConnection *gc, const char *who, const char *group_name)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
750 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
751 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
752 char outparams[MSN_BUF_LEN];
6702
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
753 MsnGroup *group;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
754
8509
711927294475 [gaim-migrate @ 9245]
Christian Hammond <chipx86@chipx86.com>
parents: 8499
diff changeset
755 if (strchr(who, ' '))
711927294475 [gaim-migrate @ 9245]
Christian Hammond <chipx86@chipx86.com>
parents: 8499
diff changeset
756 {
711927294475 [gaim-migrate @ 9245]
Christian Hammond <chipx86@chipx86.com>
parents: 8499
diff changeset
757 /* This is a broken blist entry. */
711927294475 [gaim-migrate @ 9245]
Christian Hammond <chipx86@chipx86.com>
parents: 8499
diff changeset
758 return;
711927294475 [gaim-migrate @ 9245]
Christian Hammond <chipx86@chipx86.com>
parents: 8499
diff changeset
759 }
711927294475 [gaim-migrate @ 9245]
Christian Hammond <chipx86@chipx86.com>
parents: 8499
diff changeset
760
6702
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
761 group = msn_groups_find_with_name(session->groups, group_name);
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
762
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
763 if (group == NULL)
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
764 g_snprintf(outparams, sizeof(outparams), "FL %s", who);
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
765 else
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
766 g_snprintf(outparams, sizeof(outparams), "FL %s %d", who,
302ee2792e91 [gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
767 msn_group_get_id(group));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
768
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
769 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
770 "REM", outparams)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
771
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
772 gaim_connection_error(gc, _("Write error"));
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
773 return;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
774 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
775 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
776
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
777 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
778 msn_add_permit(GaimConnection *gc, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
779 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
780 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
781 char buf[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
782
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
783 if (!strchr(who, '@')) {
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
784 g_snprintf(buf, sizeof(buf),
8152
82aeed3c90f0 [gaim-migrate @ 8864]
Mark Doliner <mark@kingant.net>
parents: 8044
diff changeset
785 _("An MSN screen name must be in the form \"user@server.com\". "
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
786 "Perhaps you meant %s@hotmail.com. No changes were made "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
787 "to your allow list."), who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
788
8152
82aeed3c90f0 [gaim-migrate @ 8864]
Mark Doliner <mark@kingant.net>
parents: 8044
diff changeset
789 gaim_notify_error(gc, NULL, _("Invalid MSN screen name"), buf);
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
790 gaim_privacy_permit_remove(gc->account, who, TRUE);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
791
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
792 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
793 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
794
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
795 if (g_slist_find_custom(gc->account->deny, who, (GCompareFunc)strcmp)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
796 gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from BL to AL\n", who);
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
797 gaim_privacy_deny_remove(gc->account, who, TRUE);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
798
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
799 g_snprintf(buf, sizeof(buf), "BL %s", who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
800
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
801 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
802 "REM", buf)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
803
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
804 gaim_connection_error(gc, _("Write error"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
805 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
806 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
807 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
808
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
809 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
811 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
812 gaim_connection_error(gc, _("Write error"));
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
813 return;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
814 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
815 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
816
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
817 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
818 msn_add_deny(GaimConnection *gc, const char *who)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
819 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
820 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
821 char buf[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
822
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
823 if (!strchr(who, '@')) {
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
824 g_snprintf(buf, sizeof(buf),
8152
82aeed3c90f0 [gaim-migrate @ 8864]
Mark Doliner <mark@kingant.net>
parents: 8044
diff changeset
825 _("An MSN screen name must be in the form \"user@server.com\". "
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
826 "Perhaps you meant %s@hotmail.com. No changes were made "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
827 "to your block list."), who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
828
8152
82aeed3c90f0 [gaim-migrate @ 8864]
Mark Doliner <mark@kingant.net>
parents: 8044
diff changeset
829 gaim_notify_error(gc, NULL, _("Invalid MSN screen name"), buf);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
830
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
831 gaim_privacy_deny_remove(gc->account, who, TRUE);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
832
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
833 return;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
834 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
835
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
836 if (g_slist_find_custom(gc->account->permit, who, (GCompareFunc)strcmp)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
837 gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from AL to BL\n", who);
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
838 gaim_privacy_permit_remove(gc->account, who, TRUE);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
839
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
840 g_snprintf(buf, sizeof(buf), "AL %s", who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
841
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
842 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
843 "REM", buf)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
844
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
845 gaim_connection_error(gc, _("Write error"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
846 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
847 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
848 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
849
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
850 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
851
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
852 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
853 gaim_connection_error(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
854 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
855 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
856 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
857
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
858 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
859 msn_rem_permit(GaimConnection *gc, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
860 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
861 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
862 char buf[MSN_BUF_LEN];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
863
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
864 g_snprintf(buf, sizeof(buf), "AL %s", who);
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
865
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
866 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
867 gaim_connection_error(gc, _("Write error"));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
868 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
869 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
870
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
871 gaim_privacy_deny_add(gc->account, who, TRUE);
2600
8aade06646b5 [gaim-migrate @ 2613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
872
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
873 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
2952
7a32dca869a8 [gaim-migrate @ 2965]
Rob Flynn <gaim@robflynn.com>
parents: 2932
diff changeset
874
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
875 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
876 gaim_connection_error(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
877 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
879 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
880
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
881 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
882 msn_rem_deny(GaimConnection *gc, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
883 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
884 MsnSession *session = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
885 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
886
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
887 g_snprintf(buf, sizeof(buf), "BL %s", who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
888
7563
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
889 if (!msn_servconn_send_command(session->notification_conn, "REM", buf))
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
890 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
891 gaim_connection_error(gc, _("Write error"));
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
892 return;
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
893 }
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
894
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
895 gaim_privacy_permit_add(gc->account, who, TRUE);
7563
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
896
7935
11cef36ba006 [gaim-migrate @ 8606]
Christian Hammond <chipx86@chipx86.com>
parents: 7913
diff changeset
897 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
7563
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
898
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
899 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf))
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
900 {
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
901 gaim_connection_error(gc, _("Write error"));
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
902 return;
cb9c3b6d6de9 [gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents: 7469
diff changeset
903 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
904 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
905
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
906 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
907 msn_set_permit_deny(GaimConnection *gc)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
908 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
909 GaimAccount *account = gaim_connection_get_account(gc);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
910 MsnSession *session = gc->proto_data;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
911 char buf[MSN_BUF_LEN];
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
912 GSList *s, *t = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
913
8175
f347c8d25cf5 [gaim-migrate @ 8889]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
914 if (account->perm_deny == GAIM_PRIVACY_ALLOW_ALL ||
f347c8d25cf5 [gaim-migrate @ 8889]
Mark Doliner <mark@kingant.net>
parents: 8170
diff changeset
915 account->perm_deny == GAIM_PRIVACY_DENY_USERS) {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
916
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
917 strcpy(buf, "AL");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
918 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
919 else
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
920 strcpy(buf, "BL");
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
921
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
922 if (!msn_servconn_send_command(session->notification_conn, "BLP", buf)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
923 gaim_connection_error(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
924 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
925 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
926
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
927 /*
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
928 * This is safe because we'll always come here after we've gotten
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
929 * the list off the server, and data is never removed. So if the
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
930 * lengths are equal we don't know about anyone locally and so
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
931 * there's no sense in going through them all.
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
932 */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
933 if (g_slist_length(gc->account->permit) ==
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
934 g_slist_length(session->lists.allow)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
935
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
936 g_slist_free(session->lists.allow);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
937 session->lists.allow = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
938 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
939
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
940 if (g_slist_length(gc->account->deny) ==
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
941 g_slist_length(session->lists.block)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
942
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
943 g_slist_free(session->lists.block);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
944 session->lists.block = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
945 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
946
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
947 if (session->lists.allow == NULL && session->lists.block == NULL)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
948 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
949
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
950 if (session->lists.allow != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
951
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
952 for (s = g_slist_nth(gc->account->permit,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
953 g_slist_length(session->lists.allow));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
954 s != NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
955 s = s->next) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
956
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
957 char *who = s->data;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
958
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
959 if (!strchr(who, '@')) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
960 t = g_slist_append(t, who);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
961 continue;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
962 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
963
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
964 if (g_slist_find(session->lists.block, who)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
965 t = g_slist_append(t, who);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
966 continue;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
967 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
968
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
969 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
970
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
971 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
972 "ADD", buf)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
973 gaim_connection_error(gc, _("Write error"));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
974 return;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
975 }
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
976 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
977
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
978 for (; t != NULL; t = t->next)
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
979 gaim_privacy_permit_remove(gc->account, t->data, TRUE);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
980
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
981 if (t != NULL)
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
982 g_slist_free(t);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
983
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
984 t = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
985 g_slist_free(session->lists.allow);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
986 session->lists.allow = NULL;
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
987 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
988
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
989 if (session->lists.block) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
990 for (s = g_slist_nth(gc->account->deny,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
991 g_slist_length(session->lists.block));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
992 s != NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
993 s = s->next) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
994
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
995 char *who = s->data;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
996
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
997 if (!strchr(who, '@')) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
998 t = g_slist_append(t, who);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
999 continue;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1000 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1001
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1002 if (g_slist_find(session->lists.block, who)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1003 t = g_slist_append(t, who);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1004 continue;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1005 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1006
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1007 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1008
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1009 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1010 "ADD", buf)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1011 gaim_connection_error(gc, _("Write error"));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1012 return;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1013 }
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1014 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1015
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1016 for (; t != NULL; t = t->next)
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
1017 gaim_privacy_deny_remove(gc->account, t->data, TRUE);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1018
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1019 if (t != NULL)
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1020 g_slist_free(t);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1021
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1022 g_slist_free(session->lists.block);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1023 session->lists.block = NULL;
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
1024 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1025 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1026
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1027 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1028 msn_chat_invite(GaimConnection *gc, int id, const char *msg,
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1029 const char *who)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1030 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1031 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1032 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1033
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1034 if (swboard == NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1035 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1036
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1037 if (!msn_switchboard_send_command(swboard, "CAL", who))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1038 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1039 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1040
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1041 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1042 msn_chat_leave(GaimConnection *gc, int id)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1043 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1044 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1045 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1046 char buf[6];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1047
6149
6f4979d8cc3c [gaim-migrate @ 6623]
Christian Hammond <chipx86@chipx86.com>
parents: 6148
diff changeset
1048 if (swboard == NULL) {
6f4979d8cc3c [gaim-migrate @ 6623]
Christian Hammond <chipx86@chipx86.com>
parents: 6148
diff changeset
1049 serv_got_chat_left(gc, id);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1050 return;
6149
6f4979d8cc3c [gaim-migrate @ 6623]
Christian Hammond <chipx86@chipx86.com>
parents: 6148
diff changeset
1051 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1052
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1053 strcpy(buf, "OUT\r\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1054
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1055 if (!msn_servconn_write(swboard->servconn, buf, strlen(buf)))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1056 msn_switchboard_destroy(swboard);
6023
f8edfcb55a34 [gaim-migrate @ 6473]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
1057
6024
a23a1d51f573 [gaim-migrate @ 6474]
Christian Hammond <chipx86@chipx86.com>
parents: 6023
diff changeset
1058 serv_got_chat_left(gc, id);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1059 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1060
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1061 static int
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
1062 msn_chat_send(GaimConnection *gc, int id, const char *message)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1063 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1064 GaimAccount *account = gaim_connection_get_account(gc);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1065 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1066 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1067 MsnMessage *msg;
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8368
diff changeset
1068 char *send, *recv;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1069
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1070 if (swboard == NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1071 return -EINVAL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1072
7108
6faeeecab0dc [gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents: 7104
diff changeset
1073 send = gaim_str_add_cr(message);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1074
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1075 msg = msn_message_new();
7199
aeaa751d32f7 [gaim-migrate @ 7768]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1076 msn_message_set_attr(msg, "X-MMS-IM-Format",
aeaa751d32f7 [gaim-migrate @ 7768]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1077 "FN=MS%20Sans%20Serif; EF=; CO=0; PF=0");
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1078 msn_message_set_body(msg, send);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1079
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1080 g_free(send);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1081
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1082 if (!msn_switchboard_send_msg(swboard, msg)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1083 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1084
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1085 msn_message_destroy(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1086
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1087 return 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1088 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1089
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1090 msn_message_destroy(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1091
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8368
diff changeset
1092 recv = gaim_escape_html(message);
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
1093 serv_got_chat_in(gc, id, gaim_account_get_username(account),
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8368
diff changeset
1094 0, recv, time(NULL));
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8368
diff changeset
1095 g_free(recv);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1096
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1097 return 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1098 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1099
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1100 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1101 msn_keepalive(GaimConnection *gc)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1102 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1103 MsnSession *session = gc->proto_data;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1104 char buf[MSN_BUF_LEN];
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1105
8207
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1106 if (!session->http_method)
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1107 {
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1108 g_snprintf(buf, sizeof(buf), "PNG\r\n");
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
1109
8207
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1110 if (msn_servconn_write(session->notification_conn,
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1111 buf, strlen(buf)) < 0) {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1112
8207
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1113 gaim_connection_error(gc, _("Write error"));
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1114 return;
aa44049e8891 [gaim-migrate @ 8930]
Christian Hammond <chipx86@chipx86.com>
parents: 8175
diff changeset
1115 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1116 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1117 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1118
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1119 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1120 msn_group_buddy(GaimConnection *gc, const char *who,
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1121 const char *old_group_name, const char *new_group_name)
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1122 {
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1123 MsnSession *session = gc->proto_data;
6786
8efafdc38718 [gaim-migrate @ 7325]
Christian Hammond <chipx86@chipx86.com>
parents: 6772
diff changeset
1124 MsnGroup *old_group, *new_group;
6772
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6739
diff changeset
1125 MsnUser *user;
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6842
diff changeset
1126 const char *friendly;
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1127 char outparams[MSN_BUF_LEN];
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1128
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1129 old_group = msn_groups_find_with_name(session->groups, old_group_name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1130 new_group = msn_groups_find_with_name(session->groups, new_group_name);
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1131
6772
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6739
diff changeset
1132 user = msn_users_find_with_passport(session->users, who);
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6739
diff changeset
1133
6858
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6842
diff changeset
1134 if ((friendly = msn_user_get_name(user)) == NULL)
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6842
diff changeset
1135 friendly = msn_user_get_passport(user);
885c6528843b [gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents: 6842
diff changeset
1136
6786
8efafdc38718 [gaim-migrate @ 7325]
Christian Hammond <chipx86@chipx86.com>
parents: 6772
diff changeset
1137 if (old_group != NULL)
8efafdc38718 [gaim-migrate @ 7325]
Christian Hammond <chipx86@chipx86.com>
parents: 6772
diff changeset
1138 msn_user_remove_group_id(user, msn_group_get_id(old_group));
6772
e719379c8a79 [gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents: 6739
diff changeset
1139
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1140 if (new_group == NULL) {
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1141 g_snprintf(outparams, sizeof(outparams), "%s 0",
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1142 gaim_url_encode(new_group_name));
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1143
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1144 if (!msn_servconn_send_command(session->notification_conn,
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1145 "ADG", outparams)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1146 gaim_connection_error(gc, _("Write error"));
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1147 return;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1148 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1149
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1150 /* I hate this. So much. */
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1151 session->moving_buddy = TRUE;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1152 session->dest_group_name = g_strdup(new_group_name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1153 session->old_group = old_group;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1154
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1155 session->moving_user =
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1156 msn_users_find_with_passport(session->users, who);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1157
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1158 msn_user_ref(session->moving_user);
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1159 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1160 else {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1161 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d",
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1162 who, gaim_url_encode(friendly),
6909
31a8936bbccc [gaim-migrate @ 7456]
Christian Hammond <chipx86@chipx86.com>
parents: 6885
diff changeset
1163 msn_group_get_id(new_group));
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1164
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1165 if (!msn_servconn_send_command(session->notification_conn,
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1166 "ADD", outparams)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1167 gaim_connection_error(gc, _("Write error"));
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1168 return;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1169 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1170 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1171
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1172 if (old_group != NULL) {
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1173 g_snprintf(outparams, sizeof(outparams), "FL %s %d",
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1174 who, msn_group_get_id(old_group));
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1175
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1176 if (!msn_servconn_send_command(session->notification_conn,
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1177 "REM", outparams)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1178 gaim_connection_error(gc, _("Write error"));
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1179 return;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1180 }
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1181
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1182 if (msn_users_get_count(msn_group_get_users(old_group)) <= 0) {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1183 g_snprintf(outparams, sizeof(outparams), "%d",
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1184 msn_group_get_id(old_group));
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1185
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1186 if (!msn_servconn_send_command(session->notification_conn,
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1187 "RMG", outparams)) {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1188
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1189 gaim_connection_error(gc, _("Write error"));
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1190 return;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1191 }
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1192 }
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1193 }
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1194 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1195
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1196 static void
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1197 msn_rename_group(GaimConnection *gc, const char *old_group_name,
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1198 const char *new_group_name, GList *members)
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1199 {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1200 MsnSession *session = gc->proto_data;
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1201 char outparams[MSN_BUF_LEN];
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1202 MsnGroup *old_group;
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1203
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1204 if ((old_group = msn_groups_find_with_name(session->groups,
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1205 old_group_name)) != NULL) {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1206
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1207 g_snprintf(outparams, sizeof(outparams), "%d %s 0",
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1208 msn_group_get_id(old_group),
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1209 gaim_url_encode(new_group_name));
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1210
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1211 if (!msn_servconn_send_command(session->notification_conn,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1212 "REG", outparams)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1213 gaim_connection_error(gc, _("Write error"));
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1214 return;
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1215 }
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1216
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1217 msn_group_set_name(old_group, new_group_name);
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1218 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1219 else {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1220 g_snprintf(outparams, sizeof(outparams), "%s 0",
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1221 gaim_url_encode(new_group_name));
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1222
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1223 if (!msn_servconn_send_command(session->notification_conn,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1224 "ADG", outparams)) {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1225 gaim_connection_error(gc, _("Write error"));
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents: 5507
diff changeset
1226 return;
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1227 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1228 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1229 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1230
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1231 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6657
diff changeset
1232 msn_buddy_free(GaimBuddy *b)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1233 {
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1234 if (b->proto_data != NULL) {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1235 msn_user_destroy(b->proto_data);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1236 b->proto_data = NULL;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1237 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1238 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1239
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1240 static void
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
1241 msn_convo_closed(GaimConnection *gc, const char *who)
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1242 {
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1243 GaimAccount *account = gaim_connection_get_account(gc);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1244 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1245 MsnSwitchBoard *swboard;
6026
01dd6b652c22 [gaim-migrate @ 6476]
Christian Hammond <chipx86@chipx86.com>
parents: 6024
diff changeset
1246
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1247 swboard = msn_session_find_switch_with_passport(session, who);
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1248
6026
01dd6b652c22 [gaim-migrate @ 6476]
Christian Hammond <chipx86@chipx86.com>
parents: 6024
diff changeset
1249 if (swboard != NULL && swboard->chat == NULL) {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1250 char sendbuf[256];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1251
5564
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1252 g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n",
187c740f2a4e [gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
1253 gaim_account_get_username(account));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1254
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1255 msn_servconn_write(swboard->servconn, sendbuf, strlen(sendbuf));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1256
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1257 msn_switchboard_destroy(swboard);
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1258 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1259 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1260
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7199
diff changeset
1261 static const char *
7322
ab828b8c3f22 [gaim-migrate @ 7908]
Nathan Walp <nwalp@pidgin.im>
parents: 7288
diff changeset
1262 msn_normalize(const GaimAccount *account, const char *str)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1263 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1264 static char buf[BUF_LEN];
7469
603a58cd23dc [gaim-migrate @ 8082]
Christian Hammond <chipx86@chipx86.com>
parents: 7322
diff changeset
1265 char *tmp;
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1266
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1267 g_return_val_if_fail(str != NULL, NULL);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1268
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1269 g_snprintf(buf, sizeof(buf), "%s%s", str,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1270 (strchr(str, '@') ? "" : "@hotmail.com"));
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1271
7469
603a58cd23dc [gaim-migrate @ 8082]
Christian Hammond <chipx86@chipx86.com>
parents: 7322
diff changeset
1272 tmp = g_utf8_strdown(buf, -1);
603a58cd23dc [gaim-migrate @ 8082]
Christian Hammond <chipx86@chipx86.com>
parents: 7322
diff changeset
1273 strncpy(buf, tmp, sizeof(buf));
603a58cd23dc [gaim-migrate @ 8082]
Christian Hammond <chipx86@chipx86.com>
parents: 7322
diff changeset
1274 g_free(tmp);
603a58cd23dc [gaim-migrate @ 8082]
Christian Hammond <chipx86@chipx86.com>
parents: 7322
diff changeset
1275
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1276 return buf;
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1277 }
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1278
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1279 static void
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1280 msn_set_buddy_icon(GaimConnection *gc, const char *filename)
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1281 {
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1282 MsnSession *session = (MsnSession *)gc->proto_data;
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1283 MsnUser *user = session->user;
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1284
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1285 msn_user_set_buddy_icon(user, filename);
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1286
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1287 msn_session_change_status(session, session->away_state);
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1288 }
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1289
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1290 static void
6885
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1291 msn_remove_group(GaimConnection *gc, const char *name)
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1292 {
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1293 MsnSession *session = (MsnSession *)gc->proto_data;
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1294 MsnGroup *group;
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1295
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1296 if ((group = msn_groups_find_with_name(session->groups, name)) != NULL)
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1297 {
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1298 char outparams[MSN_BUF_LEN];
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1299
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1300 g_snprintf(outparams, sizeof(outparams), "%d",
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1301 msn_group_get_id(group));
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1302
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1303 if (!msn_servconn_send_command(session->notification_conn,
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1304 "RMG", outparams))
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1305 {
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1306 gaim_connection_error(gc, _("Write error"));
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1307
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1308 return;
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1309 }
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1310 }
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1311 }
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1312
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1313 static void
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1314 msn_got_info(void *data, const char *url_text, size_t len)
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1315 {
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1316 MsnGetInfoData *info_data = (MsnGetInfoData *)data;
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1317 char *stripped, *p, *q;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1318 char buf[1024];
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1319 char *user_url = NULL;
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1320 gboolean found;
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1321 gboolean has_info = FALSE;
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1322 char *url_buffer;
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1323 GString *s;
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1324 int stripped_len;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1325
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1326 gaim_debug_info("msn", "In msn_got_info\n");
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1327
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1328 if (url_text == NULL || strcmp(url_text, "") == 0)
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1329 {
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1330 gaim_notify_formatted(info_data->gc, NULL,
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1331 _("Buddy Information"), NULL,
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1332 _("<html><body><b>Error retrieving profile</b></body></html>"),
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1333 NULL, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1334
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1335 return;
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1336 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1337
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1338 url_buffer = g_strdup(url_text);
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1339
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1340 /* If they have a homepage link, MSN masks it such that we need to
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1341 * fetch the url out before gaim_markup_strip_html() nukes it */
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1342 if ((p = strstr(url_text,
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1343 "Take a look at my </font><A class=viewDesc title=\"")) != NULL)
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1344 {
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1345 p += 50;
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1346
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1347 if ((q = strchr(p, '"')) != NULL)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1348 user_url = g_strndup(p, q - p);
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1349 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1350
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1351 /*
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1352 * gaim_markup_strip_html() doesn't strip out character entities like &nbsp;
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1353 * and &#183;
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1354 */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1355 while ((p = strstr(url_buffer, "&nbsp;")) != NULL)
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1356 {
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1357 memmove(p, p + 6, strlen(p + 6));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1358 url_buffer[strlen(url_text) - 6] = '\0';
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1359 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1360
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1361 while ((p = strstr(url_buffer, "&#183;")) != NULL)
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1362 {
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1363 memmove(p, p + 6, strlen(p + 6));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1364 url_buffer[strlen(url_buffer) - 6] = '\0';
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1365 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1366
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1367 /* Nuke the nasty \r's that just get in the way */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1368 while ((p = strchr(url_buffer, '\r')) != NULL)
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1369 {
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1370 memmove(p, p + 1, strlen(p + 1));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1371 url_buffer[strlen(url_buffer) - 1] = '\0';
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1372 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1373
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8713
diff changeset
1374 /* MSN always puts in &#39; for apostrophes...replace them */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1375 while ((p = strstr(url_buffer, "&#39;")) != NULL)
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1376 {
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1377 *p = '\'';
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1378 memmove(p + 1, p + 5, strlen(p + 5));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1379 url_buffer[strlen(url_buffer) - 4] = '\0';
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1380 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1381
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1382 /* Nuke the html, it's easier than trying to parse the horrid stuff */
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1383 stripped = gaim_markup_strip_html(url_buffer);
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1384 stripped_len = strlen(stripped);
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1385
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1386 gaim_debug_misc("msn", "stripped = %p\n", stripped);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1387 gaim_debug_misc("msn", "url_buffer = %p\n", url_buffer);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1388
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1389 /* Gonna re-use the memory we've already got for url_buffer */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1390 /* No we're not. */
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1391 s = g_string_sized_new(strlen(url_buffer));
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1392
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1393 /* Extract their Name and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1394 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1395 "\tName", 0, "\t", '\n', "Undisclosed", _("Name"), 0, NULL);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1396
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1397 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1398 has_info = TRUE;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1399
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1400 /* Extract their Age and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1401 found = gaim_markup_extract_info_field(stripped, stripped_len, s,"\tAge",
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1402 0, "\t", '\n', "Undisclosed", _("Age"), 0, NULL);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1403
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1404 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1405 has_info = TRUE;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1406
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1407 /* Extract their Gender and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1408 found = gaim_markup_extract_info_field(stripped, stripped_len, s,"\tGender",
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1409 6, "\t", '\n', "Undisclosed", _("Gender"), 0, NULL);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1410
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1411 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1412 has_info = TRUE;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1413
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1414 /* Extract their MaritalStatus and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1415 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1416 "\tMaritalStatus", 0, "\t", '\n', "Undisclosed",
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1417 _("Marital Status"), 0, NULL);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1418
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1419 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1420 has_info = TRUE;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1421
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1422 /* Extract their Location and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1423 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1424 "\tLocation", 0, "\t", '\n', "Undisclosed", _("Location"),
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1425 0, NULL);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1426
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1427 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1428 has_info = TRUE;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1429
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1430 /* Extract their Occupation and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1431 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1432 "\t Occupation", 6, "\t", '\n', "Undisclosed", _("Occupation"),
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1433 0, NULL);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1434
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1435 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1436 has_info = TRUE;
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1437
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1438 /*
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1439 * The fields, 'A Little About Me', 'Favorite Things', 'Hobbies
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1440 * and Interests', 'Favorite Quote', and 'My Homepage' may or may
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1441 * not appear, in any combination. However, they do appear in
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1442 * certain order, so we can successively search to pin down the
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1443 * distinct values.
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1444 */
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1445
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1446 /* Check if they have A Little About Me */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1447 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1448 "\tA Little About Me", 1, "Favorite Things", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1449 _("A Little About Me"), 0, NULL);
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1450
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1451 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1452 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1453 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1454 "\tA Little About Me", 1, "Hobbies and Interests", '\n',
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1455 NULL, _("A Little About Me"), 0, NULL);
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1456 }
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1457
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1458 if (!found)
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1459 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1460 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1461 "\tA Little About Me", 1, "Favorite Quote", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1462 _("A Little About Me"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1463 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1464
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1465 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1466 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1467 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1468 "\tA Little About Me", 1, "My Homepage\tTake a look", '\n',
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1469 NULL, _("A Little About Me"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1470 }
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1471
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1472 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1473 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1474 gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1475 "\tA Little About Me", 1, "last updated", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1476 _("A Little About Me"), 0, NULL);
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1477 }
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1478
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1479 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1480 has_info = TRUE;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1481
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1482 /* Check if they have Favorite Things */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1483 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1484 "Favorite Things", 1, "Hobbies and Interests", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1485 _("Favorite Things"), 0, NULL);
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1486
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1487 if (!found)
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1488 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1489 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1490 "Favorite Things", 1, "Favorite Quote", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1491 "Favorite Things", 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1492 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1493
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1494 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1495 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1496 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1497 "Favorite Things", 1, "My Homepage\tTake a look", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1498 _("Favorite Things"), 0, NULL);
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1499 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1500
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1501 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1502 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1503 gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1504 "Favorite Things", 1, "last updated", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1505 _("Favorite Things"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1506 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1507
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1508 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1509 has_info = TRUE;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1510
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1511 /* Check if they have Hobbies and Interests */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1512 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1513 "Hobbies and Interests", 1, "Favorite Quote", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1514 _("Hobbies and Interests"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1515
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1516 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1517 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1518 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1519 "Hobbies and Interests", 1, "My Homepage\tTake a look",
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1520 '\n', NULL, _("Hobbies and Interests"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1521 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1522
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1523 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1524 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1525 gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1526 "Hobbies and Interests", 1, "last updated", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1527 _("Hobbies and Interests"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1528 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1529
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1530 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1531 has_info = TRUE;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1532
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1533 /* Check if they have Favorite Quote */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1534 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1535 "Favorite Quote", 1, "My Homepage\tTake a look", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1536 _("Favorite Quote"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1537
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1538 if (!found)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1539 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1540 gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1541 "Favorite Quote", 1, "last updated", '\n', NULL,
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1542 _("Favorite Quote"), 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1543 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1544
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1545 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1546 has_info = TRUE;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1547
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1548 /* Extract the last updated date and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1549 found = gaim_markup_extract_info_field(stripped, stripped_len, s,
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1550 "\tlast updated:", 1, "\n", '\n', NULL, _("Last Updated"),
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
1551 0, NULL);
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1552
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1553 if (found)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1554 has_info = TRUE;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1555
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1556 /* If we were able to fetch a homepage url earlier, stick it in there */
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1557 if (user_url != NULL)
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1558 {
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1559 g_snprintf(buf, sizeof(buf),
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1560 "<b>%s:</b><br><a href=\"%s\">%s</a><br>\n",
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1561 _("Homepage"), user_url, user_url);
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1562
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1563 g_string_append(s, buf);
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1564
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1565 g_free(user_url);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1566
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1567 has_info = TRUE;
6859
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1568 }
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1569
17514a2f976a [gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents: 6858
diff changeset
1570 /* Finish it off, and show it to them */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1571 g_string_append(s, "</body></html>\n");
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1572
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1573 if (has_info)
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1574 {
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1575 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"),
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1576 NULL, s->str, NULL, NULL);
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1577 }
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1578 else
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1579 {
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1580 char primary[256];
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1581
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1582 g_snprintf(primary, sizeof(primary),
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1583 _("User information for %s unavailable"), info_data->name);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1584 gaim_notify_error(info_data->gc, NULL, primary,
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1585 _("The user's profile is empty."));
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1586 }
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
1587
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1588 g_free(stripped);
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1589 g_free(url_buffer);
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7590
diff changeset
1590 g_string_free(s, TRUE);
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1591 g_free(info_data->name);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1592 g_free(info_data);
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1593 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1594
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1595 static void
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1596 msn_get_info(GaimConnection *gc, const char *name)
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1597 {
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1598 MsnGetInfoData *data;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1599 char *url;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1600
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1601 data = g_new0(MsnGetInfoData, 1);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1602 data->gc = gc;
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1603 data->name = g_strdup(name);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1604
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1605 url = g_strdup_printf("%s%s", PROFILE_URL, name);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1606
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1607 gaim_url_fetch(url, FALSE,
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
1608 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", TRUE,
7104
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1609 msn_got_info, data);
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1610
7700a28929bd [gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1611 g_free(url);
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1612 }
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1613
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1614 static GaimPluginPrefFrame *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1615 get_plugin_pref_frame(GaimPlugin *plugin) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1616 GaimPluginPrefFrame *frame;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1617 GaimPluginPref *ppref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1618
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1619 frame = gaim_plugin_pref_frame_new();
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1620
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1621 ppref = gaim_plugin_pref_new_with_label(_("Conversations"));
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1622 gaim_plugin_pref_frame_add(frame, ppref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1623
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1624 ppref = gaim_plugin_pref_new_with_name_and_label(
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1625 "/plugins/prpl/msn/conv_close_notice",
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1626 _("Display conversation closed notices"));
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1627 gaim_plugin_pref_frame_add(frame, ppref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1628
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1629 ppref = gaim_plugin_pref_new_with_name_and_label(
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1630 "/plugins/prpl/msn/conv_timeout_notice",
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1631 _("Display timeout notices"));
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1632 gaim_plugin_pref_frame_add(frame, ppref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1633
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1634 return frame;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1635 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1636
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1637 static GaimPluginUiInfo prefs_info = {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1638 get_plugin_pref_frame
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1639 };
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1640
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1641 static GaimPluginProtocolInfo prpl_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1642 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8735
diff changeset
1643 GAIM_PRPL_API_VERSION,
8044
34b086e2619d [gaim-migrate @ 8728]
Nathan Walp <nwalp@pidgin.im>
parents: 7981
diff changeset
1644 OPT_PROTO_MAIL_CHECK /* | OPT_PROTO_BUDDY_ICON */,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1645 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1646 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1647 msn_list_icon,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1648 msn_list_emblems,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1649 msn_status_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1650 msn_tooltip_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1651 msn_away_states,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1652 msn_actions,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1653 msn_buddy_menu,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1654 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1655 msn_login,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1656 msn_close,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1657 msn_send_im,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1658 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1659 msn_send_typing,
6516
7c14b35bc984 [gaim-migrate @ 7033]
Luke Schierer <lschiere@pidgin.im>
parents: 6378
diff changeset
1660 msn_get_info,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1661 msn_set_away,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1662 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1663 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1664 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1665 msn_set_idle,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1666 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1667 msn_add_buddy,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1668 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1669 msn_rem_buddy,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1670 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1671 msn_add_permit,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1672 msn_add_deny,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1673 msn_rem_permit,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1674 msn_rem_deny,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1675 msn_set_permit_deny,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1676 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1677 NULL,
8562
e3c059c3d92d [gaim-migrate @ 9306]
Luke Schierer <lschiere@pidgin.im>
parents: 8532
diff changeset
1678 NULL, /* reject chat invite */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1679 msn_chat_invite,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1680 msn_chat_leave,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1681 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1682 msn_chat_send,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1683 msn_keepalive,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1684 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1685 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1686 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1687 NULL,
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1688 msn_group_buddy,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1689 msn_rename_group,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1690 msn_buddy_free,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1691 msn_convo_closed,
6885
66dd420d3d23 [gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents: 6859
diff changeset
1692 msn_normalize,
7590
3a48ade4f510 [gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents: 7563
diff changeset
1693 msn_set_buddy_icon,
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8568
diff changeset
1694 msn_remove_group,
8589
72a0759a37a2 [gaim-migrate @ 9340]
Mark Doliner <mark@kingant.net>
parents: 8586
diff changeset
1695 NULL,
72a0759a37a2 [gaim-migrate @ 9340]
Mark Doliner <mark@kingant.net>
parents: 8586
diff changeset
1696 NULL,
72a0759a37a2 [gaim-migrate @ 9340]
Mark Doliner <mark@kingant.net>
parents: 8586
diff changeset
1697 NULL,
72a0759a37a2 [gaim-migrate @ 9340]
Mark Doliner <mark@kingant.net>
parents: 8586
diff changeset
1698 NULL,
72a0759a37a2 [gaim-migrate @ 9340]
Mark Doliner <mark@kingant.net>
parents: 8586
diff changeset
1699 NULL,
72a0759a37a2 [gaim-migrate @ 9340]
Mark Doliner <mark@kingant.net>
parents: 8586
diff changeset
1700 NULL,
72a0759a37a2 [gaim-migrate @ 9340]
Mark Doliner <mark@kingant.net>
parents: 8586
diff changeset
1701 NULL
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1702 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1703
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1704 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1705 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8735
diff changeset
1706 GAIM_PLUGIN_API_VERSION, /**< api_version */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1707 GAIM_PLUGIN_PROTOCOL, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1708 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1709 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1710 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1711 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1712
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1713 "prpl-msn", /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1714 "MSN", /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1715 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1716 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1717 N_("MSN Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1718 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1719 N_("MSN Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1720 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6228
diff changeset
1721 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1722
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1723 NULL, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1724 NULL, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1725 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1726
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1727 NULL, /**< ui_info */
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1728 &prpl_info, /**< extra_info */
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents: 8697
diff changeset
1729 &prefs_info /**< prefs_info */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1730 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1731
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1732 static void
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
1733 init_plugin(GaimPlugin *plugin)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1734 {
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
1735 GaimAccountOption *option;
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1736
5685
43ea75092684 [gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
1737 option = gaim_account_option_string_new(_("Login server"), "server",
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
1738 MSN_SERVER);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
1739 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
1740 option);
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1741
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
1742 option = gaim_account_option_int_new(_("Port"), "port", 1863);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
1743 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5626
diff changeset
1744 option);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1745
7288
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
1746 option = gaim_account_option_bool_new(_("Use HTTP Method"), "http_method",
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
1747 FALSE);
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
1748 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
1749 option);
ff9127038a5a [gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents: 7277
diff changeset
1750
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1751 my_protocol = plugin;
5626
6275ac113622 [gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1752
6275ac113622 [gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1753 gaim_prefs_add_none("/plugins/prpl/msn");
6275ac113622 [gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1754 gaim_prefs_add_bool("/plugins/prpl/msn/conv_close_notice", TRUE);
6275ac113622 [gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents: 5567
diff changeset
1755 gaim_prefs_add_bool("/plugins/prpl/msn/conv_timeout_notice", TRUE);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1756 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1757
5793
952710ac6635 [gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents: 5717
diff changeset
1758 GAIM_INIT_PLUGIN(msn, init_plugin, info);