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