Mercurial > pidgin
annotate src/protocols/msn/msn.c @ 6832:f03c0085c424
[gaim-migrate @ 7377]
Removed the g_free wrapper from MSN.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 14 Sep 2003 03:26:27 +0000 |
parents | 1cfbb731aa1f |
children | bd433a45a463 |
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 * |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
7 * |
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 static void (*real_g_free)(gpointer) = g_free; |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6801
diff
changeset
|
24 |
4542
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
25 #include "msn.h" |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
26 #include "accountopt.h" |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
27 #include "msg.h" |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
28 #include "page.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 | 33 #include "multi.h" |
6516 | 34 #include "html.h" |
4546
a951bb590857
[gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4542
diff
changeset
|
35 |
4687 | 36 #define BUDDY_ALIAS_MAXLEN 388 |
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 | 39 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
40 static char *msn_normalize(const char *str); |
2086 | 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 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
49 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
50 msn_act_id(GaimConnection *gc, const char *entry) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
51 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
52 MsnSession *session = gc->proto_data; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
53 GaimAccount *account = gaim_connection_get_account(gc); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
54 char outparams[MSN_BUF_LEN]; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
55 char *alias; |
2086 | 56 |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
57 if (entry == NULL || *entry == '\0') |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
58 alias = g_strdup(""); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
59 else |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
60 alias = g_strdup(entry); |
3171 | 61 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
62 if (strlen(alias) >= BUDDY_ALIAS_MAXLEN) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5382
diff
changeset
|
63 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5382
diff
changeset
|
64 _("Your new MSN friendly name is too long."), NULL); |
2738
01f0497fe6c8
[gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
65 return; |
01f0497fe6c8
[gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
66 } |
01f0497fe6c8
[gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
67 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
68 g_snprintf(outparams, sizeof(outparams), "%s %s", |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
69 gaim_account_get_username(account), msn_url_encode(alias)); |
2086 | 70 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
71 g_free(alias); |
2086 | 72 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
73 if (!msn_servconn_send_command(session->notification_conn, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
74 "REA", outparams)) { |
2738
01f0497fe6c8
[gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
75 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
76 gaim_connection_error(gc, _("Write error")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
77 return; |
2688
98b1ac8ddea3
[gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
78 } |
2086 | 79 } |
80 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
81 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
82 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
|
83 { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
84 MsnSession *session = gc->proto_data; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
85 char outparams[MSN_BUF_LEN]; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
86 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
87 if (entry == NULL || *entry == '\0') |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
88 g_snprintf(outparams, sizeof(outparams), "%s ", type); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
89 else |
6228
36897deb064b
[gaim-migrate @ 6721]
Christian Hammond <chipx86@chipx86.com>
parents:
6149
diff
changeset
|
90 g_snprintf(outparams, sizeof(outparams), "%s %s", type, |
36897deb064b
[gaim-migrate @ 6721]
Christian Hammond <chipx86@chipx86.com>
parents:
6149
diff
changeset
|
91 msn_url_encode(entry)); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
92 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
93 if (!msn_servconn_send_command(session->notification_conn, |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
94 "PRP", outparams)) { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
95 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
96 gaim_connection_error(gc, _("Write error")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
97 return; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
98 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
99 } |
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 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
102 msn_set_home_phone_cb(GaimConnection *gc, const char *entry) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
103 { |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
104 msn_set_prp(gc, "PHH", entry); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
105 } |
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 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
108 msn_set_work_phone_cb(GaimConnection *gc, const char *entry) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
109 { |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
110 msn_set_prp(gc, "PHW", entry); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
111 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
112 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
113 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
114 msn_set_mobile_phone_cb(GaimConnection *gc, const char *entry) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
115 { |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
116 msn_set_prp(gc, "PHM", entry); |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
117 } |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
118 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
119 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
120 enable_msn_pages_cb(GaimConnection *gc) |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
121 { |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
122 msn_set_prp(gc, "MOB", "Y"); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
123 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
124 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
125 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
126 disable_msn_pages_cb(GaimConnection *gc) |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
127 { |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
128 msn_set_prp(gc, "MOB", "N"); |
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 |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
131 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
132 send_to_mobile_cb(MsnMobileData *data, const char *entry) |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
133 { |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
134 MsnSession *session = data->gc->proto_data; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
135 MsnServConn *servconn = session->notification_conn; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
136 MsnUser *user; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
137 MsnPage *page; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
138 char *page_str; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
139 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
140 user = msn_user_new(session, data->passport, NULL); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
141 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
142 page = msn_page_new(); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
143 msn_page_set_receiver(page, user); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
144 msn_page_set_transaction_id(page, ++session->trId); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
145 msn_page_set_body(page, entry); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
146 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
147 page_str = msn_page_build_string(page); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
148 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
149 msn_user_destroy(user); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
150 msn_page_destroy(page); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
151 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
152 if (!msn_servconn_write(servconn, page_str, strlen(page_str))) { |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
153 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
154 gaim_connection_error(data->gc, _("Write error")); |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
155 } |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
156 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
157 g_free(page_str); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
158 } |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
159 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
160 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
161 close_mobile_page_cb(MsnMobileData *data, const char *entry) |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
162 { |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
163 g_free(data); |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
164 } |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
165 |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
166 /* -- */ |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
167 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
168 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
169 msn_show_set_friendly_name(GaimConnection *gc) |
2086 | 170 { |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
171 gaim_request_input(gc, NULL, _("Set your friendly name."), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
172 _("This is the name that other MSN buddies will " |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
173 "see you as."), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6026
diff
changeset
|
174 gaim_connection_get_display_name(gc), FALSE, FALSE, |
5481
084147a0d9e4
[gaim-migrate @ 5877]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
175 _("OK"), G_CALLBACK(msn_act_id), |
084147a0d9e4
[gaim-migrate @ 5877]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
176 _("Cancel"), NULL, gc); |
2086 | 177 } |
178 | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
179 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
180 msn_show_set_home_phone(GaimConnection *gc) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
181 { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
182 MsnSession *session = gc->proto_data; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
183 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
184 gaim_request_input(gc, NULL, _("Set your home phone number."), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6026
diff
changeset
|
185 msn_user_get_home_phone(session->user), FALSE, FALSE, |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
186 _("OK"), G_CALLBACK(msn_set_home_phone_cb), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
187 _("Cancel"), NULL, gc); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
188 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
189 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
190 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
191 msn_show_set_work_phone(GaimConnection *gc) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
192 { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
193 MsnSession *session = gc->proto_data; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
194 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
195 gaim_request_input(gc, NULL, _("Set your work phone number."), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6026
diff
changeset
|
196 msn_user_get_work_phone(session->user), FALSE, FALSE, |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
197 _("OK"), G_CALLBACK(msn_set_work_phone_cb), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
198 _("Cancel"), NULL, gc); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
199 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
200 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
201 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
202 msn_show_set_mobile_phone(GaimConnection *gc) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
203 { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
204 MsnSession *session = gc->proto_data; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
205 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
206 gaim_request_input(gc, NULL, _("Set your mobile phone number."), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6026
diff
changeset
|
207 msn_user_get_mobile_phone(session->user), FALSE, FALSE, |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
208 _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
209 _("Cancel"), NULL, gc); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
210 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
211 |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
212 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
213 msn_show_set_mobile_pages(GaimConnection *gc) |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
214 { |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5491
diff
changeset
|
215 gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"), |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5491
diff
changeset
|
216 _("Do you want to allow or disallow people on " |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5491
diff
changeset
|
217 "your buddy list to send you MSN Mobile pages " |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5491
diff
changeset
|
218 "to your cell phone or other mobile device?"), |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
219 -1, gc, 3, |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
220 _("Allow"), G_CALLBACK(enable_msn_pages_cb), |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
221 _("Disallow"), G_CALLBACK(disable_msn_pages_cb), |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
222 _("Cancel"), NULL); |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
223 } |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
224 |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
225 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
226 show_send_to_mobile_cb(GaimConnection *gc, const char *passport) |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
227 { |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
228 MsnUser *user; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
229 MsnSession *session = gc->proto_data; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
230 MsnMobileData *data; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
231 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
232 user = msn_users_find_with_passport(session->users, passport); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
233 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
234 data = g_new0(MsnMobileData, 1); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
235 data->gc = gc; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
236 data->passport = passport; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
237 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
238 gaim_request_input(gc, NULL, _("Send a mobile message."), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6026
diff
changeset
|
239 NULL, TRUE, FALSE, |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
240 _("Page"), G_CALLBACK(send_to_mobile_cb), |
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
241 _("Close"), G_CALLBACK(close_mobile_page_cb), |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
242 data); |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
243 } |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
244 |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
245 static void |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
246 initiate_chat_cb(GaimConnection *gc, const char *passport) |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
247 { |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
248 GaimAccount *account = gaim_connection_get_account(gc); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
249 MsnSession *session = gc->proto_data; |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
250 MsnSwitchBoard *swboard; |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
251 MsnUser *user; |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
252 |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
253 if ((swboard = msn_session_open_switchboard(session)) == NULL) { |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
254 gaim_connection_error(gc, _("Write error")); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
255 |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
256 return; |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
257 } |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
258 |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
259 user = msn_user_new(session, passport, NULL); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
260 |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
261 msn_switchboard_set_user(swboard, user); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
262 |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
263 swboard->total_users = 1; |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
264 |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
265 swboard->chat = serv_got_joined_chat(gc, ++swboard->chat_id, "MSN Chat"); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
266 |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
267 gaim_chat_add_user(GAIM_CHAT(swboard->chat), |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
268 gaim_account_get_username(account), NULL); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
269 } |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
270 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
271 /************************************************************************** |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
272 * Protocol Plugin ops |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
273 **************************************************************************/ |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
274 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
275 static const char * |
6695 | 276 msn_list_icon(GaimAccount *a, GaimBuddy *b) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
277 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
278 return "msn"; |
2993 | 279 } |
280 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
281 static void |
6695 | 282 msn_list_emblems(GaimBuddy *b, char **se, char **sw, |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
283 char **nw, char **ne) |
2086 | 284 { |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
285 MsnUser *user; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
286 char *emblems[4] = { NULL, NULL, NULL, NULL }; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
287 int away_type = MSN_AWAY_TYPE(b->uc); |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
288 int i = 0; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
289 |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
290 user = b->proto_data; |
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
291 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
292 if (b->present == GAIM_BUDDY_OFFLINE) |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
293 emblems[i++] = "offline"; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
294 else if (away_type == MSN_BUSY || away_type == MSN_PHONE) |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
295 emblems[i++] = "occupied"; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
296 else if (away_type != 0) |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
297 emblems[i++] = "away"; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
298 |
5378
a991ff4d5d40
[gaim-migrate @ 5754]
Christian Hammond <chipx86@chipx86.com>
parents:
5372
diff
changeset
|
299 if (user == NULL) { |
6739
2beae1058ca4
[gaim-migrate @ 7271]
Christian Hammond <chipx86@chipx86.com>
parents:
6702
diff
changeset
|
300 emblems[0] = "offline"; |
5378
a991ff4d5d40
[gaim-migrate @ 5754]
Christian Hammond <chipx86@chipx86.com>
parents:
5372
diff
changeset
|
301 } |
a991ff4d5d40
[gaim-migrate @ 5754]
Christian Hammond <chipx86@chipx86.com>
parents:
5372
diff
changeset
|
302 else if (user->mobile) |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
303 emblems[i++] = "wireless"; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
304 |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
305 *se = emblems[0]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
306 *sw = emblems[1]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
307 *nw = emblems[2]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
308 *ne = emblems[3]; |
2086 | 309 } |
310 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
311 static char * |
6695 | 312 msn_status_text(GaimBuddy *b) |
2086 | 313 { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
314 if (b->uc & UC_UNAVAILABLE) |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
315 return g_strdup(msn_away_get_text(MSN_AWAY_TYPE(b->uc))); |
2086 | 316 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
317 return NULL; |
2086 | 318 } |
319 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
320 static char * |
6695 | 321 msn_tooltip_text(GaimBuddy *b) |
2086 | 322 { |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
323 char *text = NULL; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
324 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
325 if (GAIM_BUDDY_IS_ONLINE(b)) { |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
326 text = g_strdup_printf(_("<b>Status:</b> %s"), |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
327 msn_away_get_text(MSN_AWAY_TYPE(b->uc))); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
328 } |
2086 | 329 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
330 return text; |
2086 | 331 } |
332 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
333 static GList * |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
334 msn_away_states(GaimConnection *gc) |
2086 | 335 { |
336 GList *m = NULL; | |
337 | |
3263 | 338 m = g_list_append(m, _("Available")); |
339 m = g_list_append(m, _("Away From Computer")); | |
340 m = g_list_append(m, _("Be Right Back")); | |
341 m = g_list_append(m, _("Busy")); | |
342 m = g_list_append(m, _("On The Phone")); | |
343 m = g_list_append(m, _("Out To Lunch")); | |
344 m = g_list_append(m, _("Hidden")); | |
2086 | 345 |
346 return m; | |
347 } | |
348 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
349 static GList * |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
350 msn_actions(GaimConnection *gc) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
351 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
352 GList *m = NULL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
353 struct proto_actions_menu *pam; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
354 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
355 pam = g_new0(struct proto_actions_menu, 1); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
356 pam->label = _("Set Friendly Name"); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
357 pam->callback = msn_show_set_friendly_name; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
358 pam->gc = gc; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
359 m = g_list_append(m, pam); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
360 |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
361 m = g_list_append(m, NULL); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
362 |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
363 pam = g_new0(struct proto_actions_menu, 1); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
364 pam->label = _("Set Home Phone Number"); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
365 pam->callback = msn_show_set_home_phone; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
366 pam->gc = gc; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
367 m = g_list_append(m, pam); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
368 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
369 pam = g_new0(struct proto_actions_menu, 1); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
370 pam->label = _("Set Work Phone Number"); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
371 pam->callback = msn_show_set_work_phone; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
372 pam->gc = gc; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
373 m = g_list_append(m, pam); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
374 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
375 pam = g_new0(struct proto_actions_menu, 1); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
376 pam->label = _("Set Mobile Phone Number"); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
377 pam->callback = msn_show_set_mobile_phone; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
378 pam->gc = gc; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
379 m = g_list_append(m, pam); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
380 |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
381 m = g_list_append(m, NULL); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
382 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
383 #if 0 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
384 pam = g_new0(struct proto_actions_menu, 1); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
385 pam->label = _("Enable/Disable Mobile Devices"); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
386 pam->callback = msn_show_set_mobile_support; |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
387 pam->gc = gc; |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
388 m = g_list_append(m, pam); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
389 #endif |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
390 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
391 pam = g_new0(struct proto_actions_menu, 1); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
392 pam->label = _("Allow/Disallow Mobile Pages"); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
393 pam->callback = msn_show_set_mobile_pages; |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
394 pam->gc = gc; |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
395 m = g_list_append(m, pam); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
396 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
397 return m; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
398 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
399 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
400 static GList * |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
401 msn_buddy_menu(GaimConnection *gc, const char *who) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
402 { |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
403 GaimAccount *account = gaim_connection_get_account(gc); |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
404 MsnUser *user; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
405 struct proto_buddy_menu *pbm; |
6695 | 406 GaimBuddy *b; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
407 GList *m = NULL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
408 |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
409 b = gaim_find_buddy(gc->account, who); |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
410 user = b->proto_data; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
411 |
5382
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
412 if (user != NULL) { |
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
413 if (user->mobile) { |
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
414 pbm = g_new0(struct proto_buddy_menu, 1); |
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
415 pbm->label = _("Send to Mobile"); |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
416 pbm->callback = show_send_to_mobile_cb; |
5382
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
417 pbm->gc = gc; |
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
418 m = g_list_append(m, pbm); |
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
419 } |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
420 } |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
421 |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
422 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) { |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
423 pbm = g_new0(struct proto_buddy_menu, 1); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
424 pbm->label = _("Initiate Chat"); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
425 pbm->callback = initiate_chat_cb; |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
426 pbm->gc = gc; |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
427 m = g_list_append(m, pbm); |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
428 } |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
429 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
430 return m; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
431 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
432 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
433 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
434 msn_login(GaimAccount *account) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
435 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
436 GaimConnection *gc; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
437 MsnSession *session; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
438 const char *username; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
439 const char *server; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
440 int port; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
441 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
442 server = gaim_account_get_string(account, "server", MSN_SERVER); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
443 port = gaim_account_get_int(account, "port", MSN_PORT); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
444 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
445 gc = gaim_account_get_connection(account); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
446 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
447 session = msn_session_new(account, server, port); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
448 session->prpl = my_protocol; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
449 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
450 gc->proto_data = session; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
451 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
452 gaim_connection_update_progress(gc, _("Connecting"), 0, MSN_CONNECT_STEPS); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
453 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
454 /* Hmm, I don't like this. */ |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
455 username = msn_normalize(gaim_account_get_username(account)); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
456 |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
457 if (strcmp(username, gaim_account_get_username(account))) |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
458 gaim_account_set_username(account, username); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
459 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
460 if (!msn_session_connect(session)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
461 gaim_connection_error(gc, _("Unable to connect")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
462 |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
463 return; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
464 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
465 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
466 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
467 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
468 msn_close(GaimConnection *gc) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
469 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
470 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
471 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
472 msn_session_destroy(session); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
473 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
474 gc->proto_data = NULL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
475 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
476 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
477 static int |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
478 msn_send_im(GaimConnection *gc, const char *who, const char *message, |
6622 | 479 int len, GaimImFlags flags) |
2086 | 480 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
481 GaimAccount *account = gaim_connection_get_account(gc); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
482 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
483 MsnSwitchBoard *swboard; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
484 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
485 swboard = msn_session_find_switch_with_passport(session, who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
486 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
487 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
488 MsnMessage *msg; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
489 MsnUser *user; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
490 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
491 user = msn_user_new(session, who, NULL); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
492 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
493 msg = msn_message_new(); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
494 msn_message_set_receiver(msg, user); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
495 msn_message_set_attr(msg, "X-MMS-IM-Format", |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
496 "FN=Arial; EF=; CO=0; PF=0"); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
497 msn_message_set_body(msg, message); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
498 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
499 if (swboard != NULL) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
500 if (!msn_switchboard_send_msg(swboard, msg)) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
501 msn_switchboard_destroy(swboard); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
502 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
503 else { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
504 if ((swboard = msn_session_open_switchboard(session)) == NULL) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
505 msn_message_destroy(msg); |
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 gaim_connection_error(gc, _("Write error")); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
508 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
509 return 1; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
510 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
511 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
512 msn_switchboard_set_user(swboard, user); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
513 msn_switchboard_send_msg(swboard, msg); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
514 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
515 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
516 msn_user_destroy(user); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
517 msn_message_destroy(msg); |
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 else { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
520 /* |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
521 * In MSN, you can't send messages to yourself, so |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
522 * we'll fake like we received it ;) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
523 */ |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
524 serv_got_typing_stopped(gc, (char *)who); |
6622 | 525 serv_got_im(gc, who, message, flags, |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
526 time(NULL), -1); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
527 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
528 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
529 return 1; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
530 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
531 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
532 static int |
6059 | 533 msn_send_typing(GaimConnection *gc, const char *who, int typing) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
534 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
535 GaimAccount *account = gaim_connection_get_account(gc); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
536 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
537 MsnSwitchBoard *swboard; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
538 MsnMessage *msg; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
539 MsnUser *user; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
540 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
541 if (!typing) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
542 return 0; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
543 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
544 if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
545 /* 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
|
546 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
|
547 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
548 return MSN_TYPING_SEND_TIMEOUT; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
549 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
550 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
551 swboard = msn_session_find_switch_with_passport(session, who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
552 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
553 if (swboard == NULL) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
554 return 0; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
555 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
556 user = msn_user_new(session, who, NULL); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
557 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
558 msg = msn_message_new(); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
559 msn_message_set_content_type(msg, "text/x-msmsgscontrol"); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
560 msn_message_set_receiver(msg, user); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
561 msn_message_set_charset(msg, NULL); |
5505
870207a49f2f
[gaim-migrate @ 5904]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
562 msn_message_set_flag(msg, 'U'); |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
563 msn_message_set_attr(msg, "TypingUser", |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
564 gaim_account_get_username(account)); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
565 msn_message_set_attr(msg, "User-Agent", NULL); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
566 msn_message_set_body(msg, "\r\n"); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
567 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
568 if (!msn_switchboard_send_msg(swboard, msg)) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
569 msn_switchboard_destroy(swboard); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
570 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
571 msn_user_destroy(user); |
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 MSN_TYPING_SEND_TIMEOUT; |
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 static void |
6059 | 577 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
|
578 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
579 MsnSession *session = gc->proto_data; |
4270 | 580 const char *away; |
2086 | 581 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
582 if (gc->away != NULL) { |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4069
diff
changeset
|
583 g_free(gc->away); |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4069
diff
changeset
|
584 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4069
diff
changeset
|
585 } |
2086 | 586 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
587 if (msg != NULL) { |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4069
diff
changeset
|
588 gc->away = g_strdup(""); |
2086 | 589 away = "AWY"; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
590 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
591 else if (state) { |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4069
diff
changeset
|
592 gc->away = g_strdup(""); |
2086 | 593 |
3538 | 594 if (!strcmp(state, _("Away From Computer"))) |
2086 | 595 away = "AWY"; |
3538 | 596 else if (!strcmp(state, _("Be Right Back"))) |
2086 | 597 away = "BRB"; |
3538 | 598 else if (!strcmp(state, _("Busy"))) |
2086 | 599 away = "BSY"; |
3538 | 600 else if (!strcmp(state, _("On The Phone"))) |
2086 | 601 away = "PHN"; |
3538 | 602 else if (!strcmp(state, _("Out To Lunch"))) |
2086 | 603 away = "LUN"; |
3538 | 604 else if (!strcmp(state, _("Hidden"))) |
2152
f631cfc8e824
[gaim-migrate @ 2162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
605 away = "HDN"; |
2086 | 606 else { |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4069
diff
changeset
|
607 g_free(gc->away); |
2086 | 608 gc->away = NULL; |
609 away = "NLN"; | |
610 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
611 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
612 else if (gc->is_idle) |
2086 | 613 away = "IDL"; |
614 else | |
615 away = "NLN"; | |
616 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
617 if (!msn_servconn_send_command(session->notification_conn, "CHG", away)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
618 gaim_connection_error(gc, _("Write error")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
619 return; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
620 } |
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 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
623 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
624 msn_set_idle(GaimConnection *gc, int idle) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
625 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
626 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
627 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
628 if (gc->away != NULL) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
629 return; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
630 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
631 if (!msn_servconn_send_command(session->notification_conn, "CHG", |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
632 (idle ? "IDL" : "NLN"))) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
633 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
634 gaim_connection_error(gc, _("Write error")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
635 return; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
636 } |
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 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
639 static void |
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6786
diff
changeset
|
640 msn_add_buddy(GaimConnection *gc, const char *name, GaimGroup *group) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
641 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
642 MsnSession *session = gc->proto_data; |
6789
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
643 MsnGroup *msn_group = NULL; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
644 char *who; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
645 char outparams[MSN_BUF_LEN]; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
646 GSList *l; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
647 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
648 who = msn_normalize(name); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
649 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
650 if (strchr(who, ' ')) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
651 /* This is a broken blist entry. */ |
2086 | 652 return; |
653 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
654 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
655 for (l = session->lists.forward; l != NULL; l = l->next) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
656 MsnUser *user = l->data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
657 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
658 if (!gaim_utf8_strcasecmp(who, msn_user_get_passport(user))) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
659 break; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
660 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
661 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
662 if (l != NULL) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
663 return; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
664 |
6789
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
665 if (group != NULL) |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
666 msn_group = msn_groups_find_with_name(session->groups, group->name); |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
667 |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
668 if (msn_group != NULL) |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
669 { |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
670 g_snprintf(outparams, sizeof(outparams), |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
671 "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
|
672 } |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
673 else |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
674 { |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
675 g_snprintf(outparams, sizeof(outparams), |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
676 "FL %s %s", who, who); |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
677 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
678 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
679 if (!msn_servconn_send_command(session->notification_conn, |
6789
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
680 "ADD", outparams)) |
94b575afb77e
[gaim-migrate @ 7328]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
681 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
682 gaim_connection_error(gc, _("Write error")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
683 return; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
684 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
685 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
686 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
687 static void |
6702
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
688 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
|
689 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
690 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
691 char outparams[MSN_BUF_LEN]; |
6702
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
692 MsnGroup *group; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
693 |
6702
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
694 group = msn_groups_find_with_name(session->groups, group_name); |
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
695 |
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
696 if (group == NULL) |
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
697 g_snprintf(outparams, sizeof(outparams), "FL %s", who); |
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
698 else |
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
699 g_snprintf(outparams, sizeof(outparams), "FL %s %d", who, |
302ee2792e91
[gaim-migrate @ 7228]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
700 msn_group_get_id(group)); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
701 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
702 if (!msn_servconn_send_command(session->notification_conn, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
703 "REM", outparams)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
704 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
705 gaim_connection_error(gc, _("Write error")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
706 return; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
707 } |
2086 | 708 } |
709 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
710 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
711 msn_add_permit(GaimConnection *gc, const char *who) |
2086 | 712 { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
713 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
714 char buf[MSN_BUF_LEN]; |
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 if (!strchr(who, '@')) { |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
717 g_snprintf(buf, sizeof(buf), |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
718 _("An MSN screenname must be in the form \"user@server.com\". " |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
719 "Perhaps you meant %s@hotmail.com. No changes were made " |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
720 "to your allow list."), who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
721 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5382
diff
changeset
|
722 gaim_notify_error(gc, NULL, _("Invalid MSN screenname"), buf); |
6378
01289157fc37
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
723 gaim_privacy_permit_remove(gc->account, who, TRUE); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
724 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
725 return; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
726 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
727 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
728 if (g_slist_find_custom(gc->account->deny, who, (GCompareFunc)strcmp)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
729 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
|
730 gaim_privacy_deny_remove(gc->account, who, TRUE); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
731 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
732 g_snprintf(buf, sizeof(buf), "BL %s", who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
733 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
734 if (!msn_servconn_send_command(session->notification_conn, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
735 "REM", buf)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
736 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
737 gaim_connection_error(gc, _("Write error")); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
738 return; |
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 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
741 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
742 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who); |
2086 | 743 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
744 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
745 gaim_connection_error(gc, _("Write error")); |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
746 return; |
5309
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 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
749 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
750 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
751 msn_add_deny(GaimConnection *gc, const char *who) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
752 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
753 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
754 char buf[MSN_BUF_LEN]; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
755 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
756 if (!strchr(who, '@')) { |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
757 g_snprintf(buf, sizeof(buf), |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
758 _("An MSN screenname must be in the form \"user@server.com\". " |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
759 "Perhaps you meant %s@hotmail.com. No changes were made " |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
760 "to your block list."), who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
761 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5382
diff
changeset
|
762 gaim_notify_error(gc, NULL, _("Invalid MSN screenname"), buf); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
763 |
6378
01289157fc37
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
764 gaim_privacy_deny_remove(gc->account, who, TRUE); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
765 |
2086 | 766 return; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
767 } |
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 (g_slist_find_custom(gc->account->permit, who, (GCompareFunc)strcmp)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
770 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
|
771 gaim_privacy_permit_remove(gc->account, who, TRUE); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
772 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
773 g_snprintf(buf, sizeof(buf), "AL %s", who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
774 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
775 if (!msn_servconn_send_command(session->notification_conn, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
776 "REM", buf)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
777 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
778 gaim_connection_error(gc, _("Write error")); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
779 return; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
780 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
781 } |
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 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
784 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
785 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
786 gaim_connection_error(gc, _("Write error")); |
2086 | 787 return; |
788 } | |
789 } | |
790 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
791 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
792 msn_rem_permit(GaimConnection *gc, const char *who) |
2086 | 793 { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
794 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
795 char buf[MSN_BUF_LEN]; |
2086 | 796 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
797 g_snprintf(buf, sizeof(buf), "AL %s", who); |
4150 | 798 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
799 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
800 gaim_connection_error(gc, _("Write error")); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
801 return; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
802 } |
2086 | 803 |
6378
01289157fc37
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
804 gaim_privacy_deny_add(gc->account, who, TRUE); |
2600
8aade06646b5
[gaim-migrate @ 2613]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
805 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
806 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); |
2952 | 807 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
808 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
809 gaim_connection_error(gc, _("Write error")); |
2086 | 810 return; |
811 } | |
812 } | |
813 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
814 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
815 msn_rem_deny(GaimConnection *gc, const char *who) |
2086 | 816 { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
817 MsnSession *session = gc->proto_data; |
2086 | 818 char buf[MSN_BUF_LEN]; |
819 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
820 g_snprintf(buf, sizeof(buf), "BL %s", who); |
2086 | 821 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
822 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
823 gaim_connection_error(gc, _("Write error")); |
2213
a226ebf4be47
[gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2210
diff
changeset
|
824 return; |
a226ebf4be47
[gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2210
diff
changeset
|
825 } |
a226ebf4be47
[gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2210
diff
changeset
|
826 |
6378
01289157fc37
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
827 gaim_privacy_permit_add(gc->account, who, TRUE); |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
828 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
829 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
830 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
831 msn_set_permit_deny(GaimConnection *gc) |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
832 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
833 GaimAccount *account = gaim_connection_get_account(gc); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
834 MsnSession *session = gc->proto_data; |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
835 char buf[MSN_BUF_LEN]; |
2665
b0478af51be0
[gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2611
diff
changeset
|
836 GSList *s, *t = NULL; |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
837 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
838 if (account->perm_deny == PERMIT_ALL || |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
839 account->perm_deny == DENY_SOME) { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
840 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
841 strcpy(buf, "AL"); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
842 } |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
843 else |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
844 strcpy(buf, "BL"); |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
845 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
846 if (!msn_servconn_send_command(session->notification_conn, "BLP", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
847 gaim_connection_error(gc, _("Write error")); |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
848 return; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
849 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
850 |
5309
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 * 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
|
853 * 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
|
854 * 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
|
855 * there's no sense in going through them all. |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
856 */ |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
857 if (g_slist_length(gc->account->permit) == |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
858 g_slist_length(session->lists.allow)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
859 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
860 g_slist_free(session->lists.allow); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
861 session->lists.allow = NULL; |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
862 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
863 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
864 if (g_slist_length(gc->account->deny) == |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
865 g_slist_length(session->lists.block)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
866 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
867 g_slist_free(session->lists.block); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
868 session->lists.block = NULL; |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
869 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
870 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
871 if (session->lists.allow == NULL && session->lists.block == NULL) |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
872 return; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
873 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
874 if (session->lists.allow != NULL) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
875 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
876 for (s = g_slist_nth(gc->account->permit, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
877 g_slist_length(session->lists.allow)); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
878 s != NULL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
879 s = s->next) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
880 |
3200 | 881 char *who = s->data; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
882 |
3200 | 883 if (!strchr(who, '@')) { |
884 t = g_slist_append(t, who); | |
885 continue; | |
886 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
887 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
888 if (g_slist_find(session->lists.block, who)) { |
3294 | 889 t = g_slist_append(t, who); |
890 continue; | |
891 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
892 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
893 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
894 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
895 if (!msn_servconn_send_command(session->notification_conn, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
896 "ADD", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
897 gaim_connection_error(gc, _("Write error")); |
3200 | 898 return; |
899 } | |
2665
b0478af51be0
[gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2611
diff
changeset
|
900 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
901 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
902 for (; t != NULL; t = t->next) |
6378
01289157fc37
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
903 gaim_privacy_permit_remove(gc->account, t->data, TRUE); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
904 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
905 if (t != NULL) |
3200 | 906 g_slist_free(t); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
907 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
908 t = NULL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
909 g_slist_free(session->lists.allow); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
910 session->lists.allow = NULL; |
3200 | 911 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
912 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
913 if (session->lists.block) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
914 for (s = g_slist_nth(gc->account->deny, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
915 g_slist_length(session->lists.block)); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
916 s != NULL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
917 s = s->next) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
918 |
3200 | 919 char *who = s->data; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
920 |
3200 | 921 if (!strchr(who, '@')) { |
922 t = g_slist_append(t, who); | |
923 continue; | |
924 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
925 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
926 if (g_slist_find(session->lists.block, who)) { |
3294 | 927 t = g_slist_append(t, who); |
928 continue; | |
929 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
930 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
931 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); |
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 (!msn_servconn_send_command(session->notification_conn, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
934 "ADD", buf)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
935 gaim_connection_error(gc, _("Write error")); |
3200 | 936 return; |
937 } | |
2665
b0478af51be0
[gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2611
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 for (; t != NULL; t = t->next) |
6378
01289157fc37
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
941 gaim_privacy_deny_remove(gc->account, t->data, TRUE); |
5309
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 if (t != NULL) |
3200 | 944 g_slist_free(t); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
945 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
946 g_slist_free(session->lists.block); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
947 session->lists.block = NULL; |
3200 | 948 } |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
949 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
950 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
951 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
952 msn_chat_invite(GaimConnection *gc, int id, const char *msg, |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
953 const char *who) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
954 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
955 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
956 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
957 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
958 if (swboard == NULL) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
959 return; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
960 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
961 if (!msn_switchboard_send_command(swboard, "CAL", who)) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
962 msn_switchboard_destroy(swboard); |
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 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
965 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
966 msn_chat_leave(GaimConnection *gc, int id) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
967 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
968 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
969 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
970 char buf[6]; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
971 |
6149
6f4979d8cc3c
[gaim-migrate @ 6623]
Christian Hammond <chipx86@chipx86.com>
parents:
6148
diff
changeset
|
972 if (swboard == NULL) { |
6f4979d8cc3c
[gaim-migrate @ 6623]
Christian Hammond <chipx86@chipx86.com>
parents:
6148
diff
changeset
|
973 serv_got_chat_left(gc, id); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
974 return; |
6149
6f4979d8cc3c
[gaim-migrate @ 6623]
Christian Hammond <chipx86@chipx86.com>
parents:
6148
diff
changeset
|
975 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
976 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
977 strcpy(buf, "OUT\r\n"); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
978 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
979 if (!msn_servconn_write(swboard->servconn, buf, strlen(buf))) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
980 msn_switchboard_destroy(swboard); |
6023
f8edfcb55a34
[gaim-migrate @ 6473]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
981 |
6024
a23a1d51f573
[gaim-migrate @ 6474]
Christian Hammond <chipx86@chipx86.com>
parents:
6023
diff
changeset
|
982 serv_got_chat_left(gc, id); |
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 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
985 static int |
6059 | 986 msn_chat_send(GaimConnection *gc, int id, const char *message) |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
987 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
988 GaimAccount *account = gaim_connection_get_account(gc); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
989 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
990 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
991 MsnMessage *msg; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
992 char *send; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
993 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
994 if (swboard == NULL) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
995 return -EINVAL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
996 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
997 send = add_cr(message); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
998 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
999 msg = msn_message_new(); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1000 msn_message_set_attr(msg, "X-MMS-IM-Format", "FN=Arial; EF=; CO=0; PF=0"); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1001 msn_message_set_body(msg, send); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1002 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1003 g_free(send); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1004 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1005 if (!msn_switchboard_send_msg(swboard, msg)) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1006 msn_switchboard_destroy(swboard); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1007 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1008 msn_message_destroy(msg); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1009 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1010 return 0; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1011 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1012 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1013 msn_message_destroy(msg); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1014 |
6059 | 1015 serv_got_chat_in(gc, id, gaim_account_get_username(account), |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1016 0, message, time(NULL)); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1017 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1018 return 0; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1019 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1020 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1021 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1022 msn_keepalive(GaimConnection *gc) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1023 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1024 MsnSession *session = gc->proto_data; |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1025 char buf[MSN_BUF_LEN]; |
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 g_snprintf(buf, sizeof(buf), "PNG\r\n"); |
2665
b0478af51be0
[gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2611
diff
changeset
|
1028 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1029 if (msn_servconn_write(session->notification_conn, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1030 buf, strlen(buf)) < 0) { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1031 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1032 gaim_connection_error(gc, _("Write error")); |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1033 return; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1034 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1035 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1036 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1037 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1038 msn_group_buddy(GaimConnection *gc, const char *who, |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1039 const char *old_group_name, const char *new_group_name) |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1040 { |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1041 MsnSession *session = gc->proto_data; |
6786
8efafdc38718
[gaim-migrate @ 7325]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
1042 MsnGroup *old_group, *new_group; |
6772
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6739
diff
changeset
|
1043 MsnUser *user; |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1044 char outparams[MSN_BUF_LEN]; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1045 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1046 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
|
1047 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
|
1048 |
6772
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6739
diff
changeset
|
1049 user = msn_users_find_with_passport(session->users, who); |
e719379c8a79
[gaim-migrate @ 7309]
Christian Hammond <chipx86@chipx86.com>
parents:
6739
diff
changeset
|
1050 |
6786
8efafdc38718
[gaim-migrate @ 7325]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
1051 if (old_group != NULL) |
8efafdc38718
[gaim-migrate @ 7325]
Christian Hammond <chipx86@chipx86.com>
parents:
6772
diff
changeset
|
1052 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
|
1053 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1054 if (new_group == NULL) { |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1055 g_snprintf(outparams, sizeof(outparams), "%s 0", |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1056 msn_url_encode(new_group_name)); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1057 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1058 if (!msn_servconn_send_command(session->notification_conn, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1059 "ADG", outparams)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1060 gaim_connection_error(gc, _("Write error")); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1061 return; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1062 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1063 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1064 /* I hate this. So much. */ |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1065 session->moving_buddy = TRUE; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1066 session->dest_group_name = g_strdup(new_group_name); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1067 session->old_group = old_group; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1068 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1069 session->moving_user = |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1070 msn_users_find_with_passport(session->users, who); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1071 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1072 msn_user_ref(session->moving_user); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1073 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1074 else { |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1075 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1076 who, who, msn_group_get_id(new_group)); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1077 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1078 if (!msn_servconn_send_command(session->notification_conn, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1079 "ADD", outparams)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1080 gaim_connection_error(gc, _("Write error")); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1081 return; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1082 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1083 } |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1084 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1085 if (old_group != NULL) { |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1086 g_snprintf(outparams, sizeof(outparams), "FL %s %d", |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1087 who, msn_group_get_id(old_group)); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1088 |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1089 if (!msn_servconn_send_command(session->notification_conn, |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1090 "REM", outparams)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1091 gaim_connection_error(gc, _("Write error")); |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1092 return; |
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1093 } |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1094 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1095 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
|
1096 g_snprintf(outparams, sizeof(outparams), "%d", |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1097 msn_group_get_id(old_group)); |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1098 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1099 if (!msn_servconn_send_command(session->notification_conn, |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1100 "RMG", outparams)) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1101 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1102 gaim_connection_error(gc, _("Write error")); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1103 return; |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1104 } |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1105 } |
5322
a4d017bee1de
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
1106 } |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1107 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1108 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1109 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1110 msn_rename_group(GaimConnection *gc, const char *old_group_name, |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1111 const char *new_group_name, GList *members) |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1112 { |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1113 MsnSession *session = gc->proto_data; |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1114 char outparams[MSN_BUF_LEN]; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1115 MsnGroup *old_group; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1116 |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1117 if ((old_group = msn_groups_find_with_name(session->groups, |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1118 old_group_name)) != NULL) { |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1119 |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1120 g_snprintf(outparams, sizeof(outparams), "%d %s 0", |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1121 msn_group_get_id(old_group), |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1122 msn_url_encode(new_group_name)); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1123 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1124 if (!msn_servconn_send_command(session->notification_conn, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1125 "REG", outparams)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1126 gaim_connection_error(gc, _("Write error")); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1127 return; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1128 } |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1129 |
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1130 msn_group_set_name(old_group, new_group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1131 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1132 else { |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1133 g_snprintf(outparams, sizeof(outparams), "%s 0", |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1134 msn_url_encode(new_group_name)); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1135 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1136 if (!msn_servconn_send_command(session->notification_conn, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1137 "ADG", outparams)) { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1138 gaim_connection_error(gc, _("Write error")); |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1139 return; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1140 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1141 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1142 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1143 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1144 static void |
6695 | 1145 msn_buddy_free(GaimBuddy *b) |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1146 { |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1147 if (b->proto_data != NULL) { |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1148 msn_user_destroy(b->proto_data); |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1149 b->proto_data = NULL; |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
1150 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1151 } |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1152 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1153 static void |
6059 | 1154 msn_convo_closed(GaimConnection *gc, const char *who) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1155 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1156 GaimAccount *account = gaim_connection_get_account(gc); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1157 MsnSession *session = gc->proto_data; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1158 MsnSwitchBoard *swboard; |
6026
01dd6b652c22
[gaim-migrate @ 6476]
Christian Hammond <chipx86@chipx86.com>
parents:
6024
diff
changeset
|
1159 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1160 swboard = msn_session_find_switch_with_passport(session, who); |
4349 | 1161 |
6026
01dd6b652c22
[gaim-migrate @ 6476]
Christian Hammond <chipx86@chipx86.com>
parents:
6024
diff
changeset
|
1162 if (swboard != NULL && swboard->chat == NULL) { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1163 char sendbuf[256]; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1164 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1165 g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n", |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1166 gaim_account_get_username(account)); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1167 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1168 msn_servconn_write(swboard->servconn, sendbuf, strlen(sendbuf)); |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1169 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1170 msn_switchboard_destroy(swboard); |
3294 | 1171 } |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1172 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1173 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1174 static char * |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1175 msn_normalize(const char *str) |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1176 { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1177 static char buf[BUF_LEN]; |
3294 | 1178 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1179 g_return_val_if_fail(str != NULL, NULL); |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1180 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1181 g_snprintf(buf, sizeof(buf), "%s%s", str, |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1182 (strchr(str, '@') ? "" : "@hotmail.com")); |
4349 | 1183 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1184 return buf; |
2607
e0d4a23aac89
[gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2603
diff
changeset
|
1185 } |
e0d4a23aac89
[gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2603
diff
changeset
|
1186 |
6516 | 1187 static void |
1188 msn_got_info(gpointer data, char *url_text, unsigned long len) | |
1189 { | |
1190 char *stripped,*p,*q; | |
1191 char buf[1024]; | |
1192 char *user_url = NULL; | |
1193 | |
1194 if (!url_text || !strcmp(url_text,"")) { | |
1195 g_show_info_text(NULL, NULL, 2, | |
6573 | 1196 _("<html><body><b>Error retrieving profile</b></body></html>"), NULL); |
6516 | 1197 return; |
1198 } | |
1199 | |
1200 /* if they have a homepage link, MSN masks it such that we need to | |
1201 * fetch the url out before strip_html() nukes it */ | |
1202 if((p = strstr(url_text, "Take a look at my </font><A class=viewDesc title=\"")) != NULL ) | |
1203 { | |
1204 p += 50; | |
1205 if((q = strchr(p, '"')) != NULL) | |
1206 user_url = g_strndup(p,q-p); | |
1207 } | |
1208 | |
1209 /* strip_html() doesn't strip out character entities like and · */ | |
1210 while ((p = strstr(url_text, " ")) != NULL) { | |
1211 memmove(p, p+6, strlen(p+6)); | |
1212 url_text[strlen(url_text)-6] = '\0'; | |
1213 } | |
1214 while ((p = strstr(url_text, "·")) != NULL) { | |
1215 memmove(p, p+6, strlen(p+6)); | |
1216 url_text[strlen(url_text)-6] = '\0'; | |
1217 } | |
1218 | |
1219 /* nuke the nasty \r's that just get in the way */ | |
1220 while ((p = strchr(url_text, '\r')) != NULL) { | |
1221 memmove(p, p+1, strlen(p+1)); | |
1222 url_text[strlen(url_text)-1] = '\0'; | |
1223 } | |
1224 | |
1225 /* MSN always puts in ' for apostrophies...replace them */ | |
1226 while ((p = strstr(url_text, "'")) != NULL) { | |
1227 *p = '\''; | |
1228 memmove(p+1, p+5, strlen(p+5)); | |
1229 url_text[strlen(url_text)-4] = '\0'; | |
1230 } | |
1231 | |
1232 /* nuke the html, it's easier than trying to parse the horrid stuff */ | |
1233 stripped = strip_html(url_text); | |
1234 | |
1235 /* gonna re-use the memory we've already got for url_text */ | |
1236 strcpy(url_text, "<html><body>\n"); | |
1237 | |
1238 /* extract their Name and put it in */ | |
1239 info_extract_field(stripped, url_text, "\tName", 0, "\t", '\n', | |
6657 | 1240 "Undisclosed", _("Name"), 0, NULL); |
6516 | 1241 |
1242 /* extract their Age and put it in */ | |
1243 info_extract_field(stripped, url_text, "\tAge", 0, "\t", '\n', | |
6657 | 1244 "Undisclosed", _("Age"), 0, NULL); |
6516 | 1245 |
1246 /* extract their Gender and put it in */ | |
1247 info_extract_field(stripped, url_text, "\tGender", 6, "\t", '\n', | |
6657 | 1248 "Undisclosed", _("Gender"), 0, NULL); |
6516 | 1249 |
1250 /* extract their MaritalStatus and put it in */ | |
1251 info_extract_field(stripped, url_text, "\tMaritalStatus", 0, "\t", '\n', | |
6657 | 1252 "Undisclosed", _("Marital Status"), 0, NULL); |
6516 | 1253 |
1254 /* extract their Location and put it in */ | |
1255 info_extract_field(stripped, url_text, "\tLocation", 0, "\t", '\n', | |
6657 | 1256 "Undisclosed", _("Location"), 0, NULL); |
6516 | 1257 |
1258 /* extract their Occupation and put it in */ | |
1259 info_extract_field(stripped, url_text, "\t Occupation", 6, "\t", '\n', | |
6657 | 1260 "Undisclosed", _("Occupation"), 0, NULL); |
6516 | 1261 |
1262 /* the fields, 'A Little About Me', 'Favorite Things', 'Hobbies and Interests', | |
1263 * 'Favorite Quote', and 'My Homepage' may or may not appear, in any combination. | |
1264 * however, they do appear in certain order, so we can successively search to | |
1265 * pin down the distinct values. | |
1266 */ | |
1267 | |
1268 /* check if they have A Little About Me */ | |
1269 if(!info_extract_field(stripped, url_text, "\tA Little About Me", 1, "Favorite Things", '\n', | |
6573 | 1270 NULL, _("A Little About Me"), 0, NULL)) |
6516 | 1271 if(!info_extract_field(stripped, url_text, "\tA Little About Me", 1, "Hobbies and Interests", '\n', |
6573 | 1272 NULL, _("A Little About Me"), 0, NULL)) |
6516 | 1273 if(!info_extract_field(stripped, url_text, "\tA Little About Me", 1, "Favorite Quote", '\n', |
6573 | 1274 NULL, _("A Little About Me"), 0, NULL)) |
6516 | 1275 if(!info_extract_field(stripped, url_text, "\tA Little About Me", 1, "My Homepage\tTake a look", '\n', |
6573 | 1276 NULL, _("A Little About Me"), 0, NULL)) |
6516 | 1277 info_extract_field(stripped, url_text, "\tA Little About Me", 1, "last updated", '\n', |
6573 | 1278 NULL, _("A Little About Me"), 0, NULL); |
6516 | 1279 |
1280 /* check if they have Favorite Things */ | |
1281 if(!info_extract_field(stripped, url_text, "Favorite Things", 1, "Hobbies and Interests", '\n', | |
6573 | 1282 NULL, _("Favorite Things"), 0, NULL)) |
6516 | 1283 if(!info_extract_field(stripped, url_text, "Favorite Things", 1, "Favorite Quote", '\n', |
1284 NULL, "Favorite Things", 0, NULL)) | |
1285 if(info_extract_field(stripped, url_text, "Favorite Things", 1, "My Homepage\tTake a look", '\n', | |
6573 | 1286 NULL, _("Favorite Things"), 0, NULL)) |
6516 | 1287 info_extract_field(stripped, url_text, "Favorite Things", 1, "last updated", '\n', |
6573 | 1288 NULL, _("Favorite Things"), 0, NULL); |
6516 | 1289 |
1290 /* check if they have Hobbies and Interests */ | |
1291 if(!info_extract_field(stripped, url_text, "Hobbies and Interests", 1, "Favorite Quote", '\n', | |
6573 | 1292 NULL, _("Hobbies and Interests"), 0, NULL)) |
6516 | 1293 if(info_extract_field(stripped, url_text, "Hobbies and Interests", 1, "My Homepage\tTake a look", '\n', |
6573 | 1294 NULL, _("Hobbies and Interests"), 0, NULL)) |
6516 | 1295 info_extract_field(stripped, url_text, "Hobbies and Interests", 1, "last updated", '\n', |
6573 | 1296 NULL, _("Hobbies and Interests"), 0, NULL); |
6516 | 1297 |
1298 /* check if they have Favorite Quote */ | |
1299 if(!info_extract_field(stripped, url_text, "Favorite Quote", 1, "My Homepage\tTake a look", '\n', | |
6573 | 1300 NULL, _("Favorite Quote"), 0, NULL)) |
6516 | 1301 info_extract_field(stripped, url_text, "Favorite Quote", 1, "last updated", '\n', |
6573 | 1302 NULL, _("Favorite Quote"), 0, NULL); |
6516 | 1303 |
1304 /* extract the last updated date and put it in */ | |
1305 info_extract_field(stripped, url_text, "\tlast updated:", 1, "\n", '\n', | |
6573 | 1306 NULL, _("Last Updated"), 0, NULL); |
6516 | 1307 |
1308 /* if we were able to fetch a homepage url earlier, stick it in there */ | |
1309 if(user_url) | |
1310 { | |
6623 | 1311 g_snprintf(buf,sizeof(buf),"<b>%s:</b><br><a href=\"%s\">%s</a><br>\n",_("Homepage"),user_url,user_url); |
6516 | 1312 strcat(url_text,buf); |
1313 } | |
1314 | |
1315 /* finish it off, and show it to them */ | |
1316 strcat(url_text, "</body></html>\n"); | |
1317 g_show_info_text(NULL, NULL, 2, url_text, NULL); | |
1318 g_free(stripped); | |
1319 } | |
1320 | |
1321 static void | |
1322 msn_get_info(GaimConnection *gc, const char *name) | |
1323 { | |
1324 char url[256]; | |
1325 g_snprintf(url, sizeof url, "%s%s", PROFILE_URL, name); | |
1326 grab_url(url, FALSE, msn_got_info, NULL,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",1); | |
1327 } | |
1328 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1329 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1330 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1331 GAIM_PROTO_MSN, |
5351
2aa7e4237142
[gaim-migrate @ 5727]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
1332 OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1333 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1334 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1335 msn_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1336 msn_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1337 msn_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1338 msn_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1339 msn_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1340 msn_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1341 msn_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1342 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1343 msn_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1344 msn_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1345 msn_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1346 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1347 msn_send_typing, |
6516 | 1348 msn_get_info, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1349 msn_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1350 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1351 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1352 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1353 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1354 msn_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1355 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1356 msn_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1357 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1358 msn_rem_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1359 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1360 msn_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1361 msn_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1362 msn_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1363 msn_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1364 msn_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1365 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1366 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1367 msn_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1368 msn_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1369 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1370 msn_chat_send, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1371 msn_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1372 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1373 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1374 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1375 NULL, |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1376 msn_group_buddy, |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1377 msn_rename_group, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1378 msn_buddy_free, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1379 msn_convo_closed, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1380 msn_normalize |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1381 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1382 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1383 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1384 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1385 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1386 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1387 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1388 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1389 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1390 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1391 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1392 "prpl-msn", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1393 "MSN", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1394 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1395 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1396 N_("MSN Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1397 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1398 N_("MSN Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1399 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6228
diff
changeset
|
1400 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1401 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1402 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1403 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1404 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1405 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1406 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1407 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1408 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1409 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1410 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
1411 init_plugin(GaimPlugin *plugin) |
2086 | 1412 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1413 GaimAccountOption *option; |
3572 | 1414 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
1415 option = gaim_account_option_string_new(_("Login server"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1416 MSN_SERVER); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1417 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1418 option); |
3572 | 1419 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1420 option = gaim_account_option_int_new(_("Port"), "port", 1863); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1421 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1422 option); |
2086 | 1423 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1424 my_protocol = plugin; |
5626
6275ac113622
[gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1425 |
6275ac113622
[gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1426 gaim_prefs_add_none("/plugins/prpl/msn"); |
6275ac113622
[gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1427 gaim_prefs_add_bool("/plugins/prpl/msn/conv_close_notice", TRUE); |
6275ac113622
[gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1428 gaim_prefs_add_bool("/plugins/prpl/msn/conv_timeout_notice", TRUE); |
2086 | 1429 } |
1430 | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
1431 GAIM_INIT_PLUGIN(msn, init_plugin, info); |