annotate src/protocols/msn/msn.c @ 10738:55af3fa46329

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