Mercurial > pidgin.yaz
annotate src/protocols/msn/msn.c @ 12072:1f8bab186e80
[gaim-migrate @ 14367]
Hmm, this 'A' should be lowercase, shouldn't it?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 13 Nov 2005 20:08:02 +0000 |
parents | c824e39db0e7 |
children | cbebda5f019c |
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 * |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
6 * Gaim is the legal property of its developers, whose names are too numerous |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 * source distribution. |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
9 * |
4542
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
10 * 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
|
11 * 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
|
12 * the Free Software Foundation; either version 2 of the License, or |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
13 * (at your option) any later version. |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
14 * |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
15 * 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
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
18 * GNU General Public License for more details. |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
19 * |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
20 * 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
|
21 * along with this program; if not, write to the Free Software |
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
22 * 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
|
23 */ |
9243 | 24 #define PHOTO_SUPPORT 1 |
25 | |
6827
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6801
diff
changeset
|
26 #include <glib.h> |
1cfbb731aa1f
[gaim-migrate @ 7372]
Christian Hammond <chipx86@chipx86.com>
parents:
6801
diff
changeset
|
27 |
4542
86b0a0243be8
[gaim-migrate @ 4821]
Christian Hammond <chipx86@chipx86.com>
parents:
4508
diff
changeset
|
28 #include "msn.h" |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
29 #include "accountopt.h" |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
30 #include "msg.h" |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
31 #include "page.h" |
8713 | 32 #include "pluginpref.h" |
5626
6275ac113622
[gaim-migrate @ 6033]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
33 #include "prefs.h" |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
34 #include "session.h" |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
35 #include "state.h" |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
36 #include "utils.h" |
11321 | 37 #include "cmds.h" |
9713 | 38 #include "prpl.h" |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
39 #include "util.h" |
9943 | 40 #include "version.h" |
4546
a951bb590857
[gaim-migrate @ 4825]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4542
diff
changeset
|
41 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
42 #include "switchboard.h" |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
43 #include "notification.h" |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
44 #include "sync.h" |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
45 #include "slplink.h" |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
46 |
9243 | 47 #if PHOTO_SUPPORT |
48 #include "imgstore.h" | |
49 #endif | |
50 | |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
51 typedef struct |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
52 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
53 GaimConnection *gc; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
54 const char *passport; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
55 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
56 } MsnMobileData; |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
57 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
58 typedef struct |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
59 { |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
60 GaimConnection *gc; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
61 char *name; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
62 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
63 } MsnGetInfoData; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
64 |
9243 | 65 typedef struct |
66 { | |
67 MsnGetInfoData *info_data; | |
68 char *stripped; | |
69 char *url_buffer; | |
70 GString *s; | |
71 char *photo_url_text; | |
72 char *tooltip_text; | |
9510 | 73 const char *title; |
9243 | 74 |
75 } MsnGetInfoStepTwoData; | |
76 | |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
77 static const char * |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
78 msn_normalize(const GaimAccount *account, const char *str) |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
79 { |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
80 static char buf[BUF_LEN]; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
81 char *tmp; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
82 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
83 g_return_val_if_fail(str != NULL, NULL); |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
84 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
85 g_snprintf(buf, sizeof(buf), "%s%s", str, |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
86 (strchr(str, '@') ? "" : "@hotmail.com")); |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
87 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
88 tmp = g_utf8_strdown(buf, -1); |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
89 strncpy(buf, tmp, sizeof(buf)); |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
90 g_free(tmp); |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
91 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
92 return buf; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
93 } |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
94 |
11321 | 95 static GaimCmdRet |
96 msn_cmd_nudge(GaimConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) | |
97 { | |
98 GaimAccount *account = gaim_conversation_get_account(conv); | |
99 GaimConnection *gc = gaim_account_get_connection(account); | |
100 MsnMessage *msg; | |
101 MsnSession *session; | |
102 MsnSwitchBoard *swboard; | |
103 | |
104 msg = msn_message_new_nudge(); | |
105 session = gc->proto_data; | |
106 swboard = msn_session_get_swboard(session, gaim_conversation_get_name(conv), MSN_SB_FLAG_IM); | |
107 | |
108 if (session == NULL || swboard == NULL) | |
109 return GAIM_CMD_RET_FAILED; | |
110 | |
111 msn_switchboard_send_msg(swboard, msg, TRUE); | |
112 | |
113 gaim_conversation_write(conv, NULL, _("You have just sent a Nudge!"), GAIM_MESSAGE_SYSTEM, time(NULL)); | |
114 | |
115 return GAIM_CMD_RET_OK; | |
116 } | |
117 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
118 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
119 msn_act_id(GaimConnection *gc, const char *entry) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
120 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
121 MsnCmdProc *cmdproc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
122 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
123 GaimAccount *account; |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
124 const char *alias; |
2086 | 125 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
126 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
127 cmdproc = session->notification->cmdproc; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
128 account = gaim_connection_get_account(gc); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
129 |
10069
7cbe12859d3a
[gaim-migrate @ 11045]
Luke Schierer <lschiere@pidgin.im>
parents:
10068
diff
changeset
|
130 if(entry && strlen(entry)) |
7cbe12859d3a
[gaim-migrate @ 11045]
Luke Schierer <lschiere@pidgin.im>
parents:
10068
diff
changeset
|
131 alias = gaim_url_encode(entry); |
7cbe12859d3a
[gaim-migrate @ 11045]
Luke Schierer <lschiere@pidgin.im>
parents:
10068
diff
changeset
|
132 else |
7cbe12859d3a
[gaim-migrate @ 11045]
Luke Schierer <lschiere@pidgin.im>
parents:
10068
diff
changeset
|
133 alias = ""; |
3171 | 134 |
8333
85dbaac926a7
[gaim-migrate @ 9057]
Christian Hammond <chipx86@chipx86.com>
parents:
8298
diff
changeset
|
135 if (strlen(alias) > BUDDY_ALIAS_MAXLEN) |
85dbaac926a7
[gaim-migrate @ 9057]
Christian Hammond <chipx86@chipx86.com>
parents:
8298
diff
changeset
|
136 { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5382
diff
changeset
|
137 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5382
diff
changeset
|
138 _("Your new MSN friendly name is too long."), NULL); |
2738
01f0497fe6c8
[gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
139 return; |
01f0497fe6c8
[gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
140 } |
01f0497fe6c8
[gaim-migrate @ 2751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2688
diff
changeset
|
141 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
142 msn_cmdproc_send(cmdproc, "REA", "%s %s", |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
143 gaim_account_get_username(account), |
10069
7cbe12859d3a
[gaim-migrate @ 11045]
Luke Schierer <lschiere@pidgin.im>
parents:
10068
diff
changeset
|
144 alias); |
2086 | 145 } |
146 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
147 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
148 msn_set_prp(GaimConnection *gc, const char *type, const char *entry) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
149 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
150 MsnCmdProc *cmdproc; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
151 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
152 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
153 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
154 cmdproc = session->notification->cmdproc; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
155 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
156 if (entry == NULL || *entry == '\0') |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
157 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
158 msn_cmdproc_send(cmdproc, "PRP", "%s", type); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
159 } |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
160 else |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
161 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
162 msn_cmdproc_send(cmdproc, "PRP", "%s %s", type, |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
163 gaim_url_encode(entry)); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
164 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
165 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
166 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
167 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
168 msn_set_home_phone_cb(GaimConnection *gc, const char *entry) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
169 { |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
170 msn_set_prp(gc, "PHH", entry); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
171 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
172 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
173 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
174 msn_set_work_phone_cb(GaimConnection *gc, const char *entry) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
175 { |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
176 msn_set_prp(gc, "PHW", entry); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
177 } |
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 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
180 msn_set_mobile_phone_cb(GaimConnection *gc, const char *entry) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
181 { |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
182 msn_set_prp(gc, "PHM", entry); |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
183 } |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
184 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
185 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
186 enable_msn_pages_cb(GaimConnection *gc) |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
187 { |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
188 msn_set_prp(gc, "MOB", "Y"); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
189 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
190 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
191 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
192 disable_msn_pages_cb(GaimConnection *gc) |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
193 { |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
194 msn_set_prp(gc, "MOB", "N"); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
195 } |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
196 |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
197 static void |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
198 send_to_mobile(GaimConnection *gc, const char *who, const char *entry) |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
199 { |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
200 MsnTransaction *trans; |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8595
diff
changeset
|
201 MsnSession *session; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
202 MsnCmdProc *cmdproc; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
203 MsnPage *page; |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8595
diff
changeset
|
204 char *payload; |
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8595
diff
changeset
|
205 size_t payload_len; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
206 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
207 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
208 cmdproc = session->notification->cmdproc; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
209 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
210 page = msn_page_new(); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
211 msn_page_set_body(page, entry); |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8595
diff
changeset
|
212 |
9092
9e5a709c30a8
[gaim-migrate @ 9869]
Christian Hammond <chipx86@chipx86.com>
parents:
9091
diff
changeset
|
213 payload = msn_page_gen_payload(page, &payload_len); |
8646
1e211dde3cae
[gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents:
8595
diff
changeset
|
214 |
10225 | 215 trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %d", who, payload_len); |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
216 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
217 msn_transaction_set_payload(trans, payload, payload_len); |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
218 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
219 msn_page_destroy(page); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
220 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
221 msn_cmdproc_send_trans(cmdproc, trans); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
222 } |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
223 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
224 static void |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
225 send_to_mobile_cb(MsnMobileData *data, const char *entry) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
226 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
227 send_to_mobile(data->gc, data->passport, entry); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
228 g_free(data); |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
229 } |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
230 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
231 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
232 close_mobile_page_cb(MsnMobileData *data, const char *entry) |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
233 { |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
234 g_free(data); |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
235 } |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
236 |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
237 /* -- */ |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
238 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
239 static void |
9015 | 240 msn_show_set_friendly_name(GaimPluginAction *action) |
2086 | 241 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
242 GaimConnection *gc; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
243 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
244 gc = (GaimConnection *) action->context; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
245 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
246 gaim_request_input(gc, NULL, _("Set your friendly name."), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
247 _("This is the name that other MSN buddies will " |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
248 "see you as."), |
8697 | 249 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, |
5481
084147a0d9e4
[gaim-migrate @ 5877]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
250 _("OK"), G_CALLBACK(msn_act_id), |
084147a0d9e4
[gaim-migrate @ 5877]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
251 _("Cancel"), NULL, gc); |
2086 | 252 } |
253 | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
254 static void |
9015 | 255 msn_show_set_home_phone(GaimPluginAction *action) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
256 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
257 GaimConnection *gc; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
258 MsnSession *session; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
259 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
260 gc = (GaimConnection *) action->context; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
261 session = gc->proto_data; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
262 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
263 gaim_request_input(gc, NULL, _("Set your home phone number."), NULL, |
8697 | 264 msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
265 _("OK"), G_CALLBACK(msn_set_home_phone_cb), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
266 _("Cancel"), NULL, gc); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
267 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
268 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
269 static void |
9015 | 270 msn_show_set_work_phone(GaimPluginAction *action) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
271 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
272 GaimConnection *gc; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
273 MsnSession *session; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
274 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
275 gc = (GaimConnection *) action->context; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
276 session = gc->proto_data; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
277 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
278 gaim_request_input(gc, NULL, _("Set your work phone number."), NULL, |
8697 | 279 msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
280 _("OK"), G_CALLBACK(msn_set_work_phone_cb), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
281 _("Cancel"), NULL, gc); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
282 } |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
283 |
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
284 static void |
9015 | 285 msn_show_set_mobile_phone(GaimPluginAction *action) |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
286 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
287 GaimConnection *gc; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
288 MsnSession *session; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
289 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
290 gc = (GaimConnection *) action->context; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
291 session = gc->proto_data; |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
292 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
293 gaim_request_input(gc, NULL, _("Set your mobile phone number."), NULL, |
8697 | 294 msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
295 _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), |
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
296 _("Cancel"), NULL, gc); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
297 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
298 |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
299 static void |
9015 | 300 msn_show_set_mobile_pages(GaimPluginAction *action) |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
301 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
302 GaimConnection *gc; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
303 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
304 gc = (GaimConnection *) action->context; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
305 |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5491
diff
changeset
|
306 gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"), |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
307 _("Do you want to allow or disallow people on " |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
308 "your buddy list to send you MSN Mobile pages " |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
309 "to your cell phone or other mobile device?"), |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
310 -1, gc, 3, |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
311 _("Allow"), G_CALLBACK(enable_msn_pages_cb), |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
312 _("Disallow"), G_CALLBACK(disable_msn_pages_cb), |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
313 _("Cancel"), NULL); |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
314 } |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
315 |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
316 static void |
11321 | 317 msn_show_hotmail_inbox(GaimPluginAction *action) |
318 { | |
319 GaimConnection *gc; | |
320 MsnSession *session; | |
321 | |
322 gc = (GaimConnection *) action->context; | |
323 session = gc->proto_data; | |
324 | |
325 if (session->passport_info.file == NULL) | |
326 { | |
327 gaim_notify_error(gc, NULL, | |
328 _("This Hotmail account may not be active."), NULL); | |
329 return; | |
330 } | |
331 | |
332 gaim_notify_uri(gc, session->passport_info.file); | |
333 } | |
334 | |
335 static void | |
9030 | 336 show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored) |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
337 { |
9030 | 338 GaimBuddy *buddy; |
339 GaimConnection *gc; | |
9042 | 340 MsnSession *session; |
341 MsnMobileData *data; | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
342 |
9030 | 343 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
344 | |
345 buddy = (GaimBuddy *) node; | |
346 gc = gaim_account_get_connection(buddy->account); | |
347 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
348 session = gc->proto_data; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
349 |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
350 data = g_new0(MsnMobileData, 1); |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
351 data->gc = gc; |
9030 | 352 data->passport = buddy->name; |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
353 |
5491
4bcae8503866
[gaim-migrate @ 5887]
Christian Hammond <chipx86@chipx86.com>
parents:
5481
diff
changeset
|
354 gaim_request_input(gc, NULL, _("Send a mobile message."), NULL, |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
355 NULL, TRUE, FALSE, NULL, |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
356 _("Page"), G_CALLBACK(send_to_mobile_cb), |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
357 _("Close"), G_CALLBACK(close_mobile_page_cb), |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
358 data); |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
359 } |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
360 |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
361 static void |
9030 | 362 initiate_chat_cb(GaimBlistNode *node, gpointer data) |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
363 { |
9030 | 364 GaimBuddy *buddy; |
365 GaimConnection *gc; | |
366 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
367 MsnSession *session; |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
368 MsnSwitchBoard *swboard; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
369 |
9030 | 370 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
371 |
9030 | 372 buddy = (GaimBuddy *) node; |
373 gc = gaim_account_get_connection(buddy->account); | |
374 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
375 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
376 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
377 swboard = msn_switchboard_new(session); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
378 msn_switchboard_request(swboard); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
379 msn_switchboard_request_add_user(swboard, buddy->name); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
380 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
381 /* TODO: This might move somewhere else, after USR might be */ |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
382 swboard->chat_id = session->conv_seq++; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
383 swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); |
10773 | 384 swboard->flag = MSN_SB_FLAG_IM; |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
385 |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
386 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv), |
9846 | 387 gaim_account_get_username(buddy->account), NULL, GAIM_CBFLAGS_NONE, TRUE); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
388 } |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
389 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
390 static void |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
391 t_msn_xfer_init(GaimXfer *xfer) |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
392 { |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
393 MsnSlpLink *slplink; |
10102 | 394 const char *filename; |
395 FILE *fp; | |
396 | |
397 filename = gaim_xfer_get_local_filename(xfer); | |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
398 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
399 slplink = xfer->data; |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
400 |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10568
diff
changeset
|
401 if ((fp = g_fopen(filename, "rb")) == NULL) |
10102 | 402 { |
403 GaimAccount *account; | |
404 GaimConnection *gc; | |
405 const char *who; | |
406 char *msg; | |
407 | |
408 account = slplink->session->account; | |
409 gc = gaim_account_get_connection(account); | |
410 who = slplink->remote_user; | |
411 | |
412 msg = g_strdup_printf(_("Error reading %s: \n%s.\n"), | |
413 filename, strerror(errno)); | |
10654 | 414 gaim_xfer_error(gaim_xfer_get_type(xfer), account, xfer->who, msg); |
10102 | 415 gaim_xfer_cancel_local(xfer); |
416 g_free(msg); | |
417 | |
418 return; | |
419 } | |
420 fclose(fp); | |
421 | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
422 msn_slplink_request_ft(slplink, xfer); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
423 } |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
424 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
425 static void |
9466 | 426 msn_send_file(GaimConnection *gc, const char *who, const char *file) |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
427 { |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
428 MsnSession *session; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
429 MsnSlpLink *slplink; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
430 GaimXfer *xfer; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
431 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
432 session = gc->proto_data; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
433 |
9466 | 434 xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, who); |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
435 |
9466 | 436 slplink = msn_session_get_slplink(session, who); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
437 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
438 xfer->data = slplink; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
439 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
440 gaim_xfer_set_init_fnc(xfer, t_msn_xfer_init); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
441 |
9466 | 442 if (file) |
443 gaim_xfer_request_accepted(xfer, file); | |
444 else | |
445 gaim_xfer_request(xfer); | |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
446 } |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
447 |
10116 | 448 static gboolean |
449 msn_can_receive_file(GaimConnection *gc, const char *who) | |
450 { | |
451 GaimAccount *account; | |
452 char *normal; | |
453 gboolean ret; | |
454 | |
455 account = gaim_connection_get_account(gc); | |
456 | |
457 normal = g_strdup(msn_normalize(account, gaim_account_get_username(account))); | |
458 | |
459 ret = strcmp(normal, msn_normalize(account, who)); | |
460 | |
461 g_free(normal); | |
462 | |
463 return ret; | |
464 } | |
465 | |
5309
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 * Protocol Plugin ops |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
468 **************************************************************************/ |
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 static const char * |
6695 | 471 msn_list_icon(GaimAccount *a, GaimBuddy *b) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
472 { |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
473 return "msn"; |
2993 | 474 } |
475 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
476 static void |
9953 | 477 msn_list_emblems(GaimBuddy *b, const char **se, const char **sw, |
478 const char **nw, const char **ne) | |
2086 | 479 { |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
480 MsnUser *user; |
9967 | 481 GaimPresence *presence; |
9953 | 482 const char *emblems[4] = { NULL, NULL, NULL, NULL }; |
10068
f948913f3c33
[gaim-migrate @ 11044]
Luke Schierer <lschiere@pidgin.im>
parents:
10063
diff
changeset
|
483 int i = 0; |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
484 |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
485 user = b->proto_data; |
9967 | 486 presence = gaim_buddy_get_presence(b); |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
487 |
9967 | 488 if (!gaim_presence_is_online(presence)) |
10068
f948913f3c33
[gaim-migrate @ 11044]
Luke Schierer <lschiere@pidgin.im>
parents:
10063
diff
changeset
|
489 emblems[i++] = "offline"; |
9967 | 490 else if (gaim_presence_is_status_active(presence, "busy") || |
491 gaim_presence_is_status_active(presence, "phone")) | |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
492 emblems[i++] = "occupied"; |
10451 | 493 else if (!gaim_presence_is_available(presence)) |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
494 emblems[i++] = "away"; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
495 |
10068
f948913f3c33
[gaim-migrate @ 11044]
Luke Schierer <lschiere@pidgin.im>
parents:
10063
diff
changeset
|
496 if (user == NULL) |
f948913f3c33
[gaim-migrate @ 11044]
Luke Schierer <lschiere@pidgin.im>
parents:
10063
diff
changeset
|
497 { |
f948913f3c33
[gaim-migrate @ 11044]
Luke Schierer <lschiere@pidgin.im>
parents:
10063
diff
changeset
|
498 emblems[0] = "offline"; |
f948913f3c33
[gaim-migrate @ 11044]
Luke Schierer <lschiere@pidgin.im>
parents:
10063
diff
changeset
|
499 } |
10275 | 500 else |
501 { | |
502 if (user->mobile) | |
503 emblems[i++] = "wireless"; | |
504 if (!(user->list_op & (1 << MSN_LIST_RL))) | |
505 emblems[i++] = "nr"; | |
506 } | |
10068
f948913f3c33
[gaim-migrate @ 11044]
Luke Schierer <lschiere@pidgin.im>
parents:
10063
diff
changeset
|
507 |
5361
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
508 *se = emblems[0]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
509 *sw = emblems[1]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
510 *nw = emblems[2]; |
953aa05279f4
[gaim-migrate @ 5737]
Christian Hammond <chipx86@chipx86.com>
parents:
5351
diff
changeset
|
511 *ne = emblems[3]; |
2086 | 512 } |
513 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
514 static char * |
9951 | 515 msn_status_text(GaimBuddy *buddy) |
2086 | 516 { |
10044 | 517 GaimPresence *presence; |
518 GaimStatus *status; | |
519 | |
520 presence = gaim_buddy_get_presence(buddy); | |
521 status = gaim_presence_get_active_status(presence); | |
9951 | 522 |
10057
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
523 if (!gaim_presence_is_available(presence) && !gaim_presence_is_idle(presence)) |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
524 { |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
525 return g_strdup(gaim_status_get_name(status)); |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
526 } |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
527 |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
528 return NULL; |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
529 } |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
530 |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
531 static char * |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
532 msn_tooltip_text(GaimBuddy *buddy) |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
533 { |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
534 MsnUser *user; |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
535 GaimPresence *presence = gaim_buddy_get_presence(buddy); |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
536 GaimStatus *status = gaim_presence_get_active_status(presence); |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
537 GString *s; |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
538 |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
539 user = buddy->proto_data; |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
540 |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
541 s = g_string_new(""); |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
542 if (gaim_presence_is_online(presence)) |
10044 | 543 { |
544 g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Status"), | |
10057
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
545 gaim_presence_is_idle(presence) ? |
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
546 _("Idle") : gaim_status_get_name(status)); |
10044 | 547 } |
2086 | 548 |
10093 | 549 if (user) |
550 { | |
551 g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Has you"), | |
552 (user->list_op & (1 << MSN_LIST_RL)) ? | |
553 _("Yes") : _("No")); | |
10275 | 554 g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Blocked"), |
555 (user->list_op & (1 << MSN_LIST_BL)) ? | |
556 _("Yes") : _("No")); | |
10093 | 557 } |
10044 | 558 |
559 return g_string_free(s, FALSE); | |
2086 | 560 } |
561 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
562 static GList * |
9951 | 563 msn_status_types(GaimAccount *account) |
2086 | 564 { |
9967 | 565 GaimStatusType *status; |
9951 | 566 GList *types = NULL; |
567 | |
10057
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
568 status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, |
11992 | 569 "offline", _("Offline"), FALSE, TRUE, FALSE); |
9967 | 570 types = g_list_append(types, status); |
9951 | 571 |
9967 | 572 status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, |
10057
5d2a08d82e7a
[gaim-migrate @ 11022]
Luke Schierer <lschiere@pidgin.im>
parents:
10049
diff
changeset
|
573 "available", _("Available"), FALSE, TRUE, FALSE); |
9967 | 574 types = g_list_append(types, status); |
2086 | 575 |
9967 | 576 status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "away", |
9951 | 577 _("Away"), FALSE, TRUE, FALSE); |
9967 | 578 types = g_list_append(types, status); |
579 | |
580 status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "brb", | |
9951 | 581 _("Be Right Back"), FALSE, TRUE, FALSE); |
9967 | 582 types = g_list_append(types, status); |
583 | |
584 status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "busy", | |
9951 | 585 _("Busy"), FALSE, TRUE, FALSE); |
9967 | 586 types = g_list_append(types, status); |
587 | |
588 status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "phone", | |
9951 | 589 _("On The Phone"), FALSE, TRUE, FALSE); |
9967 | 590 types = g_list_append(types, status); |
591 | |
592 status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "lunch", | |
9951 | 593 _("Out To Lunch"), FALSE, TRUE, FALSE); |
9967 | 594 types = g_list_append(types, status); |
595 | |
11487 | 596 status = gaim_status_type_new_full(GAIM_STATUS_HIDDEN, "invisible", |
9951 | 597 _("Hidden"), FALSE, TRUE, FALSE); |
9967 | 598 types = g_list_append(types, status); |
9951 | 599 |
600 return types; | |
2086 | 601 } |
602 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
603 static GList * |
9015 | 604 msn_actions(GaimPlugin *plugin, gpointer context) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
605 { |
11321 | 606 GaimConnection *gc = (GaimConnection *)context; |
607 GaimAccount *account; | |
608 const char *user; | |
609 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
610 GList *m = NULL; |
9015 | 611 GaimPluginAction *act; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
612 |
9015 | 613 act = gaim_plugin_action_new(_("Set Friendly Name"), |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
614 msn_show_set_friendly_name); |
9015 | 615 m = g_list_append(m, act); |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
616 m = g_list_append(m, NULL); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
617 |
9015 | 618 act = gaim_plugin_action_new(_("Set Home Phone Number"), |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
619 msn_show_set_home_phone); |
9015 | 620 m = g_list_append(m, act); |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
621 |
9015 | 622 act = gaim_plugin_action_new(_("Set Work Phone Number"), |
623 msn_show_set_work_phone); | |
624 m = g_list_append(m, act); | |
5363
ebebc833cf77
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5361
diff
changeset
|
625 |
9015 | 626 act = gaim_plugin_action_new(_("Set Mobile Phone Number"), |
627 msn_show_set_mobile_phone); | |
628 m = g_list_append(m, act); | |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
629 m = g_list_append(m, NULL); |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
630 |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
631 #if 0 |
9015 | 632 act = gaim_plugin_action_new(_("Enable/Disable Mobile Devices"), |
633 msn_show_set_mobile_support); | |
634 m = g_list_append(m, act); | |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
635 #endif |
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
636 |
9015 | 637 act = gaim_plugin_action_new(_("Allow/Disallow Mobile Pages"), |
638 msn_show_set_mobile_pages); | |
639 m = g_list_append(m, act); | |
5364
379beab3d157
[gaim-migrate @ 5740]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
640 |
11321 | 641 account = gaim_connection_get_account(gc); |
642 user = msn_normalize(account, gaim_account_get_username(account)); | |
643 | |
644 if (strstr(user, "@hotmail.com") != NULL) | |
645 { | |
646 m = g_list_append(m, NULL); | |
647 act = gaim_plugin_action_new(_("Open Hotmail Inbox"), | |
648 msn_show_hotmail_inbox); | |
649 m = g_list_append(m, act); | |
650 } | |
651 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
652 return m; |
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 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
655 static GList * |
9030 | 656 msn_buddy_menu(GaimBuddy *buddy) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
657 { |
5372
fa0217bec87e
[gaim-migrate @ 5748]
Christian Hammond <chipx86@chipx86.com>
parents:
5369
diff
changeset
|
658 MsnUser *user; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
659 |
9030 | 660 GList *m = NULL; |
661 GaimBlistNodeAction *act; | |
6858
885c6528843b
[gaim-migrate @ 7403]
Christian Hammond <chipx86@chipx86.com>
parents:
6842
diff
changeset
|
662 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
663 g_return_val_if_fail(buddy != NULL, NULL); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
664 |
9030 | 665 user = buddy->proto_data; |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
666 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
667 if (user != NULL) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
668 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
669 if (user->mobile) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
670 { |
9030 | 671 act = gaim_blist_node_action_new(_("Send to Mobile"), |
10662
54ac161a876e
[gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10654
diff
changeset
|
672 show_send_to_mobile_cb, NULL, NULL); |
9030 | 673 m = g_list_append(m, act); |
5382
b18332105302
[gaim-migrate @ 5758]
Christian Hammond <chipx86@chipx86.com>
parents:
5379
diff
changeset
|
674 } |
5369
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
675 } |
a87818e9dc54
[gaim-migrate @ 5745]
Christian Hammond <chipx86@chipx86.com>
parents:
5364
diff
changeset
|
676 |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
677 if (g_ascii_strcasecmp(buddy->name, |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
678 gaim_account_get_username(buddy->account))) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
679 { |
10463 | 680 act = gaim_blist_node_action_new(_("Initiate _Chat"), |
10662
54ac161a876e
[gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10654
diff
changeset
|
681 initiate_chat_cb, NULL, NULL); |
9030 | 682 m = g_list_append(m, act); |
6148
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
683 } |
82e7eaa67406
[gaim-migrate @ 6622]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
684 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
685 return m; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
686 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
687 |
9030 | 688 static GList * |
689 msn_blist_node_menu(GaimBlistNode *node) | |
690 { | |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
691 if(GAIM_BLIST_NODE_IS_BUDDY(node)) |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
692 { |
9030 | 693 return msn_buddy_menu((GaimBuddy *) node); |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
694 } |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
695 else |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
696 { |
9030 | 697 return NULL; |
698 } | |
699 } | |
700 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
701 static void |
11837 | 702 msn_login(GaimAccount *account) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
703 { |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
704 GaimConnection *gc; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
705 MsnSession *session; |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
706 const char *username; |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
707 const char *host; |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7277
diff
changeset
|
708 gboolean http_method = FALSE; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
709 int port; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
710 |
7277
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
711 gc = gaim_account_get_connection(account); |
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
712 |
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
713 if (!gaim_ssl_is_supported()) |
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
714 { |
10914 | 715 gc->wants_to_die = TRUE; |
7277
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
716 gaim_connection_error(gc, |
8499
467b01d02f9c
[gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
717 _("SSL support is needed for MSN. Please install a supported " |
467b01d02f9c
[gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
718 "SSL library. See http://gaim.sf.net/faq-ssl.php for more " |
467b01d02f9c
[gaim-migrate @ 9235]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
719 "information.")); |
7277
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
720 |
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
721 return; |
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
722 } |
2972dad4438b
[gaim-migrate @ 7856]
Christian Hammond <chipx86@chipx86.com>
parents:
7262
diff
changeset
|
723 |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7277
diff
changeset
|
724 if (gaim_account_get_bool(account, "http_method", FALSE)) |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7277
diff
changeset
|
725 http_method = TRUE; |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7277
diff
changeset
|
726 |
10463 | 727 host = gaim_account_get_string(account, "server", MSN_SERVER); |
10481 | 728 port = gaim_account_get_int(account, "port", MSN_PORT); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
729 |
10481 | 730 session = msn_session_new(account); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
731 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
732 gc->proto_data = session; |
9775 | 733 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_FORMATTING_WBFO | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_FONTSIZE | GAIM_CONNECTION_NO_URLDESC; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
734 |
10481 | 735 msn_session_set_login_step(session, MSN_LOGIN_STEP_START); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
736 |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
737 /* Hmm, I don't like this. */ |
10481 | 738 /* XXX shx: Me neither */ |
7322 | 739 username = msn_normalize(account, gaim_account_get_username(account)); |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
740 |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
741 if (strcmp(username, gaim_account_get_username(account))) |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
742 gaim_account_set_username(account, username); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
743 |
10568 | 744 if (!msn_session_connect(session, host, port, http_method)) |
745 gaim_connection_error(gc, _("Failed to connect to server.")); | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
746 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
747 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
748 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
749 msn_close(GaimConnection *gc) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
750 { |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
751 MsnSession *session; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
752 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
753 session = gc->proto_data; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
754 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
755 g_return_if_fail(session != NULL); |
8298
c719f9a181d4
[gaim-migrate @ 9022]
Christian Hammond <chipx86@chipx86.com>
parents:
8291
diff
changeset
|
756 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
757 msn_session_destroy(session); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
758 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
759 gc->proto_data = NULL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
760 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
761 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
762 static int |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
763 msn_send_im(GaimConnection *gc, const char *who, const char *message, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
764 GaimConvImFlags flags) |
2086 | 765 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
766 GaimAccount *account; |
10275 | 767 MsnMessage *msg; |
768 char *msgformat; | |
769 char *msgtext; | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
770 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
771 account = gaim_connection_get_account(gc); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
772 |
10275 | 773 msn_import_html(message, &msgformat, &msgtext); |
774 | |
775 if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564) | |
776 { | |
777 g_free(msgformat); | |
778 g_free(msgtext); | |
779 | |
780 return -E2BIG; | |
781 } | |
782 | |
783 msg = msn_message_new_plain(msgtext); | |
784 msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); | |
785 | |
786 g_free(msgformat); | |
787 g_free(msgtext); | |
788 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
789 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
790 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
791 MsnSession *session; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
792 MsnSwitchBoard *swboard; |
8595
1d5e31e518fc
[gaim-migrate @ 9346]
Christian Hammond <chipx86@chipx86.com>
parents:
8591
diff
changeset
|
793 |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
794 session = gc->proto_data; |
10773 | 795 swboard = msn_session_get_swboard(session, who, MSN_SB_FLAG_IM); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
796 |
10481 | 797 msn_switchboard_send_msg(swboard, msg, TRUE); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
798 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
799 else |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
800 { |
10275 | 801 char *body_str, *body_enc, *pre, *post; |
802 const char *format; | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
803 /* |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
804 * In MSN, you can't send messages to yourself, so |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
805 * we'll fake like we received it ;) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
806 */ |
10275 | 807 body_str = msn_message_to_string(msg); |
10732
c4cb90065e1d
[gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents:
10716
diff
changeset
|
808 body_enc = g_markup_escape_text(body_str, -1); |
10275 | 809 g_free(body_str); |
810 | |
811 format = msn_message_get_attr(msg, "X-MMS-IM-Format"); | |
812 msn_parse_format(format, &pre, &post); | |
10568 | 813 body_str = g_strdup_printf("%s%s%s", pre ? pre : "", |
814 body_enc ? body_enc : "", post ? post : ""); | |
10346 | 815 g_free(body_enc); |
10275 | 816 g_free(pre); |
817 g_free(post); | |
818 | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
819 serv_got_typing_stopped(gc, who); |
10275 | 820 serv_got_im(gc, who, body_str, flags, time(NULL)); |
821 g_free(body_str); | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
822 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
823 |
10275 | 824 msn_message_destroy(msg); |
825 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
826 return 1; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
827 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
828 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
829 static int |
6059 | 830 msn_send_typing(GaimConnection *gc, const char *who, int typing) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
831 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
832 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
833 MsnSession *session; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
834 MsnSwitchBoard *swboard; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
835 MsnMessage *msg; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
836 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
837 account = gaim_connection_get_account(gc); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
838 session = gc->proto_data; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
839 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
840 if (!typing) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
841 return 0; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
842 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
843 if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
844 { |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
845 /* We'll just fake it, since we're sending to ourself. */ |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5793
diff
changeset
|
846 serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, GAIM_TYPING); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
847 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
848 return MSN_TYPING_SEND_TIMEOUT; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
849 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
850 |
10621 | 851 swboard = msn_session_find_swboard(session, who); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
852 |
10481 | 853 if (swboard == NULL || !msn_switchboard_can_send(swboard)) |
10346 | 854 return 0; |
855 | |
10773 | 856 swboard->flag |= MSN_SB_FLAG_IM; |
857 | |
10225 | 858 msg = msn_message_new(MSN_MSG_TYPING); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
859 msn_message_set_content_type(msg, "text/x-msmsgscontrol"); |
5505
870207a49f2f
[gaim-migrate @ 5904]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
860 msn_message_set_flag(msg, 'U'); |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
861 msn_message_set_attr(msg, "TypingUser", |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
862 gaim_account_get_username(account)); |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
863 msn_message_set_bin_data(msg, "\r\n", 2); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
864 |
10481 | 865 msn_switchboard_send_msg(swboard, msg, FALSE); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
866 |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
867 msn_message_destroy(msg); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
868 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
869 return MSN_TYPING_SEND_TIMEOUT; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
870 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
871 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
872 static void |
9967 | 873 msn_set_status(GaimAccount *account, GaimStatus *status) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
874 { |
9967 | 875 GaimConnection *gc; |
11992 | 876 MsnSession *session; |
9967 | 877 |
878 gc = gaim_account_get_connection(account); | |
879 | |
11028 | 880 if (gc != NULL) |
11992 | 881 { |
10646 | 882 session = gc->proto_data; |
11992 | 883 msn_change_status(session); |
884 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
885 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
886 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
887 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
888 msn_set_idle(GaimConnection *gc, int idle) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
889 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
890 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
891 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
892 session = gc->proto_data; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
893 |
11992 | 894 msn_change_status(session); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
895 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
896 |
11992 | 897 #if 0 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
898 static void |
10044 | 899 fake_userlist_add_buddy(MsnUserList *userlist, |
900 const char *who, int list_id, | |
901 const char *group_name) | |
902 { | |
903 MsnUser *user; | |
904 static int group_id_c = 1; | |
905 int group_id; | |
906 | |
907 group_id = -1; | |
908 | |
909 if (group_name != NULL) | |
910 { | |
911 MsnGroup *group; | |
912 group = msn_group_new(userlist, group_id_c, group_name); | |
913 group_id = group_id_c++; | |
914 } | |
915 | |
916 user = msn_userlist_find_user(userlist, who); | |
917 | |
918 if (user == NULL) | |
919 { | |
920 user = msn_user_new(userlist, who, NULL); | |
921 msn_userlist_add_user(userlist, user); | |
922 } | |
923 else | |
924 if (user->list_op & (1 << list_id)) | |
925 { | |
926 if (list_id == MSN_LIST_FL) | |
927 { | |
928 if (group_id >= 0) | |
929 if (g_list_find(user->group_ids, | |
930 GINT_TO_POINTER(group_id))) | |
931 return; | |
932 } | |
933 else | |
934 return; | |
935 } | |
936 | |
937 if (group_id >= 0) | |
938 { | |
939 user->group_ids = g_list_append(user->group_ids, | |
940 GINT_TO_POINTER(group_id)); | |
941 } | |
942 | |
943 user->list_op |= (1 << list_id); | |
944 } | |
11992 | 945 #endif |
10044 | 946 |
947 static void | |
9285 | 948 msn_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
949 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
950 MsnSession *session; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
951 MsnUserList *userlist; |
7261 | 952 const char *who; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
953 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
954 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
955 userlist = session->userlist; |
9285 | 956 who = msn_normalize(gc->account, buddy->name); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
957 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
958 if (!session->logged_in) |
10044 | 959 { |
11992 | 960 #if 0 |
10044 | 961 fake_userlist_add_buddy(session->sync_userlist, who, MSN_LIST_FL, |
962 group ? group->name : NULL); | |
11992 | 963 #else |
964 gaim_debug_error("msn", "msn_add_buddy called before connected\n"); | |
965 #endif | |
10044 | 966 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
967 return; |
10044 | 968 } |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
969 |
10044 | 970 #if 0 |
9290
2e5faf12a24c
[gaim-migrate @ 10093]
Christian Hammond <chipx86@chipx86.com>
parents:
9285
diff
changeset
|
971 if (group != NULL && group->name != NULL) |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
972 gaim_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
973 else |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
974 gaim_debug_info("msn", "msn_add_buddy: %s\n", who); |
10044 | 975 #endif |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
976 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
977 #if 0 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
978 /* Which is the max? */ |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
979 if (session->fl_users_count >= 150) |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
980 { |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
981 gaim_debug_info("msn", "Too many buddies\n"); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
982 /* Buddy list full */ |
9285 | 983 /* TODO: gaim should be notified of this */ |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
984 return; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
985 } |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
986 #endif |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
987 |
10044 | 988 /* XXX - Would group ever be NULL here? I don't think so... |
989 * shx: Yes it should; MSN handles non-grouped buddies, and this is only | |
990 * internal. */ | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
991 msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
992 group ? group->name : NULL); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
993 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
994 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
995 static void |
9285 | 996 msn_rem_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
997 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
998 MsnSession *session; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
999 MsnUserList *userlist; |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1000 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1001 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1002 userlist = session->userlist; |
9091
97a1fb329cd2
[gaim-migrate @ 9868]
Christian Hammond <chipx86@chipx86.com>
parents:
9086
diff
changeset
|
1003 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1004 if (!session->logged_in) |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1005 return; |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1006 |
9285 | 1007 /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ |
1008 msn_userlist_rem_buddy(userlist, buddy->name, MSN_LIST_FL, group->name); | |
2086 | 1009 } |
1010 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1011 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1012 msn_add_permit(GaimConnection *gc, const char *who) |
2086 | 1013 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1014 MsnSession *session; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1015 MsnUserList *userlist; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1016 MsnUser *user; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1017 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1018 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1019 userlist = session->userlist; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1020 user = msn_userlist_find_user(userlist, who); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1021 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1022 if (!session->logged_in) |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1023 return; |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1024 |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1025 if (user != NULL && user->list_op & MSN_LIST_BL_OP) |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1026 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1027 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1028 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1029 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1030 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1031 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1032 msn_add_deny(GaimConnection *gc, const char *who) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1033 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1034 MsnSession *session; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1035 MsnUserList *userlist; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1036 MsnUser *user; |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1037 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1038 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1039 userlist = session->userlist; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1040 user = msn_userlist_find_user(userlist, who); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1041 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1042 if (!session->logged_in) |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1043 return; |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1044 |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1045 if (user != NULL && user->list_op & MSN_LIST_AL_OP) |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1046 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1047 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1048 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); |
2086 | 1049 } |
1050 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1051 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1052 msn_rem_permit(GaimConnection *gc, const char *who) |
2086 | 1053 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1054 MsnSession *session; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1055 MsnUserList *userlist; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1056 MsnUser *user; |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1057 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1058 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1059 userlist = session->userlist; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1060 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1061 if (!session->logged_in) |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1062 return; |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1063 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1064 user = msn_userlist_find_user(userlist, who); |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1065 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1066 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); |
2086 | 1067 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1068 if (user != NULL && user->list_op & MSN_LIST_RL_OP) |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1069 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); |
2086 | 1070 } |
1071 | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1072 void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1073 msn_rem_deny(GaimConnection *gc, const char *who) |
2086 | 1074 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1075 MsnSession *session; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1076 MsnUserList *userlist; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1077 MsnUser *user; |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1078 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1079 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1080 userlist = session->userlist; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1081 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1082 if (!session->logged_in) |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1083 return; |
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1084 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1085 user = msn_userlist_find_user(userlist, who); |
2213
a226ebf4be47
[gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2210
diff
changeset
|
1086 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1087 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); |
7563
cb9c3b6d6de9
[gaim-migrate @ 8179]
Christian Hammond <chipx86@chipx86.com>
parents:
7469
diff
changeset
|
1088 |
9363
997c28571364
[gaim-migrate @ 10171]
Christian Hammond <chipx86@chipx86.com>
parents:
9318
diff
changeset
|
1089 if (user != NULL && user->list_op & MSN_LIST_RL_OP) |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1090 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1091 } |
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 void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1094 msn_set_permit_deny(GaimConnection *gc) |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1095 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1096 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1097 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1098 MsnCmdProc *cmdproc; |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1099 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1100 account = gaim_connection_get_account(gc); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1101 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1102 cmdproc = session->notification->cmdproc; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1103 |
8175 | 1104 if (account->perm_deny == GAIM_PRIVACY_ALLOW_ALL || |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1105 account->perm_deny == GAIM_PRIVACY_DENY_USERS) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1106 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1107 msn_cmdproc_send(cmdproc, "BLP", "%s", "AL"); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1108 } |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1109 else |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1110 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1111 msn_cmdproc_send(cmdproc, "BLP", "%s", "BL"); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1112 } |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1113 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1114 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1115 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1116 msn_chat_invite(GaimConnection *gc, int id, const char *msg, |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1117 const char *who) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1118 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1119 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1120 MsnSwitchBoard *swboard; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1121 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1122 session = gc->proto_data; |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1123 |
10621 | 1124 swboard = msn_session_find_swboard_with_id(session, id); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1125 |
10533 | 1126 if (swboard == NULL) |
1127 { | |
1128 /* if we have no switchboard, everyone else left the chat already */ | |
1129 swboard = msn_switchboard_new(session); | |
1130 msn_switchboard_request(swboard); | |
1131 swboard->chat_id = id; | |
1132 swboard->conv = gaim_find_chat(gc, id); | |
1133 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1134 |
10773 | 1135 swboard->flag |= MSN_SB_FLAG_IM; |
1136 | |
10533 | 1137 msn_switchboard_request_add_user(swboard, who); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1138 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1139 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1140 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1141 msn_chat_leave(GaimConnection *gc, int id) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1142 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1143 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1144 MsnSwitchBoard *swboard; |
10621 | 1145 GaimConversation *conv; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1146 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1147 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1148 |
10621 | 1149 swboard = msn_session_find_swboard_with_id(session, id); |
10533 | 1150 |
1151 /* if swboard is NULL we were the only person left anyway */ | |
1152 if (swboard == NULL) | |
1153 return; | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1154 |
10621 | 1155 conv = swboard->conv; |
1156 | |
10773 | 1157 msn_switchboard_release(swboard, MSN_SB_FLAG_IM); |
10621 | 1158 |
1159 /* If other switchboards managed to associate themselves with this | |
1160 * conv, make sure they know it's gone! */ | |
1161 if (conv != NULL) | |
1162 { | |
1163 while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) | |
1164 swboard->conv = NULL; | |
1165 } | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1166 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1167 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1168 static int |
6059 | 1169 msn_chat_send(GaimConnection *gc, int id, const char *message) |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1170 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1171 GaimAccount *account; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1172 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1173 MsnSwitchBoard *swboard; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1174 MsnMessage *msg; |
8922 | 1175 char *msgformat; |
1176 char *msgtext; | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1177 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1178 account = gaim_connection_get_account(gc); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1179 session = gc->proto_data; |
10621 | 1180 swboard = msn_session_find_swboard_with_id(session, id); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1181 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1182 if (swboard == NULL) |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1183 return -EINVAL; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1184 |
10345 | 1185 if (!swboard->ready) |
1186 return 0; | |
10274 | 1187 |
10773 | 1188 swboard->flag |= MSN_SB_FLAG_IM; |
1189 | |
10345 | 1190 msn_import_html(message, &msgformat, &msgtext); |
10274 | 1191 |
10345 | 1192 if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564) |
1193 { | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1194 g_free(msgformat); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1195 g_free(msgtext); |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1196 |
10345 | 1197 return -E2BIG; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1198 } |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1199 |
10345 | 1200 msg = msn_message_new_plain(msgtext); |
1201 msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); | |
10481 | 1202 msn_switchboard_send_msg(swboard, msg, FALSE); |
10345 | 1203 msn_message_destroy(msg); |
1204 | |
1205 g_free(msgformat); | |
1206 g_free(msgtext); | |
1207 | |
1208 serv_got_chat_in(gc, id, gaim_account_get_username(account), 0, | |
1209 message, time(NULL)); | |
1210 | |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1211 return 0; |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1212 } |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1213 |
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1214 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1215 msn_keepalive(GaimConnection *gc) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1216 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1217 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1218 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1219 session = gc->proto_data; |
10481 | 1220 |
10602 | 1221 if (!session->http_method) |
1222 { | |
1223 MsnCmdProc *cmdproc; | |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1224 |
10602 | 1225 cmdproc = session->notification->cmdproc; |
1226 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1227 msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL); |
10602 | 1228 } |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1229 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1230 |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1231 static void |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
1232 msn_group_buddy(GaimConnection *gc, const char *who, |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1233 const char *old_group_name, const char *new_group_name) |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1234 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1235 MsnSession *session; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1236 MsnUserList *userlist; |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1237 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1238 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1239 userlist = session->userlist; |
5518
bf2a7a7b739d
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5507
diff
changeset
|
1240 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1241 msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1242 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1243 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1244 static void |
9285 | 1245 msn_rename_group(GaimConnection *gc, const char *old_name, |
1246 GaimGroup *group, GList *moved_buddies) | |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1247 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1248 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1249 MsnCmdProc *cmdproc; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1250 int old_gid; |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1251 const char *enc_new_group_name; |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1252 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1253 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1254 cmdproc = session->notification->cmdproc; |
9285 | 1255 enc_new_group_name = gaim_url_encode(group->name); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1256 |
9285 | 1257 old_gid = msn_userlist_find_group_id(session->userlist, old_name); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1258 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1259 if (old_gid >= 0) |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1260 { |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1261 msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid, |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1262 enc_new_group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1263 } |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1264 else |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1265 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1266 msn_cmdproc_send(cmdproc, "ADG", "%s 0", enc_new_group_name); |
5318
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1267 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1268 } |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1269 |
bd98232872a3
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
1270 static void |
6059 | 1271 msn_convo_closed(GaimConnection *gc, const char *who) |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1272 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1273 MsnSession *session; |
5309
e2e53316a21d
[gaim-migrate @ 5681]
Christian Hammond <chipx86@chipx86.com>
parents:
5221
diff
changeset
|
1274 MsnSwitchBoard *swboard; |
10621 | 1275 GaimConversation *conv; |
6026
01dd6b652c22
[gaim-migrate @ 6476]
Christian Hammond <chipx86@chipx86.com>
parents:
6024
diff
changeset
|
1276 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1277 session = gc->proto_data; |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1278 |
10621 | 1279 swboard = msn_session_find_swboard(session, who); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1280 |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1281 /* |
10602 | 1282 * Don't perform an assertion here. If swboard is NULL, then the |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1283 * switchboard was either closed by the other party, or the person |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1284 * is talking to himself. |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1285 */ |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1286 if (swboard == NULL) |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1287 return; |
4349 | 1288 |
10621 | 1289 conv = swboard->conv; |
1290 | |
10773 | 1291 msn_switchboard_release(swboard, MSN_SB_FLAG_IM); |
10621 | 1292 |
1293 /* If other switchboards managed to associate themselves with this | |
1294 * conv, make sure they know it's gone! */ | |
1295 if (conv != NULL) | |
1296 { | |
1297 while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) | |
1298 swboard->conv = NULL; | |
1299 } | |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1300 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
1301 |
6516 | 1302 static void |
7590
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1303 msn_set_buddy_icon(GaimConnection *gc, const char *filename) |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1304 { |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1305 MsnSession *session; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1306 MsnUser *user; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1307 |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1308 session = gc->proto_data; |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1309 user = session->user; |
7590
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1310 |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1311 msn_user_set_buddy_icon(user, filename); |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1312 |
11992 | 1313 msn_change_status(session); |
7590
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1314 } |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1315 |
3a48ade4f510
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7563
diff
changeset
|
1316 static void |
9285 | 1317 msn_remove_group(GaimConnection *gc, GaimGroup *group) |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6859
diff
changeset
|
1318 { |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1319 MsnSession *session; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1320 MsnCmdProc *cmdproc; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1321 int group_id; |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6859
diff
changeset
|
1322 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1323 session = gc->proto_data; |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1324 cmdproc = session->notification->cmdproc; |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1325 |
9285 | 1326 if ((group_id = msn_userlist_find_group_id(session->userlist, group->name)) >= 0) |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6859
diff
changeset
|
1327 { |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1328 msn_cmdproc_send(cmdproc, "RMG", "%d", group_id); |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6859
diff
changeset
|
1329 } |
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6859
diff
changeset
|
1330 } |
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6859
diff
changeset
|
1331 |
9243 | 1332 static char * |
10044 | 1333 msn_tooltip_info_text(MsnGetInfoData *info_data) |
1334 { | |
1335 GString *s; | |
9510 | 1336 GString *name; |
9243 | 1337 GaimBuddy *b; |
9510 | 1338 const char *p; |
9243 | 1339 |
10044 | 1340 s = g_string_sized_new(80); /* wild guess */ |
1341 | |
9510 | 1342 /* Try to not display the MSN screen name as an email address */ |
1343 p = strrchr(info_data->name, '@'); | |
10044 | 1344 if (p) |
1345 { | |
9510 | 1346 name = g_string_new_len(info_data->name, p - info_data->name); |
1347 g_string_append_printf(name, "@%s", p + 1); | |
10044 | 1348 } |
1349 else | |
1350 { | |
1351 /* This should never happen */ | |
9510 | 1352 name = g_string_new(info_data->name); |
1353 } | |
10044 | 1354 |
9510 | 1355 g_string_printf(s, "<span style=\"font-size: larger\"><b>%s</b></span><br>", |
10044 | 1356 name->str); |
9510 | 1357 g_string_free(name, TRUE); |
9243 | 1358 b = gaim_find_buddy(gaim_connection_get_account(info_data->gc), |
10044 | 1359 info_data->name); |
9243 | 1360 |
10044 | 1361 if (b) |
1362 { | |
9967 | 1363 GaimPresence *presence; |
9243 | 1364 char *statustext = msn_tooltip_text(b); |
10044 | 1365 |
9967 | 1366 presence = gaim_buddy_get_presence(b); |
10044 | 1367 |
1368 if (b->alias && b->alias[0]) | |
1369 { | |
9243 | 1370 char *aliastext = g_markup_escape_text(b->alias, -1); |
1371 g_string_append_printf(s, _("<b>Alias:</b> %s<br>"), aliastext); | |
1372 g_free(aliastext); | |
1373 } | |
10044 | 1374 |
1375 if (b->server_alias) | |
1376 { | |
9243 | 1377 char *nicktext = g_markup_escape_text(b->server_alias, -1); |
9510 | 1378 g_string_append_printf(s, _("<b>%s:</b> "), _("Nickname")); |
9684 | 1379 g_string_append_printf(s, "<font sml=\"msn\">%s</font><br>", |
9243 | 1380 nicktext); |
1381 g_free(nicktext); | |
1382 } | |
10044 | 1383 |
1384 if (statustext) | |
1385 { | |
10093 | 1386 char *tmp; |
1387 tmp = gaim_strreplace((*statustext == '\n' ? statustext + 1 : statustext), | |
1388 "\n", "<br>"); | |
9243 | 1389 g_free(statustext); |
10093 | 1390 g_string_append_printf(s, "%s<br>", tmp); |
1391 g_free(tmp); | |
9243 | 1392 } |
1393 } | |
1394 | |
1395 return g_string_free(s, FALSE); | |
1396 } | |
1397 | |
1398 #if PHOTO_SUPPORT | |
1399 | |
10044 | 1400 static char * |
1401 msn_get_photo_url(const char *url_text) | |
1402 { | |
9243 | 1403 char *p; |
1404 char *it = NULL; | |
1405 | |
1406 p = strstr(url_text, " title=\"Click to see the full-size photo.\">"); | |
1407 | |
10044 | 1408 if (p) |
1409 { | |
9243 | 1410 /* Search backwards for "http://". This is stupid, but it works. */ |
10044 | 1411 for (; !it && p > url_text; p -= 1) |
1412 { | |
1413 if (strncmp(p, "\"http://", 8) == 0) | |
1414 { | |
9243 | 1415 char *q; |
1416 p += 1; /* skip only the " */ | |
1417 q = strchr(p, '"'); | |
10044 | 1418 if (q) |
1419 { | |
9243 | 1420 it = g_strndup(p, q - p); |
1421 } | |
1422 } | |
1423 } | |
1424 } | |
10044 | 1425 |
9243 | 1426 return it; |
1427 } | |
1428 | |
1429 static void msn_got_photo(void *data, const char *url_text, size_t len); | |
1430 | |
1431 #endif | |
1432 | |
6885
66dd420d3d23
[gaim-migrate @ 7431]
Christian Hammond <chipx86@chipx86.com>
parents:
6859
diff
changeset
|
1433 static void |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1434 msn_got_info(void *data, const char *url_text, size_t len) |
6516 | 1435 { |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1436 MsnGetInfoData *info_data = (MsnGetInfoData *)data; |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1437 char *stripped, *p, *q; |
6516 | 1438 char buf[1024]; |
9243 | 1439 char *tooltip_text = NULL; |
6516 | 1440 char *user_url = NULL; |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1441 gboolean found; |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1442 gboolean has_info = FALSE; |
9510 | 1443 const char* title = NULL; |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1444 char *url_buffer; |
7675 | 1445 GString *s; |
1446 int stripped_len; | |
9243 | 1447 #if PHOTO_SUPPORT |
1448 char *photo_url_text = NULL; | |
1449 MsnGetInfoStepTwoData *info2_data = NULL; | |
1450 #endif | |
6516 | 1451 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1452 gaim_debug_info("msn", "In msn_got_info\n"); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1453 |
9243 | 1454 tooltip_text = msn_tooltip_info_text(info_data); |
9510 | 1455 title = _("MSN Profile"); |
9243 | 1456 |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1457 if (url_text == NULL || strcmp(url_text, "") == 0) |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1458 { |
9243 | 1459 g_snprintf(buf, 1024, "<html><body>%s<b>%s</b></body></html>", |
1460 tooltip_text, _("Error retrieving profile")); | |
1461 | |
11533
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11531
diff
changeset
|
1462 gaim_notify_userinfo(info_data->gc, info_data->name, buf, NULL, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1463 |
9243 | 1464 g_free(tooltip_text); |
6516 | 1465 return; |
1466 } | |
1467 | |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1468 url_buffer = g_strdup(url_text); |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1469 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1470 /* If they have a homepage link, MSN masks it such that we need to |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1471 * fetch the url out before gaim_markup_strip_html() nukes it */ |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1472 if ((p = strstr(url_text, |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1473 "Take a look at my </font><A class=viewDesc title=\"")) != NULL) |
6516 | 1474 { |
1475 p += 50; | |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1476 |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1477 if ((q = strchr(p, '"')) != NULL) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1478 user_url = g_strndup(p, q - p); |
6516 | 1479 } |
1480 | |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1481 /* |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1482 * gaim_markup_strip_html() doesn't strip out character entities like |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1483 * and · |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1484 */ |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1485 while ((p = strstr(url_buffer, " ")) != NULL) |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1486 { |
9243 | 1487 *p = ' '; /* Turn 's into ordinary blanks */ |
1488 p += 1; | |
1489 memmove(p, p + 5, strlen(p + 5)); | |
1490 url_buffer[strlen(url_buffer) - 5] = '\0'; | |
6516 | 1491 } |
1492 | |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1493 while ((p = strstr(url_buffer, "·")) != NULL) |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1494 { |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1495 memmove(p, p + 6, strlen(p + 6)); |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1496 url_buffer[strlen(url_buffer) - 6] = '\0'; |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1497 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1498 |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1499 /* Nuke the nasty \r's that just get in the way */ |
11920 | 1500 gaim_str_strip_char(url_buffer, '\r'); |
6516 | 1501 |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
1502 /* MSN always puts in ' for apostrophes...replace them */ |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1503 while ((p = strstr(url_buffer, "'")) != NULL) |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1504 { |
6516 | 1505 *p = '\''; |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1506 memmove(p + 1, p + 5, strlen(p + 5)); |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1507 url_buffer[strlen(url_buffer) - 4] = '\0'; |
6516 | 1508 } |
1509 | |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1510 /* Nuke the html, it's easier than trying to parse the horrid stuff */ |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1511 stripped = gaim_markup_strip_html(url_buffer); |
7675 | 1512 stripped_len = strlen(stripped); |
6516 | 1513 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1514 gaim_debug_misc("msn", "stripped = %p\n", stripped); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1515 gaim_debug_misc("msn", "url_buffer = %p\n", url_buffer); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1516 |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1517 /* Gonna re-use the memory we've already got for url_buffer */ |
7675 | 1518 /* No we're not. */ |
1519 s = g_string_sized_new(strlen(url_buffer)); | |
6516 | 1520 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1521 /* Extract their Name and put it in */ |
7675 | 1522 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
10403 | 1523 "\nName\n", 0, "\t", 0, "Undisclosed", _("Name"), 0, NULL); |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1524 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1525 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1526 has_info = TRUE; |
6516 | 1527 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1528 /* Extract their Age and put it in */ |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1529 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1530 "\tAge\n", 0, "\n", 0, "Undisclosed", _("Age"), 0, NULL); |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1531 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1532 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1533 has_info = TRUE; |
6516 | 1534 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1535 /* Extract their Gender and put it in */ |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1536 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1537 "\nGender\n", 0, "\t", 0, "Undisclosed", _("Gender"), 0, |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1538 NULL); |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1539 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1540 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1541 has_info = TRUE; |
6516 | 1542 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1543 /* Extract their MaritalStatus and put it in */ |
7675 | 1544 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1545 "\tMarital Status\n", 0, "\n", 0, "Undisclosed", |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1546 _("Marital Status"), 0, NULL); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1547 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1548 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1549 has_info = TRUE; |
6516 | 1550 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1551 /* Extract their Location and put it in */ |
7675 | 1552 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1553 "\nLocation\n", 0, "\n", 0, "Undisclosed", _("Location"), 0, |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1554 NULL); |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1555 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1556 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1557 has_info = TRUE; |
6516 | 1558 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1559 /* Extract their Occupation and put it in */ |
7675 | 1560 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1561 " Occupation\n", 6, "\n", 0, "Undisclosed", _("Occupation"), |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1562 0, NULL); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1563 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1564 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1565 has_info = TRUE; |
6516 | 1566 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1567 /* |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1568 * The fields, 'A Little About Me', 'Favorite Things', 'Hobbies |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1569 * and Interests', 'Favorite Quote', and 'My Homepage' may or may |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1570 * not appear, in any combination. However, they do appear in |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1571 * certain order, so we can successively search to pin down the |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1572 * distinct values. |
6516 | 1573 */ |
1574 | |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1575 /* Check if they have A Little About Me */ |
7675 | 1576 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1577 " A Little About Me \n\n", 0, "Favorite Things", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1578 _("A Little About Me"), 0, NULL); |
6516 | 1579 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1580 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1581 { |
7675 | 1582 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1583 " A Little About Me \n\n", 0, "Hobbies and Interests", '\n', |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1584 NULL, _("A Little About Me"), 0, NULL); |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1585 } |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1586 |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1587 if (!found) |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1588 { |
7675 | 1589 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1590 " A Little About Me \n\n", 0, "Favorite Quote", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1591 _("A Little About Me"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1592 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1593 |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1594 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1595 { |
7675 | 1596 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1597 " A Little About Me \n\n", 0, "My Homepage \n\nTake a look", |
1598 '\n', | |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1599 NULL, _("A Little About Me"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1600 } |
6516 | 1601 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1602 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1603 { |
7675 | 1604 gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1605 " A Little About Me \n\n", 0, "last updated", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1606 _("A Little About Me"), 0, NULL); |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1607 } |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1608 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1609 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1610 has_info = TRUE; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1611 |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1612 /* Check if they have Favorite Things */ |
7675 | 1613 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1614 " Favorite Things \n\n", 0, "Hobbies and Interests", '\n', NULL, |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1615 _("Favorite Things"), 0, NULL); |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1616 |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1617 if (!found) |
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1618 { |
7675 | 1619 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1620 " Favorite Things \n\n", 0, "Favorite Quote", '\n', NULL, |
1621 _("Favorite Things"), 0, NULL); | |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1622 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1623 |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1624 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1625 { |
7675 | 1626 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1627 " Favorite Things \n\n", 0, "My Homepage \n\nTake a look", '\n', |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1628 NULL, _("Favorite Things"), 0, NULL); |
6516 | 1629 } |
1630 | |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1631 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1632 { |
7675 | 1633 gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1634 " Favorite Things \n\n", 0, "last updated", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1635 _("Favorite Things"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1636 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1637 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1638 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1639 has_info = TRUE; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1640 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1641 /* Check if they have Hobbies and Interests */ |
7675 | 1642 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1643 " Hobbies and Interests \n\n", 0, "Favorite Quote", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1644 _("Hobbies and Interests"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1645 |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1646 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1647 { |
7675 | 1648 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1649 " Hobbies and Interests \n\n", 0, "My Homepage \n\nTake a look", |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1650 '\n', NULL, _("Hobbies and Interests"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1651 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1652 |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1653 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1654 { |
7675 | 1655 gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1656 " Hobbies and Interests \n\n", 0, "last updated", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1657 _("Hobbies and Interests"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1658 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1659 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1660 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1661 has_info = TRUE; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1662 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1663 /* Check if they have Favorite Quote */ |
7675 | 1664 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1665 "Favorite Quote \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1666 _("Favorite Quote"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1667 |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1668 if (!found) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1669 { |
7675 | 1670 gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1671 "Favorite Quote \n\n", 0, "last updated", '\n', NULL, |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
1672 _("Favorite Quote"), 0, NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1673 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1674 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1675 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1676 has_info = TRUE; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1677 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1678 /* Extract the last updated date and put it in */ |
7675 | 1679 found = gaim_markup_extract_info_field(stripped, stripped_len, s, |
9243 | 1680 " last updated:", 1, "\n", 0, NULL, _("Last Updated"), 0, |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1681 NULL); |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1682 |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1683 if (found) |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1684 has_info = TRUE; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1685 |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1686 /* If we were able to fetch a homepage url earlier, stick it in there */ |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1687 if (user_url != NULL) |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1688 { |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1689 g_snprintf(buf, sizeof(buf), |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1690 "<b>%s:</b><br><a href=\"%s\">%s</a><br>\n", |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1691 _("Homepage"), user_url, user_url); |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1692 |
7675 | 1693 g_string_append(s, buf); |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1694 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1695 g_free(user_url); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1696 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1697 has_info = TRUE; |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1698 } |
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1699 |
9510 | 1700 if (!has_info) |
1701 { | |
1702 /* MSN doesn't actually distinguish between "unknown member" and | |
1703 * a known member with an empty profile. Try to explain this fact. | |
1704 * Note that if we have a nonempty tooltip_text, we know the user | |
1705 * exists. | |
1706 */ | |
1707 char *p = strstr(url_buffer, "Unknown Member </TITLE>"); | |
1708 GaimBuddy *b = gaim_find_buddy | |
1709 (gaim_connection_get_account(info_data->gc), info_data->name); | |
1710 g_string_append_printf(s, "<br><b>%s</b><br>%s<br><br>", | |
1711 _("Error retrieving profile"), | |
1712 ((p && b)? | |
1713 _("The user has not created a public profile."): | |
1714 p? _("MSN reported not being able to find the user's profile. " | |
1715 "This either means that the user does not exist, " | |
1716 "or that the user exists " | |
1717 "but has not created a public profile."): | |
1718 _("Gaim could not find " /* This should never happen */ | |
1719 "any information in the user's profile. " | |
1720 "The user most likely does not exist."))); | |
9243 | 1721 } |
1722 | |
9510 | 1723 /* put a link to the actual profile URL */ |
1724 g_string_append_printf(s, _("<b>%s:</b> "), _("Profile URL")); | |
1725 g_string_append_printf(s, "<br><a href=\"%s%s\">%s%s</a><br>", | |
1726 PROFILE_URL, info_data->name, PROFILE_URL, info_data->name); | |
1727 | |
6859
17514a2f976a
[gaim-migrate @ 7404]
Christian Hammond <chipx86@chipx86.com>
parents:
6858
diff
changeset
|
1728 /* Finish it off, and show it to them */ |
7675 | 1729 g_string_append(s, "</body></html>\n"); |
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1730 |
9243 | 1731 #if PHOTO_SUPPORT |
9569 | 1732 /* Find the URL to the photo; must be before the marshalling [Bug 994207] */ |
1733 photo_url_text = msn_get_photo_url(url_text); | |
9243 | 1734 |
1735 /* Marshall the existing state */ | |
1736 info2_data = g_malloc0(sizeof(MsnGetInfoStepTwoData)); | |
1737 info2_data->info_data = info_data; | |
1738 info2_data->stripped = stripped; | |
1739 info2_data->url_buffer = url_buffer; | |
1740 info2_data->s = s; | |
1741 info2_data->photo_url_text = photo_url_text; | |
1742 info2_data->tooltip_text = tooltip_text; | |
9510 | 1743 info2_data->title = title; |
9243 | 1744 |
1745 /* Try to put the photo in there too, if there's one */ | |
10044 | 1746 if (photo_url_text) |
1747 { | |
9243 | 1748 gaim_url_fetch(photo_url_text, FALSE, NULL, FALSE, msn_got_photo, |
10044 | 1749 info2_data); |
1750 } | |
1751 else | |
1752 { | |
9243 | 1753 /* Emulate a callback */ |
1754 msn_got_photo(info2_data, NULL, 0); | |
1755 } | |
1756 } | |
1757 | |
10044 | 1758 static void |
1759 msn_got_photo(void *data, const char *url_text, size_t len) | |
9243 | 1760 { |
1761 MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)data; | |
1762 int id = -1; | |
1763 | |
1764 /* Unmarshall the saved state */ | |
1765 MsnGetInfoData *info_data = info2_data->info_data; | |
1766 char *stripped = info2_data->stripped; | |
1767 char *url_buffer = info2_data->url_buffer; | |
1768 GString *s = info2_data->s; | |
1769 char *photo_url_text = info2_data->photo_url_text; | |
1770 char *tooltip_text = info2_data->tooltip_text; | |
1771 | |
1772 /* Try to put the photo in there too, if there's one and is readable */ | |
10044 | 1773 if (data && url_text && len != 0) |
1774 { | |
9243 | 1775 if (strstr(url_text, "400 Bad Request") |
10044 | 1776 || strstr(url_text, "403 Forbidden") |
1777 || strstr(url_text, "404 Not Found")) | |
1778 { | |
9243 | 1779 |
1780 gaim_debug_info("msn", "Error getting %s: %s\n", | |
1781 photo_url_text, url_text); | |
10044 | 1782 } |
1783 else | |
1784 { | |
9243 | 1785 char buf[1024]; |
1786 gaim_debug_info("msn", "%s is %d bytes\n", photo_url_text, len); | |
1787 id = gaim_imgstore_add(url_text, len, NULL); | |
1788 g_snprintf(buf, sizeof(buf), "<img id=\"%d\"><br>", id); | |
1789 g_string_prepend(s, buf); | |
1790 } | |
1791 } | |
1792 | |
1793 /* We continue here from msn_got_info, as if nothing has happened */ | |
1794 #endif | |
1795 | |
9510 | 1796 g_string_prepend(s, tooltip_text); |
11533
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11531
diff
changeset
|
1797 gaim_notify_userinfo(info_data->gc, info_data->name, s->str, NULL, NULL); |
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
7015
diff
changeset
|
1798 |
6516 | 1799 g_free(stripped); |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1800 g_free(url_buffer); |
7675 | 1801 g_string_free(s, TRUE); |
9243 | 1802 g_free(tooltip_text); |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1803 g_free(info_data->name); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1804 g_free(info_data); |
9243 | 1805 #if PHOTO_SUPPORT |
1806 g_free(photo_url_text); | |
1807 g_free(info2_data); | |
1808 if (id != -1) | |
1809 gaim_imgstore_unref(id); | |
1810 #endif | |
6516 | 1811 } |
1812 | |
1813 static void | |
1814 msn_get_info(GaimConnection *gc, const char *name) | |
1815 { | |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1816 MsnGetInfoData *data; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1817 char *url; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1818 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1819 data = g_new0(MsnGetInfoData, 1); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1820 data->gc = gc; |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1821 data->name = g_strdup(name); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1822 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1823 url = g_strdup_printf("%s%s", PROFILE_URL, name); |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1824 |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1825 gaim_url_fetch(url, FALSE, |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1826 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1827 TRUE, msn_got_info, data); |
7104
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1828 |
7700a28929bd
[gaim-migrate @ 7669]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1829 g_free(url); |
6516 | 1830 } |
1831 | |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1832 static gboolean msn_load(GaimPlugin *plugin) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1833 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1834 msn_notification_init(); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1835 msn_switchboard_init(); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1836 msn_sync_init(); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1837 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1838 return TRUE; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1839 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1840 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1841 static gboolean msn_unload(GaimPlugin *plugin) |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1842 { |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1843 msn_notification_end(); |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1844 msn_switchboard_end(); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
9158
diff
changeset
|
1845 msn_sync_end(); |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1846 |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1847 return TRUE; |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1848 } |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1849 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1850 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1851 { |
9308 | 1852 OPT_PROTO_MAIL_CHECK, |
9475 | 1853 NULL, /* user_splits */ |
1854 NULL, /* protocol_options */ | |
9555 | 1855 {"png", 0, 0, 96, 96, GAIM_ICON_SCALE_SEND}, /* icon_spec */ |
9475 | 1856 msn_list_icon, /* list_icon */ |
1857 msn_list_emblems, /* list_emblems */ | |
1858 msn_status_text, /* status_text */ | |
1859 msn_tooltip_text, /* tooltip_text */ | |
9951 | 1860 msn_status_types, /* away_states */ |
1861 msn_blist_node_menu, /* blist_node_menu */ | |
9475 | 1862 NULL, /* chat_info */ |
9754 | 1863 NULL, /* chat_info_defaults */ |
9951 | 1864 msn_login, /* login */ |
1865 msn_close, /* close */ | |
9475 | 1866 msn_send_im, /* send_im */ |
1867 NULL, /* set_info */ | |
1868 msn_send_typing, /* send_typing */ | |
1869 msn_get_info, /* get_info */ | |
9967 | 1870 msn_set_status, /* set_away */ |
9475 | 1871 msn_set_idle, /* set_idle */ |
1872 NULL, /* change_passwd */ | |
1873 msn_add_buddy, /* add_buddy */ | |
1874 NULL, /* add_buddies */ | |
1875 msn_rem_buddy, /* remove_buddy */ | |
1876 NULL, /* remove_buddies */ | |
1877 msn_add_permit, /* add_permit */ | |
1878 msn_add_deny, /* add_deny */ | |
1879 msn_rem_permit, /* rem_permit */ | |
1880 msn_rem_deny, /* rem_deny */ | |
9951 | 1881 msn_set_permit_deny, /* set_permit_deny */ |
9475 | 1882 NULL, /* join_chat */ |
1883 NULL, /* reject chat invite */ | |
10463 | 1884 NULL, /* get_chat_name */ |
9475 | 1885 msn_chat_invite, /* chat_invite */ |
1886 msn_chat_leave, /* chat_leave */ | |
1887 NULL, /* chat_whisper */ | |
1888 msn_chat_send, /* chat_send */ | |
1889 msn_keepalive, /* keepalive */ | |
1890 NULL, /* register_user */ | |
1891 NULL, /* get_cb_info */ | |
1892 NULL, /* get_cb_away */ | |
1893 NULL, /* alias_buddy */ | |
1894 msn_group_buddy, /* group_buddy */ | |
1895 msn_rename_group, /* rename_group */ | |
1896 NULL, /* buddy_free */ | |
1897 msn_convo_closed, /* convo_closed */ | |
1898 msn_normalize, /* normalize */ | |
1899 msn_set_buddy_icon, /* set_buddy_icon */ | |
1900 msn_remove_group, /* remove_group */ | |
1901 NULL, /* get_cb_real_name */ | |
1902 NULL, /* set_chat_topic */ | |
1903 NULL, /* find_blist_chat */ | |
1904 NULL, /* roomlist_get_list */ | |
1905 NULL, /* roomlist_cancel */ | |
1906 NULL, /* roomlist_expand_category */ | |
10116 | 1907 msn_can_receive_file, /* can_receive_file */ |
9475 | 1908 msn_send_file /* send_file */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1909 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1910 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1911 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1912 { |
9943 | 1913 GAIM_PLUGIN_MAGIC, |
1914 GAIM_MAJOR_VERSION, | |
1915 GAIM_MINOR_VERSION, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1916 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1917 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1918 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1919 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1920 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1921 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1922 "prpl-msn", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1923 "MSN", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1924 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1925 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1926 N_("MSN Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1927 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1928 N_("MSN Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1929 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6228
diff
changeset
|
1930 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1931 |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1932 msn_load, /**< load */ |
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1933 msn_unload, /**< unload */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1934 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1935 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1936 NULL, /**< ui_info */ |
8808
bbd8cdaf0ad5
[gaim-migrate @ 9570]
Christian Hammond <chipx86@chipx86.com>
parents:
8749
diff
changeset
|
1937 &prpl_info, /**< extra_info */ |
10487 | 1938 NULL, /**< prefs_info */ |
9015 | 1939 msn_actions |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1940 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1941 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5191
diff
changeset
|
1942 static void |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
1943 init_plugin(GaimPlugin *plugin) |
2086 | 1944 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1945 GaimAccountOption *option; |
3572 | 1946 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
1947 option = gaim_account_option_string_new(_("Login server"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1948 MSN_SERVER); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1949 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1950 option); |
3572 | 1951 |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1952 option = gaim_account_option_int_new(_("Port"), "port", 1863); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1953 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5626
diff
changeset
|
1954 option); |
2086 | 1955 |
9158
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1956 option = gaim_account_option_bool_new(_("Use HTTP Method"), |
c30d81b4dd22
[gaim-migrate @ 9942]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
1957 "http_method", FALSE); |
7288
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7277
diff
changeset
|
1958 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7277
diff
changeset
|
1959 option); |
ff9127038a5a
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
7277
diff
changeset
|
1960 |
11321 | 1961 gaim_cmd_register("nudge", "", GAIM_CMD_P_PRPL, |
1962 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY, | |
1963 "prpl-msn", msn_cmd_nudge, | |
1964 _("nudge: nudge a contact to get their attention"), NULL); | |
1965 | |
10487 | 1966 gaim_prefs_remove("/plugins/prpl/msn"); |
2086 | 1967 } |
1968 | |
5793
952710ac6635
[gaim-migrate @ 6218]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
1969 GAIM_INIT_PLUGIN(msn, init_plugin, info); |