annotate libpurple/protocols/msnp9/msn.c @ 23111:718a9c287839

Use up the last padding for PurplePluginProtocolInfo in a way that allows adding newer functions without causing any major version bump. This is based on the changes from the .vv branch. I changed the PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro a little so it can be used for the old as well as the new functions. Someone should confirm this looks OK.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 05 May 2008 06:19:46 +0000
parents 3fee7e01e51c
children bb41bdce8981
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"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
36 #include "state.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
37 #include "util.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
38 #include "cmds.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
39 #include "core.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
40 #include "prpl.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
41 #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
42 #include "version.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
43
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
44 #include "switchboard.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
45 #include "notification.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
46 #include "sync.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
47 #include "slplink.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
48
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
49 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
50 #include "imgstore.h"
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
51 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
52
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
53 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
54 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
55 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
56 const char *passport;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
57
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
58 } MsnMobileData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
59
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
60 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
61 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
62 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
63 char *name;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
64
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
65 } MsnGetInfoData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
66
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
67 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
68 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
69 MsnGetInfoData *info_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
70 char *stripped;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
71 char *url_buffer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
72 PurpleNotifyUserInfo *user_info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
73 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
74
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
75 } MsnGetInfoStepTwoData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
76
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
77 typedef struct
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
78 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
79 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
80 const char *who;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
81 char *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
82 PurpleMessageFlags flags;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
83 time_t when;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
84 } MsnIMData;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
85
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
86 static const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
87 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
88 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
89 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
90 char *tmp;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
91
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
92 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
93
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
94 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
95 (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
96
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
97 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
98 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
99 g_free(tmp);
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 return buf;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
102 }
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 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
105 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
106 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
107 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
108 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
109 MsnSwitchBoard *swboard;
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 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
112 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
113 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
114
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
115 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
116 return FALSE;
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 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
119
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
120 return TRUE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
123 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
124 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
125 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
126 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
127
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
128 if (!list) {
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22043
diff changeset
129 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
130 _("%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
131 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
132
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
133 return list;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
134 }
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 static PurpleCmdRet
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
137 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
138 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
139 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
140 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
141 const gchar *username;
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 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
144
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
145 serv_send_attention(gc, username, MSN_NUDGE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
146
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
147 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
148 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
149
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
150 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
151 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
152 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
153 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
154 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
155 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
156 const char *alias;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
157
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
158 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
159 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
160 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
161
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
162 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
163 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
164 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
165 alias = "";
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 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
168 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
169 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
170 _("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
171 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
174 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
175 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
176 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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
179 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
180 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
181 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
182 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
183 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
184
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
185 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
186 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
187
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
188 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
189 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
190 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
191 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
192 else
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, "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
195 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
196 }
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_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
201 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
202 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
203 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
206 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
207 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
208 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
209 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
210
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
211 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
212 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
213 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
214 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
215 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
218 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
219 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
220 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
221 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
222
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
223 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
224 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
225 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
226 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
227 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
228
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
229 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
230 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
231 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
232 MsnTransaction *trans;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
233 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
234 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
235 MsnPage *page;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
236 char *payload;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
237 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
238
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
239 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
240 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
241
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
242 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
243 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
244
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
245 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
246
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
247 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
248
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
249 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
250
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
251 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
252
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
253 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
254 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
255
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
256 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
257 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
258 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
259 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
260 g_free(data);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
263 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
264 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
265 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
266 g_free(data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
267 }
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 /* -- */
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
272 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
273 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
274 PurpleConnection *gc;
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 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
277
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
278 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
279 _("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
280 "see you as."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
281 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
282 _("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
283 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
284 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
285 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
286 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
289 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
290 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
291 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
292 MsnSession *session;
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 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
295 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
296
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
297 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
298 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
299 _("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
300 _("Cancel"), NULL,
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_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
302 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
303 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
304
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
305 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
306 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
307 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
308 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
309 MsnSession *session;
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 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
312 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
313
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
314 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
315 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
316 _("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
317 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
318 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
319 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
320 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
321
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
322 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
323 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
324 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
325 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
326 MsnSession *session;
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 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
329 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
330
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
331 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
332 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
333 _("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
334 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
335 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
336 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
337 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
338
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
339 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
340 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
341 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
342 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
343
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
344 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
345
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
346 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
347 _("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
348 "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
349 "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
350 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
351 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
352 gc, 3,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
353 _("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
354 _("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
355 _("Cancel"), NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
356 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
359 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
360 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
361 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
362 MsnSession *session;
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 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
366
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
367 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
368 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
369 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
370 _("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
371 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
372 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
373
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
374 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
375 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
378 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
379 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
380 PurpleBuddy *buddy;
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 MsnMobileData *data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
384
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
385 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
386
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
387 buddy = (PurpleBuddy *) node;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
388 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
389
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
390 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
391
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
392 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
393 data->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
394 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
395
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
396 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
397 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
398 _("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
399 _("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
400 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
401 data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
402 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
403
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
404 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
405 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
406 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
407 if (buddy == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
408 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
409 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
410 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
411 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
412
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
413 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
414 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
415 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
416 PurpleBuddy *buddy;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
417 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
418
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
419 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
420 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
421
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
422 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
423
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
424 buddy = (PurpleBuddy *) node;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
425 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
426
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
427 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
428
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
429 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
430 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
431 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
432
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
433 /* 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
434 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
435 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
436 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
437
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
438 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
439 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
440 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
443 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
444 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
445 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
446 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
447 }
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 static PurpleXfer*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
450 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
451 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
452 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
453 MsnSlpLink *slplink;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
454 PurpleXfer *xfer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
455
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
456 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
457
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
458 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
459 if (xfer)
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 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
462
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
463 xfer->data = slplink;
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 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
466 }
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 return xfer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
469 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
470
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
471 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
472 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
473 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
474 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
475
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
476 if (file)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
477 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
478 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
479 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
480 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
481
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
482 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
483 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
484 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
485 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
486 char *normal;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
487 gboolean ret;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
488
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
489 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
490
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
491 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
492
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
493 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
494
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
495 g_free(normal);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
496
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
497 return ret;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
498 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
499
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 * Protocol Plugin ops
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
502 **************************************************************************/
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
503
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
504 static const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
505 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
506 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
507 return "msn";
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
510 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
511 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
512 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
513 PurplePresence *presence;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
514 PurpleStatus *status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
515
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
516 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
517 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
518
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
519 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
520 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
521 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
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 return NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
525 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
528 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
529 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
530 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
531 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
532 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
533
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
534 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
535
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
536
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
537 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
538 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
539 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
540 (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
541 }
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 if (full && user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
544 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
545 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
546 ((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
547 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
548
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
549 /* 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
550 * 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
551 * 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
552 * 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
553 /* 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
554 * 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
555 * 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
556 * 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
557 if (full && user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
558 {
22259
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
559 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
560
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
561 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
562 ((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
563
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
564 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
565 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
566 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
567
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
568 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
569 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
570 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
571
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
572 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
573 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
574 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
575 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
576 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
577
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
578 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
579 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
580 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
581 PurpleStatusType *status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
582 GList *types = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
583
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
584 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
585 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
586 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
587
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
588 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
589 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
590 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
591
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
592 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
593 "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
594 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
595
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
596 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
597 "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
598 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
599
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
600 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
601 "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
602 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
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_AWAY,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
605 "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
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_INVISIBLE,
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_OFFLINE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
613 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
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_MOBILE,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
617 "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
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 return types;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
621 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
622
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
623 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
624 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
625 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
626 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
627 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
628 const char *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
629
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
630 GList *m = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
631 PurplePluginAction *act;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
632
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
633 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
634 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
635 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
636 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
637
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
638 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
639 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
640 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
641
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
642 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
643 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
644 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
645
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
646 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
647 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
648 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
649 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
650
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
651 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
652 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
653 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
654 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
655 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
656
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
657 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
658 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
659 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
660
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
661 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
662 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
663
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
664 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
665 (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
666 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
667 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
668 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
669 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
670 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
671 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
672
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
673 return m;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
674 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
675
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
676 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
677 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
678 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
679 MsnUser *user;
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 GList *m = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
682 PurpleMenuAction *act;
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 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
685
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
686 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
687
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
688 if (user != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
689 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
690 if (user->mobile)
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 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
693 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
694 NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
695 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
696 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
697 }
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 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
700 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
701 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
702 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
703 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
704 NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
705 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
706 }
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 return m;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
711 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
712 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
713 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
714 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
715 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
716 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
717 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
718 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
719 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
720 return NULL;
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 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
723
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
724 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
725 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
726 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
727 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
728 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
729 const char *username;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
730 const char *host;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
731 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
732 int port;
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 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
735
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
736 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
737 {
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
738 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
739 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
740
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
741 _("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
742 "SSL library."));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
743 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
744 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
745
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
746 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
747
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
748 if (http_method)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
749 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
750 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
751 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
752 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
753
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
754 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
755
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
756 gc->proto_data = session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
757 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
758
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
759 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
760
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
761 /* 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
762 /* 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
763 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
764
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
765 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
766 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
767
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
768 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
769 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
770 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
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
771 _("Failed to connect to server."));
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
772 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
775 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
776 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
777 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
778
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
779 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
780
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
781 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
782
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
783 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
784
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
785 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
786 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
787
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
788 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
789 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
790 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
791 MsnIMData *imdata = data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
792 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
793 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
794 g_free(imdata);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
795 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
796 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
797
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
798 static int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
799 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
800 PurpleMessageFlags flags)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
801 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
802 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
803 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
804 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
805 char *msgformat;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
806 char *msgtext;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
807
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
808 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
809
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
810 if (buddy) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
811 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
812 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
813 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
814 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
815 g_free(text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
816 return 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
817 }
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
820 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
821
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
822 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
823 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
824 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
825 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
826
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
827 return -E2BIG;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
828 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
829
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
830 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
831 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
832
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
833 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
834 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
835
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
836 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
837 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
838 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
839 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
840
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
841 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
842 swboard = msn_session_get_swboard(session, who, 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
843
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
844 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
845 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
846 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
847 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
848 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
849 const char *format;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
850 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
851 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
852 * 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
853 * 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
854 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
855 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
856 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
857 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
858
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
859 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
860 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
861 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
862 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
863 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
864 g_free(pre);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
865 g_free(post);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
866
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
867 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
868 imdata->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
869 imdata->who = who;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
870 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
871 imdata->flags = flags;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
872 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
873 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
874 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
875
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
876 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
877
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
878 return 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
879 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
880
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
881 static unsigned int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
882 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
883 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
884 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
885 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
886 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
887 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
888
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
889 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
890 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
891
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
892 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
893 * 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
894 * 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
895 * anything. --KingAnt
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
896 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
897 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
898 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
899
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
900 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
901 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
902 /* 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
903 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
904
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
905 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
906 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
907
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
908 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
909
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
910 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
911 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
912
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
913 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
914
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
915 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
916 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
917 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
918 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
919 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
920 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
921
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
922 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
923
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
924 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
925
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
926 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
927 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
928
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
929 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
930 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
931 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
932 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
933 MsnSession *session;
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 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
936
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
937 if (gc != NULL)
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 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
940 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
941 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
942 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
945 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
946 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
947 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
948
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
949 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
950
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
951 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
952 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
953
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
954 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
955 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
956 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
957 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
958 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
959 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
960 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
961 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
962 int group_id;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
963
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
964 group_id = -1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
965
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
966 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
967 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
968 MsnGroup *group;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
969 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
970 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
971 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
972
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
973 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
974
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
975 if (user == NULL)
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 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
978 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
979 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
980 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
981 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
982 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
983 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
984 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
985 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
986 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
987 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
988 return;
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 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
991 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
992 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
993
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
994 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
995 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
996 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
997 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
998 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
999
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1000 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
1001 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1002 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1003
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1004 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1005 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
1006 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1007 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1008 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1009 const char *who;
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 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
1012 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1013 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
1014
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1015 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
1016 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1017 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1018 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
1019 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
1020 #else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1021 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
1022 #endif
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 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1025 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1026
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1027 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1028 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
1029 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
1030 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1031 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
1032 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1033
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1034 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1035 /* 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
1036 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
1037 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1038 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
1039 /* Buddy list full */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1040 /* 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
1041 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1042 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1043 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1044
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1045 /* 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
1046 * 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
1047 * internal. */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1048 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
1049 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
1050 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1051
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1052 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1053 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
1054 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1055 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1056 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1057
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1058 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
1059 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1060
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1061 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
1062 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1063
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1064 /* 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
1065 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
1066 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1069 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
1070 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1071 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1072 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1073 MsnUser *user;
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 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
1076 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1077 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
1078
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1079 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
1080 return;
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 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
1083 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
1084
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1085 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
1086 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1087
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1088 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1089 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
1090 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1091 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1092 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1093 MsnUser *user;
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 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
1096 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1097 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
1098
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1099 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
1100 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1101
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1102 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
1103 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
1104
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1105 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
1106 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1109 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
1110 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1111 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1112 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1113 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1114
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1115 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
1116 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1117
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1118 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
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 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
1122
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1123 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
1124
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1125 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
1126 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
1127 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1128
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1129 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1130 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
1131 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1132 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1133 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1134 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1135
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1136 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
1137 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1138
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1139 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
1140 return;
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 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
1143
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1144 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
1145
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1146 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
1147 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
1148 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1149
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1150 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1151 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
1152 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1153 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1154 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1155 MsnCmdProc *cmdproc;
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 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
1158 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
1159 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
1160
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1161 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
1162 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
1163 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1164 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
1165 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1166 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1167 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1168 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
1169 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1170 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1171
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1172 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1173 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
1174 const char *who)
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 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1177 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1178
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1179 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
1180
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1181 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
1182
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1183 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1184 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1185 /* 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
1186 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
1187 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
1188 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
1189 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
1190 }
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 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
1193
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1194 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
1195 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1196
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1197 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1198 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
1199 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1200 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1201 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1202 PurpleConversation *conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1203
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1204 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
1205
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1206 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
1207
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1208 /* 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
1209 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1210 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1211
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1212 conv = swboard->conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1213
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1214 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
1215
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1216 /* 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
1217 * 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
1218 if (conv != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1219 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1220 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
1221 swboard->conv = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1222 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1223 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1224
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1225 static int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1226 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
1227 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1228 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1229 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1230 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1231 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1232 char *msgformat;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1233 char *msgtext;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1234
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1235 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
1236 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
1237 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
1238
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1239 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1240 return -EINVAL;
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 if (!swboard->ready)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1243 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1244
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1245 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
1246
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1247 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
1248
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1249 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
1250 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1251 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1252 g_free(msgtext);
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 return -E2BIG;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1257 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
1258 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
1259 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
1260 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
1261
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1262 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1263 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1264
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1265 serv_got_chat_in(gc, id, purple_account_get_username(account), 0,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1266 message, time(NULL));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1267
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1268 return 0;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1271 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1272 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
1273 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1274 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1275
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1276 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
1277
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1278 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
1279 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1280 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1281
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1282 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
1283
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1284 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
1285 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1286 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1289 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
1290 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
1291 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1292 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1293 MsnUserList *userlist;
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 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
1296 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1297
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1298 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
1299 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1302 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
1303 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
1304 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1305 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1306 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1307 int old_gid;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1308 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
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 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
1312 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
1313
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1314 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
1315
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1316 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
1317 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1318 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
1319 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
1320 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1321 else
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 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
1324 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1325 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1328 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
1329 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1330 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1331 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1332 PurpleConversation *conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1333
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1334 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
1335
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1336 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
1337
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 * 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
1340 * 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
1341 * 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
1342 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1343 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1344 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1345
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1346 conv = swboard->conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1347
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1348 /* 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
1349 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
1350 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
1351 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
1352 /* 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
1353 swboard->conv = NULL;
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 /* 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
1356 * 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
1357 if (conv != NULL)
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 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
1360 swboard->conv = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1361 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1362 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1363
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1364 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1365 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
1366 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1367 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1368 MsnUser *user;
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 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
1371 user = session->user;
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 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
1374
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1375 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
1376 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1379 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
1380 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1381 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1382 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1383 int group_id;
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 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
1386 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
1387
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1388 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
1389 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1390 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
1391 }
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1394 /**
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1395 * 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
1396 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1397 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1398 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
1399 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1400 PurpleBuddy *b;
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 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
1403 info_data->name);
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 if (b)
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 char *tmp;
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 (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
1410 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1411 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
1412 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
1413 g_free(aliastext);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1416 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
1417 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1418 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
1419 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
1420 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
1421 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1422 g_free(nicktext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1423 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1424
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1425 /* 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
1426 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
1427
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1428 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1429 }
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 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1432 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1433
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1434 #if PHOTO_SUPPORT
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 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1437 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
1438 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1439 char *p, *q;
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 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
1442 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1443 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
1444 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1445
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1446 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
1447 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
1448
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1449 return NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1450 }
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 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
1453 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
1454
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1455 #endif
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 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1458 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
1459 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1460 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
1461 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
1462
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1463 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1464 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
1465 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1466 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1467
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1468 #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
1469 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
1470 "\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
1471 if (found) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1472 sect_info = TRUE;
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 #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
1475 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
1476 "\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
1477 if (found) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1478 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1479
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1480 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1481 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
1482 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1483 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
1484 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
1485 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
1486 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
1487 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1488
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1489 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1490 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
1491 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
1492 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1493 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
1494 PurpleNotifyUserInfo *user_info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1495 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
1496 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
1497 gboolean found;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1498 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
1499 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
1500 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
1501 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
1502 char *url_buffer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1503 int stripped_len;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1504 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1505 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
1506 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
1507 #endif
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 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
1510
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1511 /* 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
1512 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
1513 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1514 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
1515 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
1516 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
1517 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1520 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
1521 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
1522
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1523 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
1524 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1525 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
1526 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
1527 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1528
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1529 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
1530 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
1531
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1532 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
1533 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
1534 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1537 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
1538
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1539 /* 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
1540 * 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
1541 /* 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
1542 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
1543 "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
1544 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1545 p += 50;
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 ((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
1548 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
1549 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1550
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1551 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1552 * 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
1553 * and &#183;
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 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
1556 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1557 *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
1558 p += 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1559 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
1560 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
1561 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1562
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1563 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
1564 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1565 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
1566 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
1567 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1568
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1569 /* 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
1570 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
1571
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1572 /* 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
1573 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
1574 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1575 *p = '\'';
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1576 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
1577 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
1578 }
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 /* 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
1581 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
1582 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
1583
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1584 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
1585 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
1586
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1587 /* General section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1588 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
1589 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
1590
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1591 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
1592
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1593 /* 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
1594 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
1595
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1596 /* General */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1597 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
1598 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
1599 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
1600 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
1601 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
1602
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1603 /* 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
1604 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
1605 "\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
1606 "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
1607 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1608
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1609 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1610 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1611
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1612 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
1613
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1614 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1615 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1616 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1617 sect_info = FALSE;
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 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1620 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1621 /* 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
1622 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
1623 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
1624 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
1625 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1626
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1627 /* Social */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1628 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
1629 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
1630
22433
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1631 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
1632 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
1633 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
1634 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
1635 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
1636 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
1637 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
1638 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
1639 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
1640
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1641 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1642 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1643 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1644 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1645 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1646 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1647 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1648 /* 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
1649 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
1650 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
1651 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1652
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1653 /* Contact Info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1654 /* Personal */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1655 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
1656 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
1657 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
1658
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1659 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
1660 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
1661 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
1662 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
1663 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
1664 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
1665 MSN_GOT_INFO_GET_FIELD("Home fax", _("Home Fax"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1666 MSN_GOT_INFO_GET_FIELD("Personal e-mail", _("Personal E-Mail"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1667 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
1668 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
1669 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
1670 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
1671
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1672 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1673 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1674 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1675 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1676 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
1677 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1678 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1679 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1680 /* 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
1681 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
1682 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1683
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1684 /* Business */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1685 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
1686 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
1687 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
1688 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
1689 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
1690 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
1691 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
1692 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
1693 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
1694 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
1695 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
1696 MSN_GOT_INFO_GET_FIELD("Work fax", _("Work Fax"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1697 MSN_GOT_INFO_GET_FIELD("Work e-mail", _("Work E-Mail"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1698 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
1699 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
1700 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
1701
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1702 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1703 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1704 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1705 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1706 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
1707 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1708 else
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 /* 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
1711 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
1712 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1713
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1714 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
1715 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1716 /* 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
1717 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
1718 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1719
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1720 #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
1721 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1722 * 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
1723 * 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
1724 * 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
1725 * 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
1726 * distinct values.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1727 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1728
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1729 /* 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
1730 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
1731 " 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
1732 _("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
1733
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1734 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1735 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1736 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
1737 " 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
1738 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
1739 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1740
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1741 if (!found)
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 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
1744 " 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
1745 _("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
1746 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1747
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1748 if (!found)
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 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
1751 " 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
1752 '\n',
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1753 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
1754 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1755
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1756 if (!found)
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 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
1759 " 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
1760 _("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
1761 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1762
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1763 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1764 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1765
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1766 /* 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
1767 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
1768 " 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
1769 _("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
1770
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1771 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1772 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1773 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
1774 " 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
1775 _("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
1776 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1777
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1778 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1779 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1780 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
1781 " 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
1782 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
1783 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1784
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1785 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1786 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1787 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
1788 " 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
1789 _("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
1790 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1791
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1792 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1793 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1794
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1795 /* 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
1796 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
1797 " 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
1798 _("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
1799
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1800 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1801 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1802 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
1803 " 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
1804 '\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
1805 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1806
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1807 if (!found)
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 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
1810 " 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
1811 _("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
1812 }
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 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1815 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1816
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1817 /* 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
1818 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
1819 "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
1820 _("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
1821
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1822 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1823 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1824 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
1825 "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
1826 _("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
1827 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1828
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1829 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1830 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1831
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1832 /* 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
1833 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
1834 " 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
1835 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
1836
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1837 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1838 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1839 #endif
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 /* 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
1842 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
1843 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1844 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
1845 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
1846 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1847 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
1848
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1849 has_info = TRUE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1852 if (!has_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1853 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1854 /* 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
1855 * 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
1856 * 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
1857 * exists.
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 /* 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
1860 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
1861 * 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
1862 /* 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
1863 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
1864 * 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
1865 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
1866 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
1867 (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
1868 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
1869 ((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
1870 (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
1871 "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
1872 "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
1873 "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
1874 _("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
1875 "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
1876 "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
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 /* 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
1880 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
1881 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
1882 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
1883 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1884
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1885 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1886 /* 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
1887 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
1888
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1889 /* 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
1890 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
1891 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
1892 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
1893 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
1894 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
1895 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
1896
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1897 /* 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
1898 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
1899 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1900 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
1901 info2_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1902 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1903 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1904 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1905 /* Emulate a callback */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1906 /* TODO: Huh? */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1907 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
1908 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1909 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1912 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
1913 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
1914 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1915 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
1916 int id = -1;
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 /* 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
1919 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
1920 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
1921 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
1922 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
1923 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
1924
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1925 /* 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
1926 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
1927 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
1928 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1929 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
1930 g_free(stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1931 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
1932 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
1933 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
1934 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
1935 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
1936 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
1937
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1938 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1941 /* 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
1942 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
1943 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1944 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
1945 || 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
1946 || 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
1947 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1948
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1949 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
1950 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
1951 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1952 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1953 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1954 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
1955 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
1956 " 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
1957 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
1958 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
1959 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
1960 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1961 }
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 /* 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
1964 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1965 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
1966
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1967 g_free(stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1968 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
1969 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
1970 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
1971 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
1972 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1973 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
1974 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
1975 if (id != -1)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1976 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
1977 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1978 }
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 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1981 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
1982 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1983 MsnGetInfoData *data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1984 char *url;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1985
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1986 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
1987 data->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1988 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
1989
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1990 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
1991
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1992 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
1993 "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
1994 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
1995
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1996 g_free(url);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1997 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1998
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1999 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
2000 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2001 msn_notification_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2002 msn_switchboard_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2003 msn_sync_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2004
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2005 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2006 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2007
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2008 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
2009 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2010 msn_notification_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2011 msn_switchboard_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2012 msn_sync_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2013
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2014 return TRUE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2017 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
2018 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2019 PurpleAccount *acct = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2020
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2021 /* 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
2022 if (acct_id) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2023 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
2024 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
2025 acct = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2026 } 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
2027 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
2028 while (l) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2029 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
2030 && 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
2031 acct = l->data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2032 break;
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 l = l->next;
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 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2037
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2038 return acct;
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 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
2042 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2043 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
2044 PurpleAccount *acct;
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 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
2047 return FALSE;
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 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
2050
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2051 if (!acct)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2052 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2053
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2054 /* 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
2055 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
2056 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
2057 if (sname) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2058 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
2059 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
2060 if (conv == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2061 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
2062 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
2063 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2064 /*else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2065 **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
2066 * 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
2067 pidgindialogs_im();*/
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 TRUE;
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 /* 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
2072 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
2073 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
2074 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
2075 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2076 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2077
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2078 return FALSE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2081
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2082 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
2083 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2084 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
2085 NULL, /* user_splits */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2086 NULL, /* protocol_options */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2087 {"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
2088 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
2089 NULL, /* list_emblems */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2090 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
2091 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
2092 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
2093 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
2094 NULL, /* chat_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2095 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
2096 msn_login, /* login */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2097 msn_close, /* close */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2098 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
2099 NULL, /* set_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2100 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
2101 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
2102 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
2103 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
2104 NULL, /* change_passwd */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2105 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
2106 NULL, /* add_buddies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2107 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
2108 NULL, /* remove_buddies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2109 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
2110 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
2111 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
2112 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
2113 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
2114 NULL, /* join_chat */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2115 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
2116 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
2117 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
2118 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
2119 NULL, /* chat_whisper */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2120 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
2121 msn_keepalive, /* keepalive */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2122 NULL, /* register_user */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2123 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
2124 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
2125 NULL, /* alias_buddy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2126 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
2127 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
2128 NULL, /* buddy_free */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2129 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
2130 msn_normalize, /* normalize */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2131 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
2132 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
2133 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
2134 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
2135 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
2136 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
2137 NULL, /* roomlist_cancel */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2138 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
2139 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
2140 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
2141 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
2142 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
2143 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
2144 NULL, /* send_raw */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2145 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
2146 NULL, /* unregister_user */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2147 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
2148 msn_attention_types, /* attention_types */
22895
01e375e9b681 disapproval of revision '8086f2cffaab6ed17431381836b9227a64a53270'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22894
diff changeset
2149
23111
718a9c287839 Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23107
diff changeset
2150 sizeof(PurplePluginProtocolInfo), /* struct_size */
21312
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2153 static PurplePluginInfo info =
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2154 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2155 PURPLE_PLUGIN_MAGIC,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2156 PURPLE_MAJOR_VERSION,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2157 PURPLE_MINOR_VERSION,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2158 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
2159 NULL, /**< ui_requirement */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2160 0, /**< flags */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2161 NULL, /**< dependencies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2162 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
2163
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2164 "prpl-msn", /**< id */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2165 "MSN", /**< name */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2166 DISPLAY_VERSION, /**< version */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2167 /** summary */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2168 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
2169 /** description */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2170 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
2171 "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
2172 PURPLE_WEBSITE, /**< homepage */
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 msn_load, /**< load */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2175 msn_unload, /**< unload */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2176 NULL, /**< destroy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2177
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2178 NULL, /**< ui_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2179 &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
2180 NULL, /**< prefs_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2181 msn_actions,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2182
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2183 /* padding */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2184 NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2185 NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2186 NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2187 NULL
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2188 };
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2189
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2190 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2191 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
2192 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2193 PurpleAccountOption *option;
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 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
2196 MSN_SERVER);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2197 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
2198 option);
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 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
2201 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
2202 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2203
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2204 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
2205 "http_method", FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2206 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
2207 option);
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 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
2210 "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
2211 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
2212 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2213
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2214 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
2215 "custom_smileys", TRUE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2216 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
2217 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2218
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2219 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
2220 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
2221 "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
2222 _("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
2223
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2224 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
2225
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2226 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
2227 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
2228 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2229
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
2230 PURPLE_INIT_PLUGIN(msnp9, init_plugin, info);