annotate libpurple/protocols/msnp9/msn.c @ 29689:42360009f2e5

propagate from branch 'im.pidgin.pidgin' (head 6836b6429243a0b1f36354530521dda81b509fb5) to branch 'im.pidgin.cpw.attention_ui' (head fef03d6a94e8ed3398f8e3590ad8fca7916e2a32)
author Marcus Lundblad <ml@update.uu.se>
date Mon, 06 Jul 2009 17:40:06 +0000
parents f541583e31bd ae24e54a5014
children f44718de8b06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1 /**
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2 * @file msn.c The MSN protocol plugin
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
3 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
4 * purple
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
5 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
8 * source distribution.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
9 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
13 * (at your option) any later version.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
14 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
18 * GNU General Public License for more details.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
19 *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
23 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
24 #define PHOTO_SUPPORT 1
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
25
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
26 #include <glib.h>
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
27
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
28 #include "msn.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
29 #include "accountopt.h"
22224
d1b36a8c920a Change some g_idle_add(...) calls in libpurple to purple_timeout_add(0, ...)
Mark Doliner <mark@kingant.net>
parents: 22142
diff changeset
30 #include "eventloop.h"
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
31 #include "msg.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
32 #include "page.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
33 #include "pluginpref.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
34 #include "prefs.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
35 #include "session.h"
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
36 #include "smiley.h"
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
37 #include "state.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
38 #include "util.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
39 #include "cmds.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
40 #include "core.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
41 #include "prpl.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
42 #include "msn-utils.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
43 #include "version.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
44
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
45 #include "switchboard.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
46 #include "notification.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
47 #include "sync.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
48 #include "slplink.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
49
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
50 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
51 #include "imgstore.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
52 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
53
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
54 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
55 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
56 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
57 const char *passport;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
58
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
59 } MsnMobileData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
60
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
61 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
62 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
63 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
64 char *name;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
65
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
66 } MsnGetInfoData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
67
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
68 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
69 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
70 MsnGetInfoData *info_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
71 char *stripped;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
72 char *url_buffer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
73 PurpleNotifyUserInfo *user_info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
74 char *photo_url_text;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
75
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
76 } MsnGetInfoStepTwoData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
77
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
78 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
79 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
80 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
81 const char *who;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
82 char *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
83 PurpleMessageFlags flags;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
84 time_t when;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
85 } MsnIMData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
86
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
87 typedef struct
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
88 {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
89 char *smile;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
90 MsnObject *obj;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
91 } MsnEmoticon;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
92
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
93 static const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
94 msn_normalize(const PurpleAccount *account, const char *str)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
95 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
96 static char buf[BUF_LEN];
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
97 char *tmp;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
98
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
99 g_return_val_if_fail(str != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
100
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
101 g_snprintf(buf, sizeof(buf), "%s%s", str,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
102 (strchr(str, '@') ? "" : "@hotmail.com"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
103
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
104 tmp = g_utf8_strdown(buf, -1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
105 strncpy(buf, tmp, sizeof(buf));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
106 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
107
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
108 return buf;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
109 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
110
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
111 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
112 msn_send_attention(PurpleConnection *gc, const char *username, guint type)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
113 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
114 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
115 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
116 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
117
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
118 msg = msn_message_new_nudge();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
119 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
120 swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
121
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
122 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
123 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
124
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
125 msn_switchboard_send_msg(swboard, msg, TRUE);
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
126 msn_message_destroy(msg);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
127
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
128 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
129 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
130
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
131 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
132 msn_attention_types(PurpleAccount *account)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
133 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
134 static GList *list = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
135
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
136 if (!list) {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22043
diff changeset
137 list = g_list_append(list, purple_attention_type_new("Nudge", _("Nudge"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22043
diff changeset
138 _("%s has nudged you!"), _("Nudging %s...")));
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
139 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
140
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
141 return list;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
142 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
143
23112
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
144 static GHashTable *
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
145 msn_get_account_text_table(PurpleAccount *unused)
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
146 {
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
147 GHashTable *table;
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
148
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
149 table = g_hash_table_new(g_str_hash, g_str_equal);
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
150
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 23154
diff changeset
151 g_hash_table_insert(table, "login_label", (gpointer)_("Email Address..."));
23112
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
152
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
153 return table;
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
154 }
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
155
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
156 static PurpleCmdRet
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
157 msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
158 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
159 PurpleAccount *account = purple_conversation_get_account(conv);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
160 PurpleConnection *gc = purple_account_get_connection(account);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
161 const gchar *username;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
162
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
163 username = purple_conversation_get_name(conv);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
164
23751
797377cbd5bf Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23182
diff changeset
165 purple_prpl_send_attention(gc, username, MSN_NUDGE);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
166
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
167 return PURPLE_CMD_RET_OK;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
168 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
169
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
170 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
171 msn_act_id(PurpleConnection *gc, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
172 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
173 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
174 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
175 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
176 const char *alias;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
177
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
178 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
179 cmdproc = session->notification->cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
180 account = purple_connection_get_account(gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
181
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
182 if(entry && strlen(entry))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
183 alias = purple_url_encode(entry);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
184 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
185 alias = "";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
186
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
187 if (strlen(alias) > BUDDY_ALIAS_MAXLEN)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
188 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
189 purple_notify_error(gc, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
190 _("Your new MSN friendly name is too long."), NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
191 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
192 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
193
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
194 msn_cmdproc_send(cmdproc, "REA", "%s %s",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
195 purple_account_get_username(account),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
196 alias);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
197 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
198
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
199 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
200 msn_set_prp(PurpleConnection *gc, const char *type, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
201 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
202 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
203 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
204
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
205 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
206 cmdproc = session->notification->cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
207
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
208 if (entry == NULL || *entry == '\0')
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
209 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
210 msn_cmdproc_send(cmdproc, "PRP", "%s", type);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
211 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
212 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
213 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
214 msn_cmdproc_send(cmdproc, "PRP", "%s %s", type,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
215 purple_url_encode(entry));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
216 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
217 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
218
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
219 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
220 msn_set_home_phone_cb(PurpleConnection *gc, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
221 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
222 msn_set_prp(gc, "PHH", entry);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
223 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
224
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
225 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
226 msn_set_work_phone_cb(PurpleConnection *gc, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
227 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
228 msn_set_prp(gc, "PHW", entry);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
229 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
230
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
231 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
232 msn_set_mobile_phone_cb(PurpleConnection *gc, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
233 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
234 msn_set_prp(gc, "PHM", entry);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
235 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
236
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
237 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
238 enable_msn_pages_cb(PurpleConnection *gc)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
239 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
240 msn_set_prp(gc, "MOB", "Y");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
241 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
242
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
243 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
244 disable_msn_pages_cb(PurpleConnection *gc)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
245 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
246 msn_set_prp(gc, "MOB", "N");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
247 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
248
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
249 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
250 send_to_mobile(PurpleConnection *gc, const char *who, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
251 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
252 MsnTransaction *trans;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
253 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
254 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
255 MsnPage *page;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
256 char *payload;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
257 size_t payload_len;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
258
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
259 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
260 cmdproc = session->notification->cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
261
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
262 page = msn_page_new();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
263 msn_page_set_body(page, entry);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
264
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
265 payload = msn_page_gen_payload(page, &payload_len);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
266
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
267 trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %d", who, payload_len);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
268
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
269 msn_transaction_set_payload(trans, payload, payload_len);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
270
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
271 msn_page_destroy(page);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
272
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
273 msn_cmdproc_send_trans(cmdproc, trans);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
274 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
275
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
276 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
277 send_to_mobile_cb(MsnMobileData *data, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
278 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
279 send_to_mobile(data->gc, data->passport, entry);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
280 g_free(data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
281 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
282
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
283 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
284 close_mobile_page_cb(MsnMobileData *data, const char *entry)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
285 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
286 g_free(data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
287 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
288
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
289 /* -- */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
290
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
291 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
292 msn_show_set_friendly_name(PurplePluginAction *action)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
293 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
294 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
295
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
296 gc = (PurpleConnection *) action->context;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
297
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
298 purple_request_input(gc, NULL, _("Set your friendly name."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
299 _("This is the name that other MSN buddies will "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
300 "see you as."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
301 purple_connection_get_display_name(gc), FALSE, FALSE, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
302 _("OK"), G_CALLBACK(msn_act_id),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
303 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
304 purple_connection_get_account(gc), NULL, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
305 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
306 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
307
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
308 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
309 msn_show_set_home_phone(PurplePluginAction *action)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
310 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
311 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
312 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
313
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
314 gc = (PurpleConnection *) action->context;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
315 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
316
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
317 purple_request_input(gc, NULL, _("Set your home phone number."), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
318 msn_user_get_home_phone(session->user), FALSE, FALSE, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
319 _("OK"), G_CALLBACK(msn_set_home_phone_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
320 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
321 purple_connection_get_account(gc), NULL, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
322 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
323 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
324
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
325 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
326 msn_show_set_work_phone(PurplePluginAction *action)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
327 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
328 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
329 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
330
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
331 gc = (PurpleConnection *) action->context;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
332 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
333
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
334 purple_request_input(gc, NULL, _("Set your work phone number."), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
335 msn_user_get_work_phone(session->user), FALSE, FALSE, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
336 _("OK"), G_CALLBACK(msn_set_work_phone_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
337 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
338 purple_connection_get_account(gc), NULL, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
339 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
340 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
341
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
342 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
343 msn_show_set_mobile_phone(PurplePluginAction *action)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
344 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
345 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
346 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
347
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
348 gc = (PurpleConnection *) action->context;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
349 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
350
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
351 purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
352 msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
353 _("OK"), G_CALLBACK(msn_set_mobile_phone_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
354 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
355 purple_connection_get_account(gc), NULL, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
356 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
357 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
358
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
359 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
360 msn_show_set_mobile_pages(PurplePluginAction *action)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
361 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
362 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
363
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
364 gc = (PurpleConnection *) action->context;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
365
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
366 purple_request_action(gc, NULL, _("Allow MSN Mobile pages?"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
367 _("Do you want to allow or disallow people on "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
368 "your buddy list to send you MSN Mobile pages "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
369 "to your cell phone or other mobile device?"),
22142
1f3f2d2c9a2b A few more "purple_request_action" default action corrections
Mark Doliner <mark@kingant.net>
parents: 22097
diff changeset
370 PURPLE_DEFAULT_ACTION_NONE,
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
371 purple_connection_get_account(gc), NULL, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
372 gc, 3,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
373 _("Allow"), G_CALLBACK(enable_msn_pages_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
374 _("Disallow"), G_CALLBACK(disable_msn_pages_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
375 _("Cancel"), NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
376 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
377
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
378 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
379 msn_show_hotmail_inbox(PurplePluginAction *action)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
380 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
381 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
382 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
383
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
384 gc = (PurpleConnection *) action->context;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
385 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
386
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
387 if (session->passport_info.file == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
388 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
389 purple_notify_error(gc, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
390 _("This Hotmail account may not be active."), NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
391 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
392 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
393
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
394 purple_notify_uri(gc, session->passport_info.file);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
395 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
396
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
397 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
398 show_send_to_mobile_cb(PurpleBlistNode *node, gpointer ignored)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
399 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
400 PurpleBuddy *buddy;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
401 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
402 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
403 MsnMobileData *data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
404
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
405 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
406
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
407 buddy = (PurpleBuddy *) node;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
408 gc = purple_account_get_connection(buddy->account);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
409
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
410 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
411
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
412 data = g_new0(MsnMobileData, 1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
413 data->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
414 data->passport = buddy->name;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
415
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
416 purple_request_input(gc, NULL, _("Send a mobile message."), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
417 NULL, TRUE, FALSE, NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
418 _("Page"), G_CALLBACK(send_to_mobile_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
419 _("Close"), G_CALLBACK(close_mobile_page_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
420 purple_connection_get_account(gc), purple_buddy_get_name(buddy), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
421 data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
422 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
423
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
424 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
425 msn_offline_message(const PurpleBuddy *buddy) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
426 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
427 if (buddy == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
428 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
429 user = buddy->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
430 return user && user->mobile;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
431 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
432
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
433 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
434 initiate_chat_cb(PurpleBlistNode *node, gpointer data)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
435 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
436 PurpleBuddy *buddy;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
437 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
438
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
439 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
440 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
441
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
442 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
443
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
444 buddy = (PurpleBuddy *) node;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
445 gc = purple_account_get_connection(buddy->account);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
446
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
447 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
448
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
449 swboard = msn_switchboard_new(session);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
450 msn_switchboard_request(swboard);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
451 msn_switchboard_request_add_user(swboard, buddy->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
452
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
453 /* TODO: This might move somewhere else, after USR might be */
22043
23fef20a0ef2 Use a unique chat id across all sessions for multi-user chats, probably
Stu Tomlinson <stu@nosnilmot.com>
parents: 21673
diff changeset
454 swboard->chat_id = msn_switchboard_get_chat_id();
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
455 swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
456 swboard->flag = MSN_SB_FLAG_IM;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
457
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
458 purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
459 purple_account_get_username(buddy->account), NULL, PURPLE_CBFLAGS_NONE, TRUE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
460 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
461
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
462 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
463 t_msn_xfer_init(PurpleXfer *xfer)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
464 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
465 MsnSlpLink *slplink = xfer->data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
466 msn_slplink_request_ft(slplink, xfer);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
467 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
468
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
469 static PurpleXfer*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
470 msn_new_xfer(PurpleConnection *gc, const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
471 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
472 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
473 MsnSlpLink *slplink;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
474 PurpleXfer *xfer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
475
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
476 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
477
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
478 xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
479 if (xfer)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
480 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
481 slplink = msn_session_get_slplink(session, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
482
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
483 xfer->data = slplink;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
484
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
485 purple_xfer_set_init_fnc(xfer, t_msn_xfer_init);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
486 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
487
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
488 return xfer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
489 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
490
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
491 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
492 msn_send_file(PurpleConnection *gc, const char *who, const char *file)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
493 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
494 PurpleXfer *xfer = msn_new_xfer(gc, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
495
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
496 if (file)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
497 purple_xfer_request_accepted(xfer, file);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
498 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
499 purple_xfer_request(xfer);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
500 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
501
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
502 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
503 msn_can_receive_file(PurpleConnection *gc, const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
504 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
505 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
506 char *normal;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
507 gboolean ret;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
508
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
509 account = purple_connection_get_account(gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
510
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
511 normal = g_strdup(msn_normalize(account, purple_account_get_username(account)));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
512
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
513 ret = strcmp(normal, msn_normalize(account, who));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
514
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
515 g_free(normal);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
516
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
517 return ret;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
518 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
519
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
520 /**************************************************************************
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
521 * Protocol Plugin ops
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
522 **************************************************************************/
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
523
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
524 static const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
525 msn_list_icon(PurpleAccount *a, PurpleBuddy *b)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
526 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
527 return "msn";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
528 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
529
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
530 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
531 msn_status_text(PurpleBuddy *buddy)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
532 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
533 PurplePresence *presence;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
534 PurpleStatus *status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
535
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
536 presence = purple_buddy_get_presence(buddy);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
537 status = purple_presence_get_active_status(presence);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
538
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
539 if (!purple_presence_is_available(presence) && !purple_presence_is_idle(presence))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
540 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
541 return g_strdup(purple_status_get_name(status));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
542 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
543
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
544 return NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
545 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
546
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
547 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
548 msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
549 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
550 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
551 PurplePresence *presence = purple_buddy_get_presence(buddy);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
552 PurpleStatus *status = purple_presence_get_active_status(presence);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
553
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
554 user = buddy->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
555
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
556
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
557 if (purple_presence_is_online(presence))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
558 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
559 purple_notify_user_info_add_pair(user_info, _("Status"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
560 (purple_presence_is_idle(presence) ? _("Idle") : purple_status_get_name(status)));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
561 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
562
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
563 if (full && user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
564 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
565 purple_notify_user_info_add_pair(user_info, _("Has you"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
566 ((user->list_op & (1 << MSN_LIST_RL)) ? _("Yes") : _("No")));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
567 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
568
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
569 /* XXX: This is being shown in non-full tooltips because the
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
570 * XXX: blocked icon overlay isn't always accurate for MSN.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
571 * XXX: This can die as soon as purple_privacy_check() knows that
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
572 * XXX: this prpl always honors both the allow and deny lists. */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
573 /* While the above comment may be strictly correct (the privacy API needs
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
574 * rewriteing), purple_privacy_check() is going to be more accurate at
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
575 * indicating whether a particular buddy is going to be able to message
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
576 * you, which is the important information that this is trying to convey. */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
577 if (full && user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
578 {
22259
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
579 const char *phone;
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
580
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
581 purple_notify_user_info_add_pair(user_info, _("Blocked"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
582 ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No")));
22259
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
583
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
584 phone = msn_user_get_home_phone(user);
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
585 if (phone != NULL)
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
586 purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone);
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
587
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
588 phone = msn_user_get_work_phone(user);
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
589 if (phone != NULL)
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
590 purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone);
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
591
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
592 phone = msn_user_get_mobile_phone(user);
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
593 if (phone != NULL)
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
594 purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
595 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
596 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
597
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
598 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
599 msn_status_types(PurpleAccount *account)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
600 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
601 PurpleStatusType *status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
602 GList *types = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
603
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
604 status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
605 NULL, NULL, FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
606 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
607
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
608 status = purple_status_type_new_full(PURPLE_STATUS_AWAY,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
609 NULL, NULL, FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
610 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
611
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
612 status = purple_status_type_new_full(PURPLE_STATUS_AWAY,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
613 "brb", _("Be Right Back"), FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
614 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
615
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
616 status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
617 "busy", _("Busy"), FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
618 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
619
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
620 status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
621 "phone", _("On the Phone"), FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
622 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
623
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
624 status = purple_status_type_new_full(PURPLE_STATUS_AWAY,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
625 "lunch", _("Out to Lunch"), FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
626 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
627
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
628 status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
629 NULL, NULL, FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
630 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
631
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
632 status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
633 NULL, NULL, FALSE, TRUE, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
634 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
635
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
636 status = purple_status_type_new_full(PURPLE_STATUS_MOBILE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
637 "mobile", NULL, FALSE, FALSE, TRUE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
638 types = g_list_append(types, status);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
639
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
640 return types;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
641 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
642
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
643 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
644 msn_actions(PurplePlugin *plugin, gpointer context)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
645 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
646 PurpleConnection *gc = (PurpleConnection *)context;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
647 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
648 const char *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
649
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
650 GList *m = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
651 PurplePluginAction *act;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
652
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
653 act = purple_plugin_action_new(_("Set Friendly Name..."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
654 msn_show_set_friendly_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
655 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
656 m = g_list_append(m, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
657
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
658 act = purple_plugin_action_new(_("Set Home Phone Number..."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
659 msn_show_set_home_phone);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
660 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
661
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
662 act = purple_plugin_action_new(_("Set Work Phone Number..."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
663 msn_show_set_work_phone);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
664 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
665
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
666 act = purple_plugin_action_new(_("Set Mobile Phone Number..."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
667 msn_show_set_mobile_phone);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
668 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
669 m = g_list_append(m, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
670
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
671 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
672 act = purple_plugin_action_new(_("Enable/Disable Mobile Devices..."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
673 msn_show_set_mobile_support);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
674 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
675 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
676
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
677 act = purple_plugin_action_new(_("Allow/Disallow Mobile Pages..."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
678 msn_show_set_mobile_pages);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
679 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
680
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
681 account = purple_connection_get_account(gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
682 user = msn_normalize(account, purple_account_get_username(account));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
683
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
684 if ((strstr(user, "@hotmail.") != NULL) ||
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
685 (strstr(user, "@msn.com") != NULL))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
686 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
687 m = g_list_append(m, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
688 act = purple_plugin_action_new(_("Open Hotmail Inbox"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
689 msn_show_hotmail_inbox);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
690 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
691 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
692
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
693 return m;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
694 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
695
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
696 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
697 msn_buddy_menu(PurpleBuddy *buddy)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
698 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
699 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
700
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
701 GList *m = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
702 PurpleMenuAction *act;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
703
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
704 g_return_val_if_fail(buddy != NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
705
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
706 user = buddy->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
707
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
708 if (user != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
709 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
710 if (user->mobile)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
711 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
712 act = purple_menu_action_new(_("Send to Mobile"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
713 PURPLE_CALLBACK(show_send_to_mobile_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
714 NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
715 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
716 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
717 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
718
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
719 if (g_ascii_strcasecmp(buddy->name,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
720 purple_account_get_username(buddy->account)))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
721 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
722 act = purple_menu_action_new(_("Initiate _Chat"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
723 PURPLE_CALLBACK(initiate_chat_cb),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
724 NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
725 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
726 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
727
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
728 return m;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
729 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
730
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
731 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
732 msn_blist_node_menu(PurpleBlistNode *node)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
733 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
734 if(PURPLE_BLIST_NODE_IS_BUDDY(node))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
735 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
736 return msn_buddy_menu((PurpleBuddy *) node);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
737 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
738 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
739 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
740 return NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
741 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
742 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
743
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
744 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
745 msn_login(PurpleAccount *account)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
746 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
747 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
748 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
749 const char *username;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
750 const char *host;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
751 gboolean http_method = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
752 int port;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
753
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
754 gc = purple_account_get_connection(account);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
755
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
756 if (!purple_ssl_is_supported())
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
757 {
21428
73788974b883 Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21312
diff changeset
758 purple_connection_error_reason(gc,
73788974b883 Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21312
diff changeset
759 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
73788974b883 Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21312
diff changeset
760
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
761 _("SSL support is needed for MSN. Please install a supported "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
762 "SSL library."));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
763 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
764 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
765
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
766 http_method = purple_account_get_bool(account, "http_method", FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
767
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
768 if (http_method)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
769 host = purple_account_get_string(account, "http_method_server", MSN_HTTPCONN_SERVER);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
770 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
771 host = purple_account_get_string(account, "server", MSN_SERVER);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
772 port = purple_account_get_int(account, "port", MSN_PORT);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
773
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
774 session = msn_session_new(account);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
775
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
776 gc->proto_data = session;
23133
9aa105267f46 Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23125
diff changeset
777 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR |
29644
0efd688ed086 Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents: 23751
diff changeset
778 PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY |
0efd688ed086 Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents: 23751
diff changeset
779 PURPLE_CONNECTION_ALLOW_ATTENTION;
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
780
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
781 msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
782
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
783 /* Hmm, I don't like this. */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
784 /* XXX shx: Me neither */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
785 username = msn_normalize(account, purple_account_get_username(account));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
786
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
787 if (strcmp(username, purple_account_get_username(account)))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
788 purple_account_set_username(account, username);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
789
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
790 if (!msn_session_connect(session, host, port, http_method))
21428
73788974b883 Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21312
diff changeset
791 purple_connection_error_reason(gc,
73788974b883 Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21312
diff changeset
792 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27463
f541583e31bd More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents: 26434
diff changeset
793 _("Unable to connect"));
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
794 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
795
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
796 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
797 msn_close(PurpleConnection *gc)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
798 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
799 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
800
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
801 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
802
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
803 g_return_if_fail(session != NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
804
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
805 msn_session_destroy(session);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
806
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
807 gc->proto_data = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
808 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
809
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
810 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
811 msn_send_me_im(gpointer data)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
812 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
813 MsnIMData *imdata = data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
814 serv_got_im(imdata->gc, imdata->who, imdata->msg, imdata->flags, imdata->when);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
815 g_free(imdata->msg);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
816 g_free(imdata);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
817 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
818 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
819
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
820 static GString*
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
821 msn_msg_emoticon_add(GString *current, MsnEmoticon *emoticon)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
822 {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
823 MsnObject *obj;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
824 char *strobj;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
825
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
826 if (emoticon == NULL)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
827 return current;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
828
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
829 obj = emoticon->obj;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
830
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
831 if (!obj)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
832 return current;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
833
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
834 strobj = msn_object_to_string(obj);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
835
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
836 if (current)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
837 g_string_append_printf(current, "\t%s\t%s",
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
838 emoticon->smile, strobj);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
839 else {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
840 current = g_string_new("");
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
841 g_string_printf(current,"%s\t%s",
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
842 emoticon->smile, strobj);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
843 }
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
844
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
845 g_free(strobj);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
846
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
847 return current;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
848 }
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
849
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
850 static void
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
851 msn_send_emoticons(MsnSwitchBoard *swboard, GString *body)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
852 {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
853 MsnMessage *msg;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
854
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
855 g_return_if_fail(body != NULL);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
856
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
857 msg = msn_message_new(MSN_MSG_SLP);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
858 msn_message_set_content_type(msg, "text/x-mms-emoticon");
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
859 msn_message_set_flag(msg, 'N');
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
860 msn_message_set_bin_data(msg, body->str, body->len);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
861
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
862 msn_switchboard_send_msg(swboard, msg, TRUE);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
863 msn_message_destroy(msg);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
864 }
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
865
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
866 static void msn_emoticon_destroy(MsnEmoticon *emoticon)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
867 {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
868 if (emoticon->obj)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
869 msn_object_destroy(emoticon->obj);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
870 g_free(emoticon->smile);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
871 g_free(emoticon);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
872 }
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
873
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
874 static GSList* msn_msg_grab_emoticons(const char *msg, const char *username)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
875 {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
876 GSList *list;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
877 GList *smileys;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
878 PurpleSmiley *smiley;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
879 PurpleStoredImage *img;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
880 char *ptr;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
881 MsnEmoticon *emoticon;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
882 int length;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
883
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
884 list = NULL;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
885 smileys = purple_smileys_get_all();
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
886 length = strlen(msg);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
887
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
888 for (; smileys; smileys = g_list_delete_link(smileys, smileys)) {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
889 smiley = (PurpleSmiley*)smileys->data;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
890
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
891 ptr = g_strstr_len(msg, length, purple_smiley_get_shortcut(smiley));
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
892
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
893 if (!ptr)
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
894 continue;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
895
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
896 img = purple_smiley_get_stored_image(smiley);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
897
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
898 emoticon = g_new0(MsnEmoticon, 1);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
899 emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley));
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
900 emoticon->obj = msn_object_new_from_image(img,
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
901 purple_imgstore_get_filename(img),
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
902 username, MSN_OBJECT_EMOTICON);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
903
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
904 purple_imgstore_unref(img);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
905 list = g_slist_prepend(list, emoticon);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
906 }
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
907
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
908 return list;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
909 }
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
910
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
911 static int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
912 msn_send_im(PurpleConnection *gc, const char *who, const char *message,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
913 PurpleMessageFlags flags)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
914 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
915 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
916 PurpleBuddy *buddy = purple_find_buddy(gc->account, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
917 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
918 char *msgformat;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
919 char *msgtext;
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
920 const char *username;
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
921
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
922 account = purple_connection_get_account(gc);
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
923 username = purple_account_get_username(account);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
924
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
925 if (buddy) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
926 PurplePresence *p = purple_buddy_get_presence(buddy);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
927 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
928 char *text = purple_markup_strip_html(message);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
929 send_to_mobile(gc, who, text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
930 g_free(text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
931 return 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
932 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
933 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
934
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
935 msn_import_html(message, &msgformat, &msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
936
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
937 if (strlen(msgtext) + strlen(msgformat) + strlen(DISPLAY_VERSION) > 1564)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
938 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
939 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
940 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
941
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
942 return -E2BIG;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
943 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
944
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
945 msg = msn_message_new_plain(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
946 msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
947
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
948 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
949 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
950
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
951 if (g_ascii_strcasecmp(who, username))
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
952 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
953 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
954 MsnSwitchBoard *swboard;
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
955 MsnEmoticon *smile;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
956 GSList *smileys;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
957 GString *emoticons = NULL;
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
958
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
959 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
960 swboard = msn_session_get_swboard(session, who, MSN_SB_FLAG_IM);
23125
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
961 smileys = msn_msg_grab_emoticons(message, username);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
962
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
963 while (smileys) {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
964 smile = (MsnEmoticon*)smileys->data;
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
965 emoticons = msn_msg_emoticon_add(emoticons,smile);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
966 msn_emoticon_destroy(smile);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
967 smileys = g_slist_delete_link(smileys, smileys);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
968 }
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
969
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
970 if (emoticons) {
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
971 msn_send_emoticons(swboard, emoticons);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
972 g_string_free(emoticons, TRUE);
981a0bfc3d9d Update patch to add support for sending custom smileys in msnp9. I included some fixes from the msnp14 patch that were not corrected in the patch, and also the fix for setting buddyicons. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22475
diff changeset
973 }
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
974
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
975 msn_switchboard_send_msg(swboard, msg, TRUE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
976 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
977 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
978 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
979 char *body_str, *body_enc, *pre, *post;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
980 const char *format;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
981 MsnIMData *imdata = g_new0(MsnIMData, 1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
982 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
983 * In MSN, you can't send messages to yourself, so
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
984 * we'll fake like we received it ;)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
985 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
986 body_str = msn_message_to_string(msg);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
987 body_enc = g_markup_escape_text(body_str, -1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
988 g_free(body_str);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
989
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
990 format = msn_message_get_attr(msg, "X-MMS-IM-Format");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
991 msn_parse_format(format, &pre, &post);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
992 body_str = g_strdup_printf("%s%s%s", pre ? pre : "",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
993 body_enc ? body_enc : "", post ? post : "");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
994 g_free(body_enc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
995 g_free(pre);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
996 g_free(post);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
997
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
998 serv_got_typing_stopped(gc, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
999 imdata->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1000 imdata->who = who;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1001 imdata->msg = body_str;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1002 imdata->flags = flags;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1003 imdata->when = time(NULL);
22224
d1b36a8c920a Change some g_idle_add(...) calls in libpurple to purple_timeout_add(0, ...)
Mark Doliner <mark@kingant.net>
parents: 22142
diff changeset
1004 purple_timeout_add(0, msn_send_me_im, imdata);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1005 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1006
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1007 msn_message_destroy(msg);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1008
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1009 return 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1010 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1011
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1012 static unsigned int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1013 msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1014 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1015 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1016 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1017 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1018 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1019
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1020 account = purple_connection_get_account(gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1021 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1022
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1023 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1024 * TODO: I feel like this should be "if (state != PURPLE_TYPING)"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1025 * but this is how it was before, and I don't want to break
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1026 * anything. --KingAnt
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1027 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1028 if (state == PURPLE_NOT_TYPING)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1029 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1030
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1031 if (!g_ascii_strcasecmp(who, purple_account_get_username(account)))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1032 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1033 /* We'll just fake it, since we're sending to ourself. */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1034 serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, PURPLE_TYPING);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1035
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1036 return MSN_TYPING_SEND_TIMEOUT;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1037 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1038
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1039 swboard = msn_session_find_swboard(session, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1040
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1041 if (swboard == NULL || !msn_switchboard_can_send(swboard))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1042 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1043
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1044 swboard->flag |= MSN_SB_FLAG_IM;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1045
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1046 msg = msn_message_new(MSN_MSG_TYPING);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1047 msn_message_set_content_type(msg, "text/x-msmsgscontrol");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1048 msn_message_set_flag(msg, 'U');
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1049 msn_message_set_attr(msg, "TypingUser",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1050 purple_account_get_username(account));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1051 msn_message_set_bin_data(msg, "\r\n", 2);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1052
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1053 msn_switchboard_send_msg(swboard, msg, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1054
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1055 msn_message_destroy(msg);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1056
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1057 return MSN_TYPING_SEND_TIMEOUT;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1058 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1059
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1060 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1061 msn_set_status(PurpleAccount *account, PurpleStatus *status)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1062 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1063 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1064 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1065
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1066 gc = purple_account_get_connection(account);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1067
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1068 if (gc != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1069 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1070 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1071 msn_change_status(session);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1072 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1073 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1074
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1075 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1076 msn_set_idle(PurpleConnection *gc, int idle)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1077 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1078 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1079
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1080 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1081
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1082 msn_change_status(session);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1083 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1084
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1085 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1086 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1087 fake_userlist_add_buddy(MsnUserList *userlist,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1088 const char *who, int list_id,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1089 const char *group_name)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1090 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1091 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1092 static int group_id_c = 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1093 int group_id;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1094
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1095 group_id = -1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1096
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1097 if (group_name != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1098 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1099 MsnGroup *group;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1100 group = msn_group_new(userlist, group_id_c, group_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1101 group_id = group_id_c++;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1102 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1103
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1104 user = msn_userlist_find_user(userlist, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1105
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1106 if (user == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1107 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1108 user = msn_user_new(userlist, who, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1109 msn_userlist_add_user(userlist, user);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1110 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1111 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1112 if (user->list_op & (1 << list_id))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1113 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1114 if (list_id == MSN_LIST_FL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1115 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1116 if (group_id >= 0)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1117 if (g_list_find(user->group_ids,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1118 GINT_TO_POINTER(group_id)))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1119 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1120 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1121 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1122 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1123 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1124
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1125 if (group_id >= 0)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1126 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1127 user->group_ids = g_list_append(user->group_ids,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1128 GINT_TO_POINTER(group_id));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1129 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1130
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1131 user->list_op |= (1 << list_id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1132 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1133 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1134
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1135 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1136 msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1137 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1138 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1139 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1140 const char *who;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1141
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1142 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1143 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1144 who = msn_normalize(gc->account, buddy->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1145
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1146 if (!session->logged_in)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1147 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1148 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1149 fake_userlist_add_buddy(session->sync_userlist, who, MSN_LIST_FL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1150 group ? group->name : NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1151 #else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1152 purple_debug_error("msn", "msn_add_buddy called before connected\n");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1153 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1154
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1155 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1156 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1157
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1158 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1159 if (group != NULL && group->name != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1160 purple_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1161 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1162 purple_debug_info("msn", "msn_add_buddy: %s\n", who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1163 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1164
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1165 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1166 /* Which is the max? */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1167 if (session->fl_users_count >= 150)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1168 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1169 purple_debug_info("msn", "Too many buddies\n");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1170 /* Buddy list full */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1171 /* TODO: purple should be notified of this */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1172 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1173 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1174 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1175
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1176 /* XXX - Would group ever be NULL here? I don't think so...
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1177 * shx: Yes it should; MSN handles non-grouped buddies, and this is only
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1178 * internal. */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1179 msn_userlist_add_buddy(userlist, who, MSN_LIST_FL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1180 group ? group->name : NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1181 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1182
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1183 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1184 msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1185 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1186 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1187 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1188
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1189 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1190 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1191
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1192 if (!session->logged_in)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1193 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1194
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1195 /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1196 msn_userlist_rem_buddy(userlist, buddy->name, MSN_LIST_FL, group->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1197 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1198
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1199 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1200 msn_add_permit(PurpleConnection *gc, const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1201 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1202 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1203 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1204 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1205
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1206 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1207 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1208 user = msn_userlist_find_user(userlist, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1209
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1210 if (!session->logged_in)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1211 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1212
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1213 if (user != NULL && user->list_op & MSN_LIST_BL_OP)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1214 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1215
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1216 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1217 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1218
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1219 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1220 msn_add_deny(PurpleConnection *gc, const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1221 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1222 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1223 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1224 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1225
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1226 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1227 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1228 user = msn_userlist_find_user(userlist, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1229
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1230 if (!session->logged_in)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1231 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1232
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1233 if (user != NULL && user->list_op & MSN_LIST_AL_OP)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1234 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1235
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1236 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1237 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1238
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1239 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1240 msn_rem_permit(PurpleConnection *gc, const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1241 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1242 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1243 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1244 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1245
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1246 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1247 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1248
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1249 if (!session->logged_in)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1250 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1251
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1252 user = msn_userlist_find_user(userlist, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1253
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1254 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1255
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1256 if (user != NULL && user->list_op & MSN_LIST_RL_OP)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1257 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1258 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1259
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1260 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1261 msn_rem_deny(PurpleConnection *gc, const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1262 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1263 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1264 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1265 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1266
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1267 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1268 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1269
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1270 if (!session->logged_in)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1271 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1272
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1273 user = msn_userlist_find_user(userlist, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1274
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1275 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1276
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1277 if (user != NULL && user->list_op & MSN_LIST_RL_OP)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1278 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1279 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1280
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1281 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1282 msn_set_permit_deny(PurpleConnection *gc)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1283 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1284 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1285 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1286 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1287
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1288 account = purple_connection_get_account(gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1289 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1290 cmdproc = session->notification->cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1291
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1292 if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL ||
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1293 account->perm_deny == PURPLE_PRIVACY_DENY_USERS)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1294 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1295 msn_cmdproc_send(cmdproc, "BLP", "%s", "AL");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1296 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1297 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1298 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1299 msn_cmdproc_send(cmdproc, "BLP", "%s", "BL");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1300 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1301 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1302
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1303 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1304 msn_chat_invite(PurpleConnection *gc, int id, const char *msg,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1305 const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1306 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1307 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1308 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1309
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1310 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1311
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1312 swboard = msn_session_find_swboard_with_id(session, id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1313
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1314 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1315 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1316 /* if we have no switchboard, everyone else left the chat already */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1317 swboard = msn_switchboard_new(session);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1318 msn_switchboard_request(swboard);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1319 swboard->chat_id = id;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1320 swboard->conv = purple_find_chat(gc, id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1321 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1322
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1323 swboard->flag |= MSN_SB_FLAG_IM;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1324
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1325 msn_switchboard_request_add_user(swboard, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1326 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1327
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1328 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1329 msn_chat_leave(PurpleConnection *gc, int id)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1330 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1331 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1332 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1333 PurpleConversation *conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1334
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1335 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1336
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1337 swboard = msn_session_find_swboard_with_id(session, id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1338
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1339 /* if swboard is NULL we were the only person left anyway */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1340 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1341 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1342
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1343 conv = swboard->conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1344
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1345 msn_switchboard_release(swboard, MSN_SB_FLAG_IM);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1346
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1347 /* If other switchboards managed to associate themselves with this
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1348 * conv, make sure they know it's gone! */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1349 if (conv != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1350 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1351 while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1352 swboard->conv = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1353 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1354 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1355
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1356 static int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1357 msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1358 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1359 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1360 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1361 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1362 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1363 char *msgformat;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1364 char *msgtext;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1365
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1366 account = purple_connection_get_account(gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1367 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1368 swboard = msn_session_find_swboard_with_id(session, id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1369
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1370 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1371 return -EINVAL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1372
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1373 if (!swboard->ready)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1374 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1375
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1376 swboard->flag |= MSN_SB_FLAG_IM;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1377
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1378 msn_import_html(message, &msgformat, &msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1379
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1380 if (strlen(msgtext) + strlen(msgformat) + strlen(DISPLAY_VERSION) > 1564)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1381 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1382 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1383 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1384
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1385 return -E2BIG;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1386 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1387
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1388 msg = msn_message_new_plain(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1389 msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1390 msn_switchboard_send_msg(swboard, msg, FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1391 msn_message_destroy(msg);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1392
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1393 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1394 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1395
23154
caa533b62902 When calling serv_got_chat_in() after sending a group chat message (to let
Evan Schoenberg <evan.s@dreskin.net>
parents: 23144
diff changeset
1396 serv_got_chat_in(gc, id, purple_account_get_username(account), flags,
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1397 message, time(NULL));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1398
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1399 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1400 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1401
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1402 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1403 msn_keepalive(PurpleConnection *gc)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1404 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1405 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1406
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1407 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1408
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1409 if (!session->http_method)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1410 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1411 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1412
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1413 cmdproc = session->notification->cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1414
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1415 msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1416 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1417 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1418
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1419 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1420 msn_group_buddy(PurpleConnection *gc, const char *who,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1421 const char *old_group_name, const char *new_group_name)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1422 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1423 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1424 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1425
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1426 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1427 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1428
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1429 msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1430 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1431
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1432 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1433 msn_rename_group(PurpleConnection *gc, const char *old_name,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1434 PurpleGroup *group, GList *moved_buddies)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1435 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1436 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1437 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1438 int old_gid;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1439 const char *enc_new_group_name;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1440
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1441 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1442 cmdproc = session->notification->cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1443 enc_new_group_name = purple_url_encode(group->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1444
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1445 old_gid = msn_userlist_find_group_id(session->userlist, old_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1446
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1447 if (old_gid >= 0)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1448 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1449 msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1450 enc_new_group_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1451 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1452 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1453 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1454 msn_cmdproc_send(cmdproc, "ADG", "%s 0", enc_new_group_name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1455 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1456 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1457
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1458 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1459 msn_convo_closed(PurpleConnection *gc, const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1460 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1461 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1462 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1463 PurpleConversation *conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1464
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1465 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1466
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1467 swboard = msn_session_find_swboard(session, who);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1468
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1469 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1470 * Don't perform an assertion here. If swboard is NULL, then the
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1471 * switchboard was either closed by the other party, or the person
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1472 * is talking to himself.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1473 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1474 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1475 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1476
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1477 conv = swboard->conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1478
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1479 /* If we release the switchboard here, it may still have messages
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1480 pending ACK which would result in incorrect unsent message errors.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1481 Just let it timeout... This is *so* going to screw with people who
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1482 use dumb clients that report "User has closed the conversation window" */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1483 /* msn_switchboard_release(swboard, MSN_SB_FLAG_IM); */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1484 swboard->conv = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1485
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1486 /* If other switchboards managed to associate themselves with this
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1487 * conv, make sure they know it's gone! */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1488 if (conv != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1489 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1490 while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1491 swboard->conv = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1492 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1493 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1494
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1495 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1496 msn_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1497 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1498 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1499 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1500
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1501 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1502 user = session->user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1503
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1504 msn_user_set_buddy_icon(user, img);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1505
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1506 msn_change_status(session);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1507 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1508
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1509 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1510 msn_remove_group(PurpleConnection *gc, PurpleGroup *group)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1511 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1512 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1513 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1514 int group_id;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1515
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1516 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1517 cmdproc = session->notification->cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1518
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1519 if ((group_id = msn_userlist_find_group_id(session->userlist, group->name)) >= 0)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1520 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1521 msn_cmdproc_send(cmdproc, "RMG", "%d", group_id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1522 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1523 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1524
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1525 /**
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1526 * Extract info text from info_data and add it to user_info
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1527 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1528 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1529 msn_tooltip_extract_info_text(PurpleNotifyUserInfo *user_info, MsnGetInfoData *info_data)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1530 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1531 PurpleBuddy *b;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1532
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1533 b = purple_find_buddy(purple_connection_get_account(info_data->gc),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1534 info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1535
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1536 if (b)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1537 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1538 char *tmp;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1539
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1540 if (b->alias && b->alias[0])
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1541 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1542 char *aliastext = g_markup_escape_text(b->alias, -1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1543 purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1544 g_free(aliastext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1545 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1546
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1547 if (b->server_alias)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1548 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1549 char *nicktext = g_markup_escape_text(b->server_alias, -1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1550 tmp = g_strdup_printf("<font sml=\"msn\">%s</font><br>", nicktext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1551 purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1552 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1553 g_free(nicktext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1554 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1555
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1556 /* Add the tooltip information */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1557 msn_tooltip_text(b, user_info, TRUE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1558
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1559 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1560 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1561
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1562 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1563 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1564
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1565 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1566
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1567 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1568 msn_get_photo_url(const char *url_text)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1569 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1570 char *p, *q;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1571
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1572 if ((p = strstr(url_text, " contactparams:photopreauthurl=\"")) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1573 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1574 p += strlen(" contactparams:photopreauthurl=\"");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1575 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1576
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1577 if (p && (strncmp(p, "http://", 8) == 0) && ((q = strchr(p, '"')) != NULL))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1578 return g_strndup(p, q - p);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1579
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1580 return NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1581 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1582
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1583 static void msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1584 const gchar *url_text, size_t len, const gchar *error_message);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1585
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1586 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1587
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1588 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1589 static char *msn_info_date_reformat(const char *field, size_t len)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1590 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1591 char *tmp = g_strndup(field, len);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1592 time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1593
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1594 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1595 return g_strdup(purple_date_format_short(localtime(&t)));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1596 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1597 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1598
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1599 #define MSN_GOT_INFO_GET_FIELD(a, b) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1600 found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1601 "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, NULL); \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1602 if (found) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1603 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1604
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1605 #define MSN_GOT_INFO_GET_FIELD_NO_SEARCH(a, b) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1606 found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1607 "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, msn_info_strip_search_link); \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1608 if (found) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1609 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1610
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1611 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1612 msn_info_strip_search_link(const char *field, size_t len)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1613 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1614 const char *c;
22433
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1615 if ((c = strstr(field, " (http://")) == NULL)
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1616 return g_strndup(field, len);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1617 return g_strndup(field, c - field);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1618 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1619
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1620 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1621 msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1622 const gchar *url_text, size_t len, const gchar *error_message)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1623 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1624 MsnGetInfoData *info_data = (MsnGetInfoData *)data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1625 PurpleNotifyUserInfo *user_info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1626 char *stripped, *p, *q, *tmp;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1627 char *user_url = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1628 gboolean found;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1629 gboolean has_tooltip_text = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1630 gboolean has_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1631 gboolean sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1632 gboolean has_contact_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1633 char *url_buffer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1634 int stripped_len;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1635 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1636 char *photo_url_text = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1637 MsnGetInfoStepTwoData *info2_data = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1638 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1639
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1640 purple_debug_info("msn", "In msn_got_info\n");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1641
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1642 /* Make sure the connection is still valid */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1643 if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1644 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1645 purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1646 g_free(info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1647 g_free(info_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1648 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1649 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1650
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1651 user_info = purple_notify_user_info_new();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1652 has_tooltip_text = msn_tooltip_extract_info_text(user_info, info_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1653
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1654 if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1655 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1656 tmp = g_strdup_printf("<b>%s</b>", _("Error retrieving profile"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1657 purple_notify_user_info_add_pair(user_info, NULL, tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1658 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1659
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1660 purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1661 purple_notify_user_info_destroy(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1662
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1663 g_free(info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1664 g_free(info_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1665 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1666 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1667
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1668 url_buffer = g_strdup(url_text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1669
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1670 /* If they have a homepage link, MSN masks it such that we need to
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1671 * fetch the url out before purple_markup_strip_html() nukes it */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1672 /* I don't think this works with the new spaces profiles - Stu 3/2/06 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1673 if ((p = strstr(url_text,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1674 "Take a look at my </font><A class=viewDesc title=\"")) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1675 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1676 p += 50;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1677
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1678 if ((q = strchr(p, '"')) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1679 user_url = g_strndup(p, q - p);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1680 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1681
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1682 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1683 * purple_markup_strip_html() doesn't strip out character entities like &nbsp;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1684 * and &#183;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1685 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1686 while ((p = strstr(url_buffer, "&nbsp;")) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1687 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1688 *p = ' '; /* Turn &nbsp;'s into ordinary blanks */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1689 p += 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1690 memmove(p, p + 5, strlen(p + 5));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1691 url_buffer[strlen(url_buffer) - 5] = '\0';
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1692 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1693
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1694 while ((p = strstr(url_buffer, "&#183;")) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1695 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1696 memmove(p, p + 6, strlen(p + 6));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1697 url_buffer[strlen(url_buffer) - 6] = '\0';
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1698 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1699
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1700 /* Nuke the nasty \r's that just get in the way */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1701 purple_str_strip_char(url_buffer, '\r');
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1702
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1703 /* MSN always puts in &#39; for apostrophes...replace them */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1704 while ((p = strstr(url_buffer, "&#39;")) != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1705 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1706 *p = '\'';
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1707 memmove(p + 1, p + 5, strlen(p + 5));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1708 url_buffer[strlen(url_buffer) - 4] = '\0';
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1709 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1710
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1711 /* Nuke the html, it's easier than trying to parse the horrid stuff */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1712 stripped = purple_markup_strip_html(url_buffer);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1713 stripped_len = strlen(stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1714
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1715 purple_debug_misc("msn", "stripped = %p\n", stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1716 purple_debug_misc("msn", "url_buffer = %p\n", url_buffer);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1717
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1718 /* General section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1719 if (has_tooltip_text)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1720 purple_notify_user_info_add_section_break(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1721
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1722 purple_notify_user_info_add_section_header(user_info, _("General"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1723
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1724 /* Extract their Name and put it in */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1725 MSN_GOT_INFO_GET_FIELD("Name", _("Name"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1726
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1727 /* General */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1728 MSN_GOT_INFO_GET_FIELD("Nickname", _("Nickname"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1729 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Age", _("Age"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1730 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Gender", _("Gender"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1731 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Occupation", _("Occupation"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1732 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Location", _("Location"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1733
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1734 /* Extract their Interests and put it in */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1735 found = purple_markup_extract_info_field(stripped, stripped_len, user_info,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1736 "\nInterests\t", 0, " (/default.aspx?page=searchresults", 0,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1737 "Undisclosed", _("Hobbies and Interests") /* _("Interests") */,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1738 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1739
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1740 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1741 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1742
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1743 MSN_GOT_INFO_GET_FIELD("More about me", _("A Little About Me"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1744
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1745 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1746 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1747 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1748 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1749 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1750 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1751 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1752 /* Remove the section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1753 purple_notify_user_info_remove_last_item(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1754 if (has_tooltip_text)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1755 purple_notify_user_info_remove_last_item(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1756 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1757
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1758 /* Social */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1759 purple_notify_user_info_add_section_break(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1760 purple_notify_user_info_add_section_header(user_info, _("Social"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1761
22433
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1762 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Marital status", _("Marital Status"));
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1763 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Interested in", _("Interests"));
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1764 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Pets", _("Pets"));
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1765 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Hometown", _("Hometown"));
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1766 MSN_GOT_INFO_GET_FIELD("Places lived", _("Places Lived"));
22433
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1767 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Fashion", _("Fashion"));
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1768 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Humor", _("Humor"));
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1769 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Music", _("Music"));
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1770 MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Favorite quote", _("Favorite Quote"));
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1771
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1772 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1773 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1774 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1775 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1776 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1777 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1778 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1779 /* Remove the section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1780 purple_notify_user_info_remove_last_item(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1781 purple_notify_user_info_remove_last_item(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1782 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1783
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1784 /* Contact Info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1785 /* Personal */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1786 purple_notify_user_info_add_section_break(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1787 purple_notify_user_info_add_section_header(user_info, _("Contact Info"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1788 purple_notify_user_info_add_section_header(user_info, _("Personal"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1789
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1790 MSN_GOT_INFO_GET_FIELD("Name", _("Name"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1791 MSN_GOT_INFO_GET_FIELD("Significant other", _("Significant Other"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1792 MSN_GOT_INFO_GET_FIELD("Home phone", _("Home Phone"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1793 MSN_GOT_INFO_GET_FIELD("Home phone 2", _("Home Phone 2"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1794 MSN_GOT_INFO_GET_FIELD("Home address", _("Home Address"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1795 MSN_GOT_INFO_GET_FIELD("Personal Mobile", _("Personal Mobile"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1796 MSN_GOT_INFO_GET_FIELD("Home fax", _("Home Fax"));
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 23154
diff changeset
1797 MSN_GOT_INFO_GET_FIELD("Personal email", _("Personal Email"));
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1798 MSN_GOT_INFO_GET_FIELD("Personal IM", _("Personal IM"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1799 MSN_GOT_INFO_GET_FIELD("Birthday", _("Birthday"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1800 MSN_GOT_INFO_GET_FIELD("Anniversary", _("Anniversary"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1801 MSN_GOT_INFO_GET_FIELD("Notes", _("Notes"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1802
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1803 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1804 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1805 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1806 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1807 has_contact_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1808 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1809 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1810 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1811 /* Remove the section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1812 purple_notify_user_info_remove_last_item(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1813 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1814
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1815 /* Business */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1816 purple_notify_user_info_add_section_header(user_info, _("Work"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1817 MSN_GOT_INFO_GET_FIELD("Name", _("Name"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1818 MSN_GOT_INFO_GET_FIELD("Job title", _("Job Title"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1819 MSN_GOT_INFO_GET_FIELD("Company", _("Company"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1820 MSN_GOT_INFO_GET_FIELD("Department", _("Department"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1821 MSN_GOT_INFO_GET_FIELD("Profession", _("Profession"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1822 MSN_GOT_INFO_GET_FIELD("Work phone 1", _("Work Phone"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1823 MSN_GOT_INFO_GET_FIELD("Work phone 2", _("Work Phone 2"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1824 MSN_GOT_INFO_GET_FIELD("Work address", _("Work Address"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1825 MSN_GOT_INFO_GET_FIELD("Work mobile", _("Work Mobile"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1826 MSN_GOT_INFO_GET_FIELD("Work pager", _("Work Pager"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1827 MSN_GOT_INFO_GET_FIELD("Work fax", _("Work Fax"));
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 23154
diff changeset
1828 MSN_GOT_INFO_GET_FIELD("Work email", _("Work Email"));
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1829 MSN_GOT_INFO_GET_FIELD("Work IM", _("Work IM"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1830 MSN_GOT_INFO_GET_FIELD("Start date", _("Start Date"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1831 MSN_GOT_INFO_GET_FIELD("Notes", _("Notes"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1832
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1833 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1834 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1835 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1836 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1837 has_contact_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1838 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1839 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1840 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1841 /* Remove the section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1842 purple_notify_user_info_remove_last_item(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1843 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1844
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1845 if (!has_contact_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1846 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1847 /* Remove the Contact Info section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1848 purple_notify_user_info_remove_last_item(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1849 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1850
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1851 #if 0 /* these probably don't show up any more */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1852 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1853 * The fields, 'A Little About Me', 'Favorite Things', 'Hobbies
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1854 * and Interests', 'Favorite Quote', and 'My Homepage' may or may
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1855 * not appear, in any combination. However, they do appear in
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1856 * certain order, so we can successively search to pin down the
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1857 * distinct values.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1858 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1859
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1860 /* Check if they have A Little About Me */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1861 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1862 " A Little About Me \n\n", 0, "Favorite Things", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1863 _("A Little About Me"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1864
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1865 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1866 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1867 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1868 " A Little About Me \n\n", 0, "Hobbies and Interests", '\n',
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1869 NULL, _("A Little About Me"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1870 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1871
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1872 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1873 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1874 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1875 " A Little About Me \n\n", 0, "Favorite Quote", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1876 _("A Little About Me"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1877 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1878
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1879 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1880 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1881 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1882 " A Little About Me \n\n", 0, "My Homepage \n\nTake a look",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1883 '\n',
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1884 NULL, _("A Little About Me"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1885 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1886
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1887 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1888 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1889 purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1890 " A Little About Me \n\n", 0, "last updated", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1891 _("A Little About Me"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1892 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1893
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1894 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1895 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1896
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1897 /* Check if they have Favorite Things */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1898 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1899 " Favorite Things \n\n", 0, "Hobbies and Interests", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1900 _("Favorite Things"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1901
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1902 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1903 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1904 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1905 " Favorite Things \n\n", 0, "Favorite Quote", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1906 _("Favorite Things"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1907 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1908
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1909 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1910 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1911 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1912 " Favorite Things \n\n", 0, "My Homepage \n\nTake a look", '\n',
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1913 NULL, _("Favorite Things"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1914 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1915
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1916 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1917 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1918 purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1919 " Favorite Things \n\n", 0, "last updated", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1920 _("Favorite Things"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1921 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1922
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1923 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1924 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1925
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1926 /* Check if they have Hobbies and Interests */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1927 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1928 " Hobbies and Interests \n\n", 0, "Favorite Quote", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1929 _("Hobbies and Interests"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1930
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1931 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1932 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1933 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1934 " Hobbies and Interests \n\n", 0, "My Homepage \n\nTake a look",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1935 '\n', NULL, _("Hobbies and Interests"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1936 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1937
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1938 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1939 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1940 purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1941 " Hobbies and Interests \n\n", 0, "last updated", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1942 _("Hobbies and Interests"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1943 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1944
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1945 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1946 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1947
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1948 /* Check if they have Favorite Quote */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1949 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1950 "Favorite Quote \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1951 _("Favorite Quote"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1952
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1953 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1954 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1955 purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1956 "Favorite Quote \n\n", 0, "last updated", '\n', NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1957 _("Favorite Quote"), 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1958 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1959
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1960 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1961 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1962
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1963 /* Extract the last updated date and put it in */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1964 found = purple_markup_extract_info_field(stripped, stripped_len, s,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1965 " last updated:", 1, "\n", 0, NULL, _("Last Updated"), 0,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1966 NULL, msn_info_date_reformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1967
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1968 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1969 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1970 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1971
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1972 /* If we were able to fetch a homepage url earlier, stick it in there */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1973 if (user_url != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1974 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1975 tmp = g_strdup_printf("<a href=\"%s\">%s</a>", user_url, user_url);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1976 purple_notify_user_info_add_pair(user_info, _("Homepage"), tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1977 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1978 g_free(user_url);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1979
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1980 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1981 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1982
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1983 if (!has_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1984 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1985 /* MSN doesn't actually distinguish between "unknown member" and
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1986 * a known member with an empty profile. Try to explain this fact.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1987 * Note that if we have a nonempty tooltip_text, we know the user
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1988 * exists.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1989 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1990 /* This doesn't work with the new spaces profiles - Stu 3/2/06
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1991 char *p = strstr(url_buffer, "Unknown Member </TITLE>");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1992 * This might not work for long either ... */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1993 /* Nope, it failed some time before 5/2/07 :(
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1994 char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\"");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1995 * Let's see how long this one holds out for ... */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1996 char *p = strstr(url_buffer, "<form id=\"profile_form\" name=\"profile_form\" action=\"http&#58;&#47;&#47;spaces.live.com&#47;profile.aspx&#63;cid&#61;0\"");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1997 PurpleBuddy *b = purple_find_buddy
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1998 (purple_connection_get_account(info_data->gc), info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1999 purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2000 ((p && b) ? _("The user has not created a public profile.") :
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2001 (p ? _("MSN reported not being able to find the user's profile. "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2002 "This either means that the user does not exist, "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2003 "or that the user exists "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2004 "but has not created a public profile.") :
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2005 _("Could not find " /* This should never happen */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2006 "any information in the user's profile. "
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2007 "The user most likely does not exist."))));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2008 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2009
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2010 /* put a link to the actual profile URL */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2011 tmp = g_strdup_printf("<a href=\"%s%s\">%s%s</a>",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2012 PROFILE_URL, info_data->name, PROFILE_URL, info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2013 purple_notify_user_info_add_pair(user_info, _("Profile URL"), tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2014 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2015
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2016 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2017 /* Find the URL to the photo; must be before the marshalling [Bug 994207] */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2018 photo_url_text = msn_get_photo_url(url_text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2019
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2020 /* Marshall the existing state */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2021 info2_data = g_malloc0(sizeof(MsnGetInfoStepTwoData));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2022 info2_data->info_data = info_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2023 info2_data->stripped = stripped;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2024 info2_data->url_buffer = url_buffer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2025 info2_data->user_info = user_info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2026 info2_data->photo_url_text = photo_url_text;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2027
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2028 /* Try to put the photo in there too, if there's one */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2029 if (photo_url_text)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2030 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2031 purple_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, msn_got_photo,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2032 info2_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2033 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2034 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2035 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2036 /* Emulate a callback */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2037 /* TODO: Huh? */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2038 msn_got_photo(NULL, info2_data, NULL, 0, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2039 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2040 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2041
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2042 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2043 msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2044 const gchar *url_text, size_t len, const gchar *error_message)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2045 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2046 MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2047 int id = -1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2048
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2049 /* Unmarshall the saved state */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2050 MsnGetInfoData *info_data = info2_data->info_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2051 char *stripped = info2_data->stripped;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2052 char *url_buffer = info2_data->url_buffer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2053 PurpleNotifyUserInfo *user_info = info2_data->user_info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2054 char *photo_url_text = info2_data->photo_url_text;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2055
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2056 /* Make sure the connection is still valid if we got here by fetching a photo url */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2057 if (url_text && (error_message != NULL ||
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2058 g_list_find(purple_connections_get_all(), info_data->gc) == NULL))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2059 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2060 purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2061 g_free(stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2062 g_free(url_buffer);
21673
f9738214f308 Fix a leak I missed when re-importing the old MSNP9 code
Stu Tomlinson <stu@nosnilmot.com>
parents: 21578
diff changeset
2063 purple_notify_user_info_destroy(user_info);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2064 g_free(info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2065 g_free(info_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2066 g_free(photo_url_text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2067 g_free(info2_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2068
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2069 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2070 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2071
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2072 /* Try to put the photo in there too, if there's one and is readable */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2073 if (user_data && url_text && len != 0)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2074 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2075 if (strstr(url_text, "400 Bad Request")
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2076 || strstr(url_text, "403 Forbidden")
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2077 || strstr(url_text, "404 Not Found"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2078 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2079
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2080 purple_debug_info("msn", "Error getting %s: %s\n",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2081 photo_url_text, url_text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2082 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2083 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2084 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2085 char buf[1024];
22475
3225c99785b8 Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents: 22433
diff changeset
2086 purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT
3225c99785b8 Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents: 22433
diff changeset
2087 " bytes\n", photo_url_text, len);
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2088 id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2089 g_snprintf(buf, sizeof(buf), "<img id=\"%d\"><br>", id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2090 purple_notify_user_info_prepend_pair(user_info, NULL, buf);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2091 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2092 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2093
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2094 /* We continue here from msn_got_info, as if nothing has happened */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2095 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2096 purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2097
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2098 g_free(stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2099 g_free(url_buffer);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2100 purple_notify_user_info_destroy(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2101 g_free(info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2102 g_free(info_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2103 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2104 g_free(photo_url_text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2105 g_free(info2_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2106 if (id != -1)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2107 purple_imgstore_unref_by_id(id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2108 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2109 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2110
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2111 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2112 msn_get_info(PurpleConnection *gc, const char *name)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2113 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2114 MsnGetInfoData *data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2115 char *url;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2116
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2117 data = g_new0(MsnGetInfoData, 1);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2118 data->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2119 data->name = g_strdup(name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2120
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2121 url = g_strdup_printf("%s%s", PROFILE_URL, name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2122
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2123 purple_util_fetch_url(url, FALSE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2124 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2125 TRUE, msn_got_info, data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2126
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2127 g_free(url);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2128 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2129
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2130 static gboolean msn_load(PurplePlugin *plugin)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2131 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2132 msn_notification_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2133 msn_switchboard_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2134 msn_sync_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2135
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2136 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2137 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2138
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2139 static gboolean msn_unload(PurplePlugin *plugin)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2140 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2141 msn_notification_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2142 msn_switchboard_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2143 msn_sync_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2144
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2145 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2146 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2147
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2148 static PurpleAccount *find_acct(const char *prpl, const char *acct_id)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2149 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2150 PurpleAccount *acct = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2151
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2152 /* If we have a specific acct, use it */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2153 if (acct_id) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2154 acct = purple_accounts_find(acct_id, prpl);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2155 if (acct && !purple_account_is_connected(acct))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2156 acct = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2157 } else { /* Otherwise find an active account for the protocol */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2158 GList *l = purple_accounts_get_all();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2159 while (l) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2160 if (!strcmp(prpl, purple_account_get_protocol_id(l->data))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2161 && purple_account_is_connected(l->data)) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2162 acct = l->data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2163 break;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2164 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2165 l = l->next;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2166 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2167 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2168
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2169 return acct;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2170 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2171
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2172 static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable *params)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2173 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2174 char *acct_id = g_hash_table_lookup(params, "account");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2175 PurpleAccount *acct;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2176
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2177 if (g_ascii_strcasecmp(proto, "msnim"))
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2178 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2179
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2180 acct = find_acct("prpl-msn", acct_id);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2181
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2182 if (!acct)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2183 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2184
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2185 /* msnim:chat?contact=user@domain.tld */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2186 if (!g_ascii_strcasecmp(cmd, "Chat")) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2187 char *sname = g_hash_table_lookup(params, "contact");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2188 if (sname) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2189 PurpleConversation *conv = purple_find_conversation_with_account(
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2190 PURPLE_CONV_TYPE_IM, sname, acct);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2191 if (conv == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2192 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2193 purple_conversation_present(conv);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2194 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2195 /*else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2196 **If pidgindialogs_im() was in the core, we could use it here.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2197 * It is all purple_request_* based, but I'm not sure it really belongs in the core
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2198 pidgindialogs_im();*/
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2199
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2200 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2201 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2202 /* msnim:add?contact=user@domain.tld */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2203 else if (!g_ascii_strcasecmp(cmd, "Add")) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2204 char *name = g_hash_table_lookup(params, "contact");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2205 purple_blist_request_add_buddy(acct, name, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2206 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2207 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2208
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2209 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2210 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2211
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2212
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2213 static PurplePluginProtocolInfo prpl_info =
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2214 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2215 OPT_PROTO_MAIL_CHECK,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2216 NULL, /* user_splits */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2217 NULL, /* protocol_options */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2218 {"png", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2219 msn_list_icon, /* list_icon */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2220 NULL, /* list_emblems */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2221 msn_status_text, /* status_text */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2222 msn_tooltip_text, /* tooltip_text */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2223 msn_status_types, /* away_states */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2224 msn_blist_node_menu, /* blist_node_menu */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2225 NULL, /* chat_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2226 NULL, /* chat_info_defaults */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2227 msn_login, /* login */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2228 msn_close, /* close */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2229 msn_send_im, /* send_im */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2230 NULL, /* set_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2231 msn_send_typing, /* send_typing */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2232 msn_get_info, /* get_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2233 msn_set_status, /* set_away */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2234 msn_set_idle, /* set_idle */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2235 NULL, /* change_passwd */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2236 msn_add_buddy, /* add_buddy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2237 NULL, /* add_buddies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2238 msn_rem_buddy, /* remove_buddy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2239 NULL, /* remove_buddies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2240 msn_add_permit, /* add_permit */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2241 msn_add_deny, /* add_deny */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2242 msn_rem_permit, /* rem_permit */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2243 msn_rem_deny, /* rem_deny */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2244 msn_set_permit_deny, /* set_permit_deny */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2245 NULL, /* join_chat */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2246 NULL, /* reject chat invite */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2247 NULL, /* get_chat_name */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2248 msn_chat_invite, /* chat_invite */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2249 msn_chat_leave, /* chat_leave */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2250 NULL, /* chat_whisper */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2251 msn_chat_send, /* chat_send */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2252 msn_keepalive, /* keepalive */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2253 NULL, /* register_user */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2254 NULL, /* get_cb_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2255 NULL, /* get_cb_away */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2256 NULL, /* alias_buddy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2257 msn_group_buddy, /* group_buddy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2258 msn_rename_group, /* rename_group */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2259 NULL, /* buddy_free */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2260 msn_convo_closed, /* convo_closed */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2261 msn_normalize, /* normalize */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2262 msn_set_buddy_icon, /* set_buddy_icon */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2263 msn_remove_group, /* remove_group */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2264 NULL, /* get_cb_real_name */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2265 NULL, /* set_chat_topic */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2266 NULL, /* find_blist_chat */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2267 NULL, /* roomlist_get_list */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2268 NULL, /* roomlist_cancel */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2269 NULL, /* roomlist_expand_category */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2270 msn_can_receive_file, /* can_receive_file */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2271 msn_send_file, /* send_file */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2272 msn_new_xfer, /* new_xfer */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2273 msn_offline_message, /* offline_message */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2274 NULL, /* whiteboard_prpl_ops */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2275 NULL, /* send_raw */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2276 NULL, /* roomlist_room_serialize */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2277 NULL, /* unregister_user */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2278 msn_send_attention, /* send_attention */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2279 msn_attention_types, /* attention_types */
23111
718a9c287839 Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23107
diff changeset
2280 sizeof(PurplePluginProtocolInfo), /* struct_size */
23112
bb41bdce8981 Patch from Jaywalker to let prpls add some helpful text for some account
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111
diff changeset
2281 msn_get_account_text_table, /* get_account_text_table */
25657
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
2282 NULL, /* initiate_media */
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25636
diff changeset
2283 NULL /* can_do_media */
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2284 };
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2285
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2286 static PurplePluginInfo info =
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2287 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2288 PURPLE_PLUGIN_MAGIC,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2289 PURPLE_MAJOR_VERSION,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2290 PURPLE_MINOR_VERSION,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2291 PURPLE_PLUGIN_PROTOCOL, /**< type */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2292 NULL, /**< ui_requirement */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2293 0, /**< flags */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2294 NULL, /**< dependencies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2295 PURPLE_PRIORITY_DEFAULT, /**< priority */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2296
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2297 "prpl-msn", /**< id */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2298 "MSN", /**< name */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2299 DISPLAY_VERSION, /**< version */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2300 /** summary */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2301 N_("MSN Protocol Plugin"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2302 /** description */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2303 N_("MSN Protocol Plugin"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2304 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2305 PURPLE_WEBSITE, /**< homepage */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2306
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2307 msn_load, /**< load */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2308 msn_unload, /**< unload */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2309 NULL, /**< destroy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2310
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2311 NULL, /**< ui_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2312 &prpl_info, /**< extra_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2313 NULL, /**< prefs_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2314 msn_actions,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2315
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2316 /* padding */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2317 NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2318 NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2319 NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2320 NULL
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2321 };
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2322
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2323 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2324 init_plugin(PurplePlugin *plugin)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2325 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2326 PurpleAccountOption *option;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2327
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2328 option = purple_account_option_string_new(_("Server"), "server",
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2329 MSN_SERVER);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2330 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2331 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2332
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2333 option = purple_account_option_int_new(_("Port"), "port", 1863);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2334 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2335 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2336
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2337 option = purple_account_option_bool_new(_("Use HTTP Method"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2338 "http_method", FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2339 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2340 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2341
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2342 option = purple_account_option_string_new(_("HTTP Method Server"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2343 "http_method_server", MSN_HTTPCONN_SERVER);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2344 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2345 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2346
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2347 option = purple_account_option_bool_new(_("Show custom smileys"),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2348 "custom_smileys", TRUE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2349 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2350 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2351
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2352 purple_cmd_register("nudge", "", PURPLE_CMD_P_PRPL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2353 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2354 "prpl-msn", msn_cmd_nudge,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2355 _("nudge: nudge a user to get their attention"), NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2356
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2357 purple_prefs_remove("/plugins/prpl/msn");
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2358
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2359 purple_signal_connect(purple_get_core(), "uri-handler", plugin,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2360 PURPLE_CALLBACK(msn_uri_handler), NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2361 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2362
21578
e26890a63ff6 Fixed static linkage of msnp9 in the most straightforward way I could see, which is to have the purple_init_##pluginname##_plugin() function match the directory name, msnp9
Evan Schoenberg <evan.s@dreskin.net>
parents: 21572
diff changeset
2363 PURPLE_INIT_PLUGIN(msnp9, init_plugin, info);