annotate src/protocols/msn/msn.c @ 5369:a87818e9dc54

[gaim-migrate @ 5745] Pages can now be sent to MSN users that have MSN Mobile setup with a device capable of pages. Right-click and choose "Send to Mobile." Some of the stuff isn't complete. I'm working on it. Also, the interface sucks, but will have to be that way until I do the do_*_dialog() core/ui split. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 14 May 2003 05:53:05 +0000
parents 379beab3d157
children fa0217bec87e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
1 /**
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
2 * @file msn.c The MSN protocol plugin
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
3 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
4 * gaim
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
5 *
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
7 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
8 * This program is free software; you can redistribute it and/or modify
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
9 * it under the terms of the GNU General Public License as published by
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
11 * (at your option) any later version.
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
12 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
13 * This program is distributed in the hope that it will be useful,
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
16 * GNU General Public License for more details.
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
17 *
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
18 * You should have received a copy of the GNU General Public License
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
19 * along with this program; if not, write to the Free Software
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
21 */
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
22 #include "msn.h"
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
23 #include "msg.h"
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
24 #include "page.h"
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
25 #include "session.h"
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
26 #include "state.h"
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
27 #include "utils.h"
4546
a951bb590857 [gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4542
diff changeset
28
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
29 #define BUDDY_ALIAS_MAXLEN 388
4542
86b0a0243be8 [gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents: 4508
diff changeset
30
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
31 static GaimPlugin *my_protocol = NULL;
4249
9c7fcb211886 [gaim-migrate @ 4499]
Mark Doliner <mark@kingant.net>
parents: 4245
diff changeset
32
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
33 /* for win32 compatability */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
34 G_MODULE_IMPORT GSList *connections;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3592
diff changeset
35
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
36 static char *msn_normalize(const char *str);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
38 typedef struct
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
39 {
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
40 struct gaim_connection *gc;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
41 const char *passport;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
42
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
43 } MsnMobileData;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
44
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
45 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
46 msn_act_id(gpointer data, char *entry)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
47 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
48 struct gaim_connection *gc = data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
49 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
50 char outparams[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
51 char *alias;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
53 if (entry == NULL || *entry == '\0')
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
54 alias = g_strdup("");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
55 else
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
56 alias = g_strdup(entry);
3171
d71c23e4d1c2 [gaim-migrate @ 3187]
Rob Flynn <gaim@robflynn.com>
parents: 3170
diff changeset
57
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
58 if (strlen(alias) >= BUDDY_ALIAS_MAXLEN) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
59 do_error_dialog(_("Your new MSN friendly name is too long."),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
60 NULL, GAIM_ERROR);
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
61 return;
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
62 }
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
63
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
64 g_snprintf(outparams, sizeof(outparams), "%s %s",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
65 gc->username, msn_url_encode(alias));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
67 g_free(alias);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
69 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
70 "REA", outparams)) {
2738
01f0497fe6c8 [gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2688
diff changeset
71
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
72 hide_login_progress(gc, _("Write error"));
2688
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
73 signoff(gc);
98b1ac8ddea3 [gaim-migrate @ 2701]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
74 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
77 static void
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
78 msn_set_prp(gpointer data, const char *type, const char *entry)
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
79 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
80 struct gaim_connection *gc = data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
81 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
82 char outparams[MSN_BUF_LEN];
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 if (entry == NULL || *entry == '\0')
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
85 g_snprintf(outparams, sizeof(outparams), "%s ", type);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
86 else
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
87 g_snprintf(outparams, sizeof(outparams), "%s %s", type, entry);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
88
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
89 if (!msn_servconn_send_command(session->notification_conn,
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
90 "PRP", outparams)) {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
91
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
92 hide_login_progress(gc, _("Write error"));
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
93 signoff(gc);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
94 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
95 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
96
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
97 static void
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
98 msn_set_home_phone_cb(gpointer data, char *entry)
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
99 {
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
100 msn_set_prp(data, "PHH", entry);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
101 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
102
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
103 static void
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
104 msn_set_work_phone_cb(gpointer data, char *entry)
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
105 {
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
106 msn_set_prp(data, "PHW", entry);
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
107 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
108
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
109 static void
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
110 msn_set_mobile_phone_cb(gpointer data, char *entry)
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
111 {
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
112 msn_set_prp(data, "PHM", entry);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
113 }
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
114
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
115 static void
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
116 __enable_msn_pages_cb(struct gaim_connection *gc)
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 msn_set_prp(gc, "MOB", "Y");
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
119 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
120
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
121 static void
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
122 __disable_msn_pages_cb(struct gaim_connection *gc)
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
123 {
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
124 msn_set_prp(gc, "MOB", "N");
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
125 }
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
126
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
127 static void
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
128 __send_to_mobile_cb(MsnMobileData *data, const char *entry)
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
129 {
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
130 MsnSession *session = data->gc->proto_data;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
131 MsnServConn *servconn = session->notification_conn;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
132 MsnUser *user;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
133 MsnPage *page;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
134 char *page_str;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
135
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
136 user = msn_user_new(session, data->passport, NULL);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
137
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
138 page = msn_page_new();
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
139 msn_page_set_receiver(page, user);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
140 msn_page_set_transaction_id(page, ++session->trId);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
141 msn_page_set_body(page, entry);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
142
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
143 page_str = msn_page_build_string(page);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
144
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
145 msn_user_destroy(user);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
146 msn_page_destroy(page);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
147
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
148 if (!msn_servconn_write(servconn, page_str, strlen(page_str))) {
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
149
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
150 hide_login_progress(data->gc, _("Write error"));
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
151 signoff(data->gc);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
152 }
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
153
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
154 g_free(page_str);
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
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
157 /* -- */
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
158
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
159 static void
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
160 msn_show_set_friendly_name(struct gaim_connection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
162 do_prompt_dialog(_("Set Friendly Name:"), gc->displayname,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
163 gc, msn_act_id, NULL);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
166 static void
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
167 msn_show_set_home_phone(struct gaim_connection *gc)
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
168 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
169 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
170
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
171 do_prompt_dialog(_("Set Home Phone Number:"),
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
172 msn_user_get_home_phone(session->user),
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
173 gc, msn_set_home_phone_cb, NULL);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
174 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
175
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
176 static void
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
177 msn_show_set_work_phone(struct gaim_connection *gc)
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
178 {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
179 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
180
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
181 do_prompt_dialog(_("Set Work Phone Number:"),
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
182 msn_user_get_work_phone(session->user),
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
183 gc, msn_set_work_phone_cb, NULL);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
184 }
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
185
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
186 static void
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
187 msn_show_set_mobile_phone(struct gaim_connection *gc)
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 MsnSession *session = gc->proto_data;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
190
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
191 do_prompt_dialog(_("Set Mobile Phone Number:"),
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
192 msn_user_get_mobile_phone(session->user),
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
193 gc, msn_set_mobile_phone_cb, NULL);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
194 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
195
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
196 #if 0
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
197 static void
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
198 msn_show_set_mobile_support(struct gaim_connection *gc)
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
199 {
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
200 MsnSession *session = gc->proto_data;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
201
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
202 do_ask_dialog(_("MSN Mobile Support"),
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
203 _("Do you want to enable or disable MSN Mobile "
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
204 "device support?"),
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
205 gc,
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
206 _("Enable"), __enable_msn_mobile_cb,
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
207 _("Disable"), __disable_msn_mobile_cb,
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
208 session->prpl->handle, FALSE);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
209 }
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
210 #endif
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
211
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
212 static void
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
213 msn_show_set_mobile_pages(struct gaim_connection *gc)
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
214 {
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
215 MsnSession *session = gc->proto_data;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
216
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
217 do_ask_dialog(_("MSN Mobile Pages"),
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
218 _("Do you want to allow or disallow people on your buddy "
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
219 "list to send you mobile pages?"),
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
220 gc,
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
221 _("Allow"), __enable_msn_pages_cb,
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
222 _("Disallow"), __disable_msn_pages_cb,
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
223 session->prpl->handle, FALSE);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
224 }
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
225
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
226 static void
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
227 __show_send_to_mobile_cb(struct gaim_connection *gc, const char *passport)
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
228 {
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
229 MsnUser *user;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
230 MsnSession *session = gc->proto_data;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
231 MsnMobileData *data;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
232
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
233 user = msn_users_find_with_passport(session->users, passport);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
234
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
235 data = g_new0(MsnMobileData, 1);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
236 data->gc = gc;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
237 data->passport = passport;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
238
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
239 do_prompt_dialog(_("Send message:"), NULL,
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
240 data, __send_to_mobile_cb, g_free);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
241 }
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
242
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
243
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
244 /**************************************************************************
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
245 * Protocol Plugin ops
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
246 **************************************************************************/
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
247
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
248 static const char *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
249 msn_list_icon(struct gaim_account *a, struct buddy *b)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
250 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
251 return "msn";
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
252 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2970
diff changeset
253
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
254 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
255 msn_list_emblems(struct buddy *b, char **se, char **sw,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
256 char **nw, char **ne)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 {
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
258 char *emblems[4] = { NULL, NULL, NULL, NULL };
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
259 int away_type = MSN_AWAY_TYPE(b->uc);
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
260 int i = 0;
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
261
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
262 if (b->present == GAIM_BUDDY_OFFLINE)
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
263 emblems[i++] = "offline";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
264 else if (away_type == MSN_BUSY || away_type == MSN_PHONE)
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
265 emblems[i++] = "occupied";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
266 else if (away_type != 0)
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
267 emblems[i++] = "away";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
268
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
269 if (MSN_MOBILE(b->uc))
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
270 emblems[i++] = "wireless";
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
271
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
272 *se = emblems[0];
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
273 *sw = emblems[1];
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
274 *nw = emblems[2];
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
275 *ne = emblems[3];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
278 static char *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
279 msn_status_text(struct buddy *b)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
281 if (b->uc & UC_UNAVAILABLE)
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
282 return g_strdup(msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
284 return NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
287 static char *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
288 msn_tooltip_text(struct buddy *b)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 {
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
290 char *text = NULL;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
291 /* MsnUser *user = b->proto_data; */
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
292
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
293 if (GAIM_BUDDY_IS_ONLINE(b)) {
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
294 text = g_strdup_printf(_("<b>Status:</b> %s"),
5361
953aa05279f4 [gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents: 5351
diff changeset
295 msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
296 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
298 return text;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
301 static GList *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
302 msn_away_states(struct gaim_connection *gc)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 GList *m = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305
3263
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
306 m = g_list_append(m, _("Available"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
307 m = g_list_append(m, _("Away From Computer"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
308 m = g_list_append(m, _("Be Right Back"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
309 m = g_list_append(m, _("Busy"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
310 m = g_list_append(m, _("On The Phone"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
311 m = g_list_append(m, _("Out To Lunch"));
73fd73188485 [gaim-migrate @ 3281]
Rob Flynn <gaim@robflynn.com>
parents: 3231
diff changeset
312 m = g_list_append(m, _("Hidden"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 return m;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
317 static GList *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
318 msn_actions(struct gaim_connection *gc)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
319 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
320 GList *m = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
321 struct proto_actions_menu *pam;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
322
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
323 pam = g_new0(struct proto_actions_menu, 1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
324 pam->label = _("Set Friendly Name");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
325 pam->callback = msn_show_set_friendly_name;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
326 pam->gc = gc;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
327 m = g_list_append(m, pam);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
328
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
329 m = g_list_append(m, NULL);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
330
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
331 pam = g_new0(struct proto_actions_menu, 1);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
332 pam->label = _("Set Home Phone Number");
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
333 pam->callback = msn_show_set_home_phone;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
334 pam->gc = gc;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
335 m = g_list_append(m, pam);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
336
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
337 pam = g_new0(struct proto_actions_menu, 1);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
338 pam->label = _("Set Work Phone Number");
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
339 pam->callback = msn_show_set_work_phone;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
340 pam->gc = gc;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
341 m = g_list_append(m, pam);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
342
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
343 pam = g_new0(struct proto_actions_menu, 1);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
344 pam->label = _("Set Mobile Phone Number");
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
345 pam->callback = msn_show_set_mobile_phone;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
346 pam->gc = gc;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
347 m = g_list_append(m, pam);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
348
5364
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
349 m = g_list_append(m, NULL);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
350
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
351 #if 0
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
352 pam = g_new0(struct proto_actions_menu, 1);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
353 pam->label = _("Enable/Disable Mobile Devices");
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
354 pam->callback = msn_show_set_mobile_support;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
355 pam->gc = gc;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
356 m = g_list_append(m, pam);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
357 #endif
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
358
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
359 pam = g_new0(struct proto_actions_menu, 1);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
360 pam->label = _("Allow/Disallow Mobile Pages");
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
361 pam->callback = msn_show_set_mobile_pages;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
362 pam->gc = gc;
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
363 m = g_list_append(m, pam);
379beab3d157 [gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents: 5363
diff changeset
364
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
365 return m;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
366 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
367
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
368 static GList *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
369 msn_buddy_menu(struct gaim_connection *gc, const char *who)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
370 {
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
371 struct proto_buddy_menu *pbm;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
372 struct buddy *b;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
373 GList *m = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
374
5369
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
375 b = gaim_find_buddy(gc->account, who);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
376
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
377 if (MSN_MOBILE(b->uc)) {
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
378 pbm = g_new0(struct proto_buddy_menu, 1);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
379 pbm->label = _("Send to Mobile");
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
380 pbm->callback = __show_send_to_mobile_cb;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
381 pbm->gc = gc;
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
382 m = g_list_append(m, pbm);
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
383 }
a87818e9dc54 [gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents: 5364
diff changeset
384
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
385 return m;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
386 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
387
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
388 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
389 msn_login(struct gaim_account *account)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
390 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
391 struct gaim_connection *gc;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
392 MsnSession *session;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
393 const char *server;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
394 int port;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
395
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
396 server = (*account->proto_opt[USEROPT_MSNSERVER]
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
397 ? account->proto_opt[USEROPT_MSNSERVER]
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
398 : MSN_SERVER);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
399 port = (*account->proto_opt[USEROPT_MSNPORT]
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
400 ? atoi(account->proto_opt[USEROPT_MSNPORT])
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
401 : MSN_PORT);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
402
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
403
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
404 gc = new_gaim_conn(account);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
405
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
406 session = msn_session_new(account, server, port);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
407 session->prpl = my_protocol;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
408
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
409 gc->proto_data = session;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
410
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
411 set_login_progress(gc, 1, _("Connecting"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
412
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
413 g_snprintf(gc->username, sizeof(gc->username), "%s",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
414 msn_normalize(gc->username));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
415
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
416 if (!msn_session_connect(session)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
417 hide_login_progress(gc, _("Unable to connect"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
418 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
419 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
420 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
421
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
422 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
423 msn_close(struct gaim_connection *gc)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
424 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
425 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
426
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
427 msn_session_destroy(session);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
428
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
429 gc->proto_data = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
430 }
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 static int
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
433 msn_send_im(struct gaim_connection *gc, const char *who, const char *message,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
434 int len, int flags)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
436 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
437 MsnSwitchBoard *swboard;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
438
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
439 swboard = msn_session_find_switch_with_passport(session, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
440
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
441 if (g_ascii_strcasecmp(who, gc->username)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
442 MsnMessage *msg;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
443 MsnUser *user;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
444
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
445 user = msn_user_new(session, who, NULL);
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 msg = msn_message_new();
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
448 msn_message_set_receiver(msg, user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
449 msn_message_set_attr(msg, "X-MMS-IM-Format",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
450 "FN=Arial; EF=; CO=0; PF=0");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
451 msn_message_set_body(msg, message);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
452
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
453 if (swboard != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
454 if (!msn_switchboard_send_msg(swboard, msg))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
455 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
456 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
457 else {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
458 if ((swboard = msn_session_open_switchboard(session)) == NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
459 msn_message_destroy(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
460
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
461 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
462 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
463
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
464 return 1;
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 msn_switchboard_set_user(swboard, user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
468 msn_switchboard_send_msg(swboard, msg);
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
471 msn_user_destroy(user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
472 msn_message_destroy(msg);
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 else {
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 * In MSN, you can't send messages to yourself, so
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
477 * we'll fake like we received it ;)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
478 */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
479 serv_got_typing_stopped(gc, (char *)who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
480 serv_got_im(gc, who, message, flags | IM_FLAG_GAIMUSER,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
481 time(NULL), -1);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
482 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
483
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
484 return 1;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
485 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
486
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
487 static int
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
488 msn_send_typing(struct gaim_connection *gc, char *who, int typing)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
489 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
490 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
491 MsnSwitchBoard *swboard;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
492 MsnMessage *msg;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
493 MsnUser *user;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
494
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
495 if (!typing)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
496 return 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
497
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
498 if (!g_ascii_strcasecmp(who, gc->username)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
499 /* We'll just fake it, since we're sending to ourself. */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
500 serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, TYPING);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
501
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
502 return MSN_TYPING_SEND_TIMEOUT;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
503 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
504
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
505 swboard = msn_session_find_switch_with_passport(session, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
506
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
507 if (swboard == NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
508 return 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
509
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
510 user = msn_user_new(session, who, NULL);
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 msg = msn_message_new();
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
513 msn_message_set_content_type(msg, "text/x-msmsgscontrol");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
514 msn_message_set_receiver(msg, user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
515 msn_message_set_charset(msg, NULL);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
516 msn_message_set_attr(msg, "TypingUser", gc->username);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
517 msn_message_set_attr(msg, "User-Agent", NULL);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
518 msn_message_set_body(msg, "\r\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
519
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
520 if (!msn_switchboard_send_msg(swboard, msg))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
521 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
522
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
523 msn_user_destroy(user);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
524
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
525 return MSN_TYPING_SEND_TIMEOUT;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
526 }
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 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
529 msn_set_away(struct gaim_connection *gc, char *state, char *msg)
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 MsnSession *session = gc->proto_data;
4270
cc79431a11a7 [gaim-migrate @ 4521]
Luke Schierer <lschiere@pidgin.im>
parents: 4249
diff changeset
532 const char *away;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
534 if (gc->away != NULL) {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
535 g_free(gc->away);
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
536 gc->away = NULL;
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
537 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
539 if (msg != NULL) {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
540 gc->away = g_strdup("");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 away = "AWY";
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
542 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
543 else if (state) {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
544 gc->away = g_strdup("");
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
546 if (!strcmp(state, _("Away From Computer")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547 away = "AWY";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
548 else if (!strcmp(state, _("Be Right Back")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549 away = "BRB";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
550 else if (!strcmp(state, _("Busy")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551 away = "BSY";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
552 else if (!strcmp(state, _("On The Phone")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
553 away = "PHN";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
554 else if (!strcmp(state, _("Out To Lunch")))
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
555 away = "LUN";
3538
9431b31f8f62 [gaim-migrate @ 3612]
Luke Schierer <lschiere@pidgin.im>
parents: 3504
diff changeset
556 else if (!strcmp(state, _("Hidden")))
2152
f631cfc8e824 [gaim-migrate @ 2162]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2123
diff changeset
557 away = "HDN";
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 else {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4069
diff changeset
559 g_free(gc->away);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 gc->away = NULL;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 away = "NLN";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
563 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
564 else if (gc->is_idle)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565 away = "IDL";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566 else
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
567 away = "NLN";
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
569 if (!msn_servconn_send_command(session->notification_conn, "CHG", away)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
570 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
571 signoff(gc);
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 }
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 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
576 msn_set_idle(struct gaim_connection *gc, int idle)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
577 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
578 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
579
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
580 if (gc->away != NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
581 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
582
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
583 if (!msn_servconn_send_command(session->notification_conn, "CHG",
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
584 (idle ? "IDL" : "NLN"))) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
585
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
586 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587 signoff(gc);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
588 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
589 }
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 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
592 msn_add_buddy(struct gaim_connection *gc, const char *name)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
593 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
594 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
595 char *who;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
596 char outparams[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
597 GSList *l;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
598
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
599 who = msn_normalize(name);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
600
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
601 if (strchr(who, ' ')) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
602 /* This is a broken blist entry. */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
603 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
605
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
606 for (l = session->lists.forward; l != NULL; l = l->next) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
607 MsnUser *user = l->data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
608
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
609 if (!gaim_utf8_strcasecmp(who, msn_user_get_passport(user)))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
610 break;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
613 if (l != NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
614 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
615
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
616 g_snprintf(outparams, sizeof(outparams),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
617 "FL %s %s", who, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
618
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
619 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
620 "ADD", outparams)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
621 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
622 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
623 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
624 }
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 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
627 msn_rem_buddy(struct gaim_connection *gc, char *who, char *group)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
628 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
629 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
630 char outparams[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
631
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
632 g_snprintf(outparams, sizeof(outparams), "FL %s", who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
633
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
634 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
635 "REM", outparams)) {
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 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
638 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
639 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
642 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
643 msn_add_permit(struct gaim_connection *gc, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
645 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
646 char buf[MSN_BUF_LEN];
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 if (!strchr(who, '@')) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
649 g_snprintf(buf, sizeof(buf),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
650 _("An MSN screenname must be in the form \"user@server.com\". "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
651 "Perhaps you meant %s@hotmail.com. No changes were made "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
652 "to your allow list."), who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
653
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
654 do_error_dialog(_("Invalid MSN screenname"), buf, GAIM_ERROR);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
655 gaim_privacy_permit_remove(gc->account, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
656
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
657 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
658 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
659
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
660 if (g_slist_find_custom(gc->account->deny, who, (GCompareFunc)strcmp)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
661 gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from BL to AL\n", who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
662 gaim_privacy_deny_remove(gc->account, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
663
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
664 g_snprintf(buf, sizeof(buf), "BL %s", who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
665
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
666 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
667 "REM", buf)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
668
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
669 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
670 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
671 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
672 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
673 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
674
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
675 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
677 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
678 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
679 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
680 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
681 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
682
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
683 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
684 msn_add_deny(struct gaim_connection *gc, const char *who)
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 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
687 char buf[MSN_BUF_LEN];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
688
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
689 if (!strchr(who, '@')) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
690 g_snprintf(buf, sizeof(buf),
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
691 _("An MSN screenname must be in the form \"user@server.com\". "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
692 "Perhaps you meant %s@hotmail.com. No changes were made "
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
693 "to your block list."), who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
694
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
695 do_error_dialog(_("Invalid MSN screenname"), buf, GAIM_ERROR);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
696
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
697 gaim_privacy_deny_remove(gc->account, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
698
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
699 return;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
700 }
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 (g_slist_find_custom(gc->account->permit, who, (GCompareFunc)strcmp)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
703 gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from AL to BL\n", who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
704 gaim_privacy_permit_remove(gc->account, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
705
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
706 g_snprintf(buf, sizeof(buf), "AL %s", who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
707
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
708 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
709 "REM", buf)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
710
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
711 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
712 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
713 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
714 }
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
717 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
718
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
719 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
720 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
721 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
722 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
724 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
725
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
726 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
727 msn_rem_permit(struct gaim_connection *gc, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
728 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
729 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
730 char buf[MSN_BUF_LEN];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
731
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
732 g_snprintf(buf, sizeof(buf), "AL %s", who);
4150
1bd663beada5 [gaim-migrate @ 4369]
Rob Flynn <gaim@robflynn.com>
parents: 4115
diff changeset
733
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
734 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
735 hide_login_progress(gc, _("Write error"));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
736 signoff(gc);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
737 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
738 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
740 gaim_privacy_deny_add(gc->account, who);
2600
8aade06646b5 [gaim-migrate @ 2613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2597
diff changeset
741
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
742 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
2952
7a32dca869a8 [gaim-migrate @ 2965]
Rob Flynn <gaim@robflynn.com>
parents: 2932
diff changeset
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)) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
745 hide_login_progress(gc, _("Write error"));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746 signoff(gc);
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 return;
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
751 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
752 msn_rem_deny(struct gaim_connection *gc, const char *who)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
754 MsnSession *session = gc->proto_data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755 char buf[MSN_BUF_LEN];
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
756
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
757 g_snprintf(buf, sizeof(buf), "BL %s", who);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
759 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
760 hide_login_progress(gc, _("Write error"));
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
761 signoff(gc);
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
762 return;
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
763 }
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
764
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
765 gaim_privacy_permit_add(gc->account, who);
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
766
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
767 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
4069
5b56c42c2717 [gaim-migrate @ 4281]
Christian Hammond <chipx86@chipx86.com>
parents: 4068
diff changeset
768
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
769 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
770 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
771 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
772 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
773 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
774 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
775
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
776 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
777 msn_set_permit_deny(struct gaim_connection *gc)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
778 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
779 MsnSession *session = gc->proto_data;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
780 char buf[MSN_BUF_LEN];
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
781 GSList *s, *t = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
782
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
783 if (gc->account->permdeny == PERMIT_ALL ||
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
784 gc->account->permdeny == DENY_SOME) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
785
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
786 strcpy(buf, "AL");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
787 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
788 else
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
789 strcpy(buf, "BL");
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
790
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
791 if (!msn_servconn_send_command(session->notification_conn, "BLP", buf)) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
792 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
793 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
794 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
795 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
796
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
797 /*
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
798 * 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
799 * 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
800 * 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
801 * there's no sense in going through them all.
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
802 */
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
803 if (g_slist_length(gc->account->permit) ==
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
804 g_slist_length(session->lists.allow)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
805
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
806 g_slist_free(session->lists.allow);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
807 session->lists.allow = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
808 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
809
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
810 if (g_slist_length(gc->account->deny) ==
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
811 g_slist_length(session->lists.block)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
812
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
813 g_slist_free(session->lists.block);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
814 session->lists.block = NULL;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
815 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
816
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
817 if (session->lists.allow == NULL && session->lists.block == NULL)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
818 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
819
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
820 if (session->lists.allow != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
821
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
822 for (s = g_slist_nth(gc->account->permit,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
823 g_slist_length(session->lists.allow));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
824 s != NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
825 s = s->next) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
826
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
827 char *who = s->data;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
828
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
829 if (!strchr(who, '@')) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
830 t = g_slist_append(t, who);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
831 continue;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
832 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
833
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
834 if (g_slist_find(session->lists.block, who)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
835 t = g_slist_append(t, who);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
836 continue;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
837 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
838
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
839 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who);
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 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
842 "ADD", buf)) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
843 hide_login_progress(gc, _("Write error"));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
844 signoff(gc);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
845 return;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
846 }
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
847 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
848
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
849 for (; t != NULL; t = t->next)
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
850 gaim_privacy_permit_remove(gc->account, t->data);
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 if (t != NULL)
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
853 g_slist_free(t);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
854
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
855 t = NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
856 g_slist_free(session->lists.allow);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
857 session->lists.allow = NULL;
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
858 }
5309
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 if (session->lists.block) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
861 for (s = g_slist_nth(gc->account->deny,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
862 g_slist_length(session->lists.block));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
863 s != NULL;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
864 s = s->next) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
865
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
866 char *who = s->data;
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
867
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
868 if (!strchr(who, '@')) {
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
869 t = g_slist_append(t, who);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
870 continue;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
871 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
872
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
873 if (g_slist_find(session->lists.block, who)) {
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
874 t = g_slist_append(t, who);
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
875 continue;
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
876 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
877
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
878 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
879
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
880 if (!msn_servconn_send_command(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
881 "ADD", buf)) {
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
882 hide_login_progress(gc, _("Write error"));
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
883 signoff(gc);
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
884 return;
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
885 }
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
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 for (; t != NULL; t = t->next)
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4474
diff changeset
889 gaim_privacy_deny_remove(gc->account, t->data);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
890
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
891 if (t != NULL)
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
892 g_slist_free(t);
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
893
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
894 g_slist_free(session->lists.block);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
895 session->lists.block = NULL;
3200
c98dc4884ea3 [gaim-migrate @ 3217]
Sean Egan <seanegan@gmail.com>
parents: 3195
diff changeset
896 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
897 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
898
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
899 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
900 msn_chat_invite(struct gaim_connection *gc, int id, const char *msg,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
901 const char *who)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
902 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
903 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
904 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
905
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
906 if (swboard == NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
907 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
908
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
909 if (!msn_switchboard_send_command(swboard, "CAL", who))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
910 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
911 }
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 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
914 msn_chat_leave(struct gaim_connection *gc, int id)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
915 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
916 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
917 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
918 char buf[6];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
919
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
920 if (swboard == NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
921 return;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
922
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
923 strcpy(buf, "OUT\r\n");
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
924
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
925 if (!msn_servconn_write(swboard->servconn, buf, strlen(buf)))
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
926 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
927 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
928
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
929 static int
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
930 msn_chat_send(struct gaim_connection *gc, int id, char *message)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
931 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
932 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
933 MsnSwitchBoard *swboard = msn_session_find_switch_with_id(session, id);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
934 MsnMessage *msg;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
935 char *send;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
936
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
937 if (swboard == NULL)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
938 return -EINVAL;
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 send = add_cr(message);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
941
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
942 msg = msn_message_new();
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
943 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
944 msn_message_set_body(msg, send);
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_free(send);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
947
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
948 if (!msn_switchboard_send_msg(swboard, msg)) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
949 msn_switchboard_destroy(swboard);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
950
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
951 msn_message_destroy(msg);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
952
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
953 return 0;
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
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
956 msn_message_destroy(msg);
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 serv_got_chat_in(gc, id, gc->username, 0, message, time(NULL));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
959
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
960 return 0;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
961 }
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
962
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
963 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
964 msn_keepalive(struct gaim_connection *gc)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
965 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
966 MsnSession *session = gc->proto_data;
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
967 char buf[MSN_BUF_LEN];
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
968
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
969 g_snprintf(buf, sizeof(buf), "PNG\r\n");
2665
b0478af51be0 [gaim-migrate @ 2678]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2611
diff changeset
970
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
971 if (msn_servconn_write(session->notification_conn,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
972 buf, strlen(buf)) < 0) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
973
4056
4f3fb54ee669 [gaim-migrate @ 4266]
Luke Schierer <lschiere@pidgin.im>
parents: 4044
diff changeset
974 hide_login_progress(gc, _("Write error"));
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
975 signoff(gc);
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
976 return;
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
977 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
978 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
979
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
980 static void
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
981 msn_group_buddy(struct gaim_connection *gc, const char *who,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
982 const char *old_group, const char *new_group)
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
983 {
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
984 MsnSession *session = gc->proto_data;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
985 char outparams[MSN_BUF_LEN];
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
986 gint *old_group_id, *new_group_id;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
987
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
988 old_group_id = g_hash_table_lookup(session->group_ids, old_group);
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
989 new_group_id = g_hash_table_lookup(session->group_ids, new_group);
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
990
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
991 if (new_group_id == NULL) {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
992 g_snprintf(outparams, sizeof(outparams), "%s 0",
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
993 msn_url_encode(new_group));
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
994
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
995 if (!msn_servconn_send_command(session->notification_conn,
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
996 "ADG", outparams)) {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
997 hide_login_progress(gc, _("Write error"));
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
998 signoff(gc);
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
999 return;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1000 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1001
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1002 /* I hate this. So much. */
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1003 session->moving_buddy = TRUE;
5327
b716ffc25d2d [gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents: 5322
diff changeset
1004 session->dest_group_name = g_strdup(new_group);
5322
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1005 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1006 else {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1007 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d",
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1008 who, who, *new_group_id);
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1009
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1010 if (!msn_servconn_send_command(session->notification_conn,
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1011 "ADD", outparams)) {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1012 hide_login_progress(gc, _("Write error"));
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1013 signoff(gc);
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1014 return;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1015 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1016 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1017
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1018 if (old_group_id != NULL) {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1019 g_snprintf(outparams, sizeof(outparams), "FL %s %d",
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1020 who, *old_group_id);
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1021
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1022 if (!msn_servconn_send_command(session->notification_conn,
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1023 "REM", outparams)) {
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1024 hide_login_progress(gc, _("Write error"));
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1025 signoff(gc);
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1026 return;
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1027 }
a4d017bee1de [gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents: 5318
diff changeset
1028 }
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1029 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1030
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1031 static void
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1032 msn_rename_group(struct gaim_connection *gc, const char *old_group,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1033 const char *new_group, GList *members)
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1034 {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1035 MsnSession *session = gc->proto_data;
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1036 char outparams[MSN_BUF_LEN];
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1037 int *group_id;
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1038
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1039 if (g_hash_table_lookup_extended(session->group_ids, old_group,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1040 NULL, (gpointer)&group_id)) {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1041 g_snprintf(outparams, sizeof(outparams), "%d %s 0",
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1042 *group_id, msn_url_encode(new_group));
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1043
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1044 if (!msn_servconn_send_command(session->notification_conn,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1045 "REG", outparams)) {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1046 hide_login_progress(gc, _("Write error"));
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1047 signoff(gc);
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1048 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1049 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1050 else {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1051 g_snprintf(outparams, sizeof(outparams), "%s 0",
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1052 msn_url_encode(new_group));
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1053
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1054 if (!msn_servconn_send_command(session->notification_conn,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1055 "ADG", outparams)) {
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1056 hide_login_progress(gc, _("Write error"));
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1057 signoff(gc);
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1058 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1059 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1060 }
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1061
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1062 static void
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1063 msn_buddy_free(struct buddy *b)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1064 {
5363
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1065 if (b->proto_data != NULL) {
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1066 msn_user_destroy(b->proto_data);
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1067 b->proto_data = NULL;
ebebc833cf77 [gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents: 5361
diff changeset
1068 }
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1069 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1070
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1071 static void
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1072 msn_convo_closed(struct gaim_connection *gc, char *who)
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1073 {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1074 MsnSession *session = gc->proto_data;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1075 MsnSwitchBoard *swboard;
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1076
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1077 swboard = msn_session_find_switch_with_passport(session, who);
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1078
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1079 if (swboard != NULL) {
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1080 char sendbuf[256];
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1081
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1082 g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n", gc->username);
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1083
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1084 msn_servconn_write(swboard->servconn, sendbuf, strlen(sendbuf));
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1085
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1086 msn_switchboard_destroy(swboard);
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1087 }
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1088 }
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1089
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1090 static char *
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1091 msn_normalize(const char *str)
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1092 {
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1093 static char buf[BUF_LEN];
3294
f50db65fda5f [gaim-migrate @ 3312]
Sean Egan <seanegan@gmail.com>
parents: 3293
diff changeset
1094
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1095 g_return_val_if_fail(str != NULL, NULL);
2597
2ced57c58653 [gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
1096
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1097 g_snprintf(buf, sizeof(buf), "%s%s", str,
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1098 (strchr(str, '@') ? "" : "@hotmail.com"));
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
1099
5309
e2e53316a21d [gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents: 5221
diff changeset
1100 return buf;
2607
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1101 }
e0d4a23aac89 [gaim-migrate @ 2620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
1102
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1103 static GaimPluginProtocolInfo prpl_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1104 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1105 GAIM_PROTO_MSN,
5351
2aa7e4237142 [gaim-migrate @ 5727]
Christian Hammond <chipx86@chipx86.com>
parents: 5327
diff changeset
1106 OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1107 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1108 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1109 msn_list_icon,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1110 msn_list_emblems,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1111 msn_status_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1112 msn_tooltip_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1113 msn_away_states,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1114 msn_actions,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1115 msn_buddy_menu,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1116 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1117 msn_login,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1118 msn_close,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1119 msn_send_im,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1120 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1121 msn_send_typing,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1122 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1123 msn_set_away,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1124 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1125 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1126 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1127 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1128 msn_set_idle,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1129 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1130 msn_add_buddy,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1131 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1132 msn_rem_buddy,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1133 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1134 msn_add_permit,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1135 msn_add_deny,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1136 msn_rem_permit,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1137 msn_rem_deny,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1138 msn_set_permit_deny,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1139 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1140 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1141 msn_chat_invite,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1142 msn_chat_leave,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1143 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1144 msn_chat_send,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1145 msn_keepalive,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1146 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1147 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1148 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1149 NULL,
5318
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1150 msn_group_buddy,
bd98232872a3 [gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents: 5309
diff changeset
1151 msn_rename_group,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1152 msn_buddy_free,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1153 msn_convo_closed,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1154 msn_normalize
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1155 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1156
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1157 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1158 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1159 2, /**< api_version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1160 GAIM_PLUGIN_PROTOCOL, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1161 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1162 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1163 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1164 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1165
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1166 "prpl-msn", /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1167 "MSN", /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1168 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1169 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1170 N_("MSN Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1171 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1172 N_("MSN Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1173 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1174 WEBSITE, /**< homepage */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1175
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1176 NULL, /**< load */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1177 NULL, /**< unload */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1178 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1179
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1180 NULL, /**< ui_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1181 &prpl_info /**< extra_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1182 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1183
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1184 static void
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1185 __init_plugin(GaimPlugin *plugin)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1186 {
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1187 struct proto_user_opt *puo;
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1188
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1189 puo = g_new0(struct proto_user_opt, 1);
4966
54cd43869333 [gaim-migrate @ 5300]
Nathan Walp <nwalp@pidgin.im>
parents: 4921
diff changeset
1190 puo->label = g_strdup(_("Login Server:"));
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1191 puo->def = g_strdup(MSN_SERVER);
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1192 puo->pos = USEROPT_MSNSERVER;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1193 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo);
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1194
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1195 puo = g_new0(struct proto_user_opt, 1);
4115
474265997752 [gaim-migrate @ 4332]
Luke Schierer <lschiere@pidgin.im>
parents: 4112
diff changeset
1196 puo->label = g_strdup(_("Port:"));
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1197 puo->def = g_strdup("1863");
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3538
diff changeset
1198 puo->pos = USEROPT_MSNPORT;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1199 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1200
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1201 my_protocol = plugin;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1202 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1203
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5191
diff changeset
1204 GAIM_INIT_PLUGIN(msn, __init_plugin, info);