annotate libpurple/protocols/msnp9/msn.c @ 23786:e4a4bc86c547

propagate from branch 'im.pidgin.pidgin' (head 119df2055ed7ee5143047b4d18ae81d58c2feac6) to branch 'im.pidgin.pidgin.vv' (head 06ea1dd8fde62c8644d3a64b8f8e8a16d6a14dc9)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 18 Mar 2008 05:40:29 +0000
parents efaecb71baad 3225c99785b8
children 92e71f6e10d4
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
137 static PurpleCmdRet
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
138 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
139 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
140 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
141 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
142 const gchar *username;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
143
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
144 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
145
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
146 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
147
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
148 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
149 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
150
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
151 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
152 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
153 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
154 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
155 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
156 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
157 const char *alias;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
158
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
159 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
160 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
161 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
162
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
163 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
164 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
165 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
166 alias = "";
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
167
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
168 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
169 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
170 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
171 _("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
172 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
175 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
176 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
177 alias);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
180 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
181 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
182 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
183 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
184 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
185
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
186 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
187 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
188
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
189 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
190 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
191 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
192 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
193 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
194 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
195 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
196 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
200 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
201 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
202 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
203 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
204 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
205
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
206 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
207 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
208 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
209 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
210 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
211
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
212 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
213 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
214 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
215 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
216 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
217
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
218 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
219 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
220 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
221 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
222 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
223
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
224 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
225 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
226 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
227 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
228 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
229
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
230 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
231 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
232 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
233 MsnTransaction *trans;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
234 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
235 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
236 MsnPage *page;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
237 char *payload;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
238 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
239
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
240 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
241 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
242
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
243 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
244 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
245
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
246 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
247
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
248 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
249
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
250 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
251
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
252 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
253
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
254 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
255 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
256
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
257 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
258 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
259 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
260 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
261 g_free(data);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
264 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
265 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
266 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
267 g_free(data);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
272 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
273 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
274 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
275 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
276
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
277 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
278
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
279 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
280 _("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
281 "see you as."),
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
282 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
283 _("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
284 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
285 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
286 gc);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
287 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
288
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
289 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
290 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
291 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
292 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
293 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
294
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
295 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
296 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
297
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
298 purple_request_input(gc, NULL, _("Set your 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
299 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
300 _("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
301 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
302 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
303 gc);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
306 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
307 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
308 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
309 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
310 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
311
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
312 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
313 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
314
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
315 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
316 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
317 _("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
318 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
319 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
320 gc);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
323 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
324 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
325 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
326 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
327 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
328
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
329 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
330 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
331
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
332 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
333 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
334 _("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
335 _("Cancel"), NULL,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
336 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
337 gc);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
340 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
341 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
342 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
343 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
344
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
345 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
346
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
347 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
348 _("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
349 "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
350 "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
351 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
352 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
353 gc, 3,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
354 _("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
355 _("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
356 _("Cancel"), NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
357 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
358
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
359 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
360 msn_show_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
361 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
362 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
363 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
364
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
365 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
366 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
367
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
368 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
369 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
370 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
371 _("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
372 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
375 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
376 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
377
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
378 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
379 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
380 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
381 PurpleBuddy *buddy;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
382 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
383 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
384 MsnMobileData *data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
385
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
386 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
387
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
388 buddy = (PurpleBuddy *) node;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
389 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
390
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
391 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
392
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
393 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
394 data->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
395 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
396
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
397 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
398 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
399 _("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
400 _("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
401 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
402 data);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
405 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
406 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
407 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
408 if (buddy == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
409 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
410 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
411 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
412 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
413
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
414 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
415 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
416 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
417 PurpleBuddy *buddy;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
418 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
419
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
420 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
421 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
422
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
423 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
424
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
425 buddy = (PurpleBuddy *) node;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
426 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
427
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
428 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
429
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
430 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
431 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
432 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
433
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
434 /* 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
435 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
436 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
437 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
438
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
439 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
440 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
441 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
442
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
443 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
444 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
445 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
446 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
447 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
448 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
449
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
450 static PurpleXfer*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
451 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
452 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
453 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
454 MsnSlpLink *slplink;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
455 PurpleXfer *xfer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
456
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
457 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
458
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
459 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
460 if (xfer)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
461 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
462 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
463
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
464 xfer->data = slplink;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
465
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
466 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
467 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
468
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
469 return xfer;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
472 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
473 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
474 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
475 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
476
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
477 if (file)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
478 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
479 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
480 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
481 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
482
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
483 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
484 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
485 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
486 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
487 char *normal;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
488 gboolean ret;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
489
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
490 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
491
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
492 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
493
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
494 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
495
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
496 g_free(normal);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
497
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
498 return ret;
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 /**************************************************************************
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
502 * Protocol Plugin ops
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
505 static const char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
506 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
507 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
508 return "msn";
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
511 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
512 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
513 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
514 PurplePresence *presence;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
515 PurpleStatus *status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
516
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
517 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
518 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
519
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
520 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
521 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
522 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
523 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
524
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
525 return NULL;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
528 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
529 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
530 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
531 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
532 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
533 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
534
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
535 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
536
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
537
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
538 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
539 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
540 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
541 (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
542 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
543
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
544 if (full && user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
545 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
546 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
547 ((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
548 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
549
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
550 /* 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
551 * 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
552 * 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
553 * 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
554 /* 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
555 * 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
556 * 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
557 * 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
558 if (full && user)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
559 {
22259
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
560 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
561
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
562 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
563 ((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
564
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
565 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
566 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
567 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
568
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
569 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
570 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
571 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
572
6e5d37105189 Display buddies' phone numbers in the tooltip for MSN buddies if we have
Stu Tomlinson <stu@nosnilmot.com>
parents: 22224
diff changeset
573 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
574 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
575 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
579 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
580 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
581 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
582 PurpleStatusType *status;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
583 GList *types = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
584
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
585 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
586 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
587 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
588
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
589 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
590 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
591 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
592
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
593 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
594 "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
595 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
596
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
597 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
598 "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
599 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
600
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
601 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
602 "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
603 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
604
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
605 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
606 "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
607 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
608
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
609 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
610 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
611 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
612
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
613 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
614 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
615 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
616
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
617 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
618 "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
619 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
620
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
621 return types;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
624 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
625 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
626 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
627 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
628 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
629 const char *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
630
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
631 GList *m = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
632 PurplePluginAction *act;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
633
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
634 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
635 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
636 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
637 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
638
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
639 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
640 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
641 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
642
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
643 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
644 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
645 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
646
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
647 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
648 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
649 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
650 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
651
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
652 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
653 act = purple_plugin_action_new(_("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
654 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
655 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
656 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
657
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
658 act = purple_plugin_action_new(_("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
659 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
660 m = g_list_append(m, act);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
661
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
662 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
663 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
664
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
665 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
666 (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
667 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
668 m = g_list_append(m, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
669 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
670 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
671 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
672 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
673
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
674 return m;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
677 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
678 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
679 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
680 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
681
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
682 GList *m = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
683 PurpleMenuAction *act;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
684
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
685 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
686
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
687 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
688
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
689 if (user != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
690 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
691 if (user->mobile)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
692 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
693 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
694 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
695 NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
696 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
700 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
701 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
702 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
703 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
704 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
705 NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
706 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
707 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
708
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
709 return m;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
712 static GList *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
713 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
714 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
715 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
716 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
717 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
718 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
719 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
720 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
721 return NULL;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
725 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
726 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
727 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
728 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
729 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
730 const char *username;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
731 const char *host;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
732 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
733 int port;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
734
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
735 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
736
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
737 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
738 {
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
739 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
740 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
741
21312
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
742 _("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
743 "SSL library."));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
744 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
747 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
748
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
749 if (http_method)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
750 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
751 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
752 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
753 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
754
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
755 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
756
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
757 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
758 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
759
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
760 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
761
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
762 /* 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
763 /* 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
764 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
765
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
766 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
767 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
768
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
769 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
770 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
771 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
772 _("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
773 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
774
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
775 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
776 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
777 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
778 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
779
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
780 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
781
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
782 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
783
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
784 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
785
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
786 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
787 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
788
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
789 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
790 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
791 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
792 MsnIMData *imdata = data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
793 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
794 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
795 g_free(imdata);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
796 return FALSE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
799 static int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
800 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
801 PurpleMessageFlags flags)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
802 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
803 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
804 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
805 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
806 char *msgformat;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
807 char *msgtext;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
808
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
809 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
810
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
811 if (buddy) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
812 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
813 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
814 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
815 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
816 g_free(text);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
817 return 1;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
821 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
822
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
823 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
824 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
825 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
826 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
827
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
828 return -E2BIG;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
831 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
832 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
833
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
834 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
835 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
836
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
837 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
838 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
839 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
840 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
841
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
842 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
843 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
844
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
845 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
846 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
847 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
848 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
849 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
850 const char *format;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
851 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
852 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
853 * 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
854 * 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
855 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
856 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
857 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
858 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
859
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
860 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
861 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
862 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
863 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
864 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
865 g_free(pre);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
866 g_free(post);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
867
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
868 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
869 imdata->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
870 imdata->who = who;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
871 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
872 imdata->flags = flags;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
873 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
874 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
875 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
876
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
877 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
878
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
879 return 1;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
882 static unsigned int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
883 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
884 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
885 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
886 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
887 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
888 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
889
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
890 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
891 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
892
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
893 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
894 * 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
895 * 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
896 * anything. --KingAnt
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
897 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
898 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
899 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
900
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
901 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
902 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
903 /* 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
904 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
905
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
906 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
907 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
908
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
909 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
910
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
911 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
912 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
913
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
914 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
915
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
916 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
917 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
918 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
919 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
920 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
921 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
922
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
923 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
924
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
925 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
926
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
927 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
928 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
929
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
930 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
931 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
932 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
933 PurpleConnection *gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
934 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
935
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
936 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
937
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
938 if (gc != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
939 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
940 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
941 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
945 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
946 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
947 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
948 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
949
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
950 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
951
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
952 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
953 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
954
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
955 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
956 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
957 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
958 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
959 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
960 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
961 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
962 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
963 int group_id;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
964
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
965 group_id = -1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
966
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
967 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
968 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
969 MsnGroup *group;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
970 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
971 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
972 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
973
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
974 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
975
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
976 if (user == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
977 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
978 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
979 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
980 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
981 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
982 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
983 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
984 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
985 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
986 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
987 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
988 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
989 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
990 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
991 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
992 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
995 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
996 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
997 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
998 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
999 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1000
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1001 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
1002 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1003 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1004
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1005 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1006 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
1007 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1008 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1009 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1010 const char *who;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1011
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1012 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
1013 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1014 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
1015
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1016 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
1017 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1018 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1019 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
1020 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
1021 #else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1022 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
1023 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1024
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1025 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1028 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1029 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
1030 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
1031 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1032 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
1033 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1034
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1035 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1036 /* 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
1037 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
1038 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1039 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
1040 /* Buddy list full */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1041 /* 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
1042 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1043 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1044 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1045
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1046 /* 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
1047 * 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
1048 * internal. */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1049 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
1050 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
1051 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1052
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1053 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1054 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
1055 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1056 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1057 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1058
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1059 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
1060 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1061
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1062 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
1063 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1064
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1065 /* 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
1066 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
1067 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1068
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1069 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1070 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
1071 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1072 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1073 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1074 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1075
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1076 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
1077 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1078 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
1079
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1080 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
1081 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1082
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1083 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
1084 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
1085
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1086 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
1087 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1088
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1089 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1090 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
1091 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1092 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1093 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1094 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1095
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1096 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
1097 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1098 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
1099
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1100 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
1101 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1102
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1103 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
1104 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
1105
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1106 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
1107 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1108
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1109 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1110 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
1111 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1112 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1113 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1114 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1115
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1116 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
1117 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1118
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1119 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
1120 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1121
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1122 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
1123
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1124 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
1125
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1126 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
1127 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
1128 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1129
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1130 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1131 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
1132 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1133 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1134 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1135 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1136
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1137 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
1138 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1139
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1140 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
1141 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1142
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1143 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
1144
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1145 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
1146
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1147 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
1148 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
1149 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1150
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1151 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1152 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
1153 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1154 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1155 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1156 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1157
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1158 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
1159 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
1160 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
1161
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1162 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
1163 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
1164 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1165 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
1166 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1167 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1168 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1169 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1173 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1174 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
1175 const char *who)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1176 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1177 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1178 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1179
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1180 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
1181
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1182 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
1183
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1184 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1185 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1186 /* 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
1187 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
1188 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
1189 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
1190 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
1191 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1192
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1193 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
1194
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1195 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
1196 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1197
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1198 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1199 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
1200 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1201 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1202 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1203 PurpleConversation *conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1204
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1205 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
1206
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1207 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
1208
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1209 /* 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
1210 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1211 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1212
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1213 conv = swboard->conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1214
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1215 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
1216
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1217 /* 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
1218 * 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
1219 if (conv != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1220 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1221 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
1222 swboard->conv = NULL;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1226 static int
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1227 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
1228 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1229 PurpleAccount *account;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1230 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1231 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1232 MsnMessage *msg;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1233 char *msgformat;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1234 char *msgtext;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1235
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1236 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
1237 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
1238 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
1239
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1240 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1241 return -EINVAL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1242
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1243 if (!swboard->ready)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1244 return 0;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1245
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1246 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
1247
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1248 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
1249
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1250 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
1251 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1252 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1253 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1254
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1255 return -E2BIG;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1258 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
1259 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
1260 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
1261 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
1262
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1263 g_free(msgformat);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1264 g_free(msgtext);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1265
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1266 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
1267 message, time(NULL));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1268
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1269 return 0;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1272 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1273 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
1274 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1275 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1276
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1277 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
1278
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1279 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
1280 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1281 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1282
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1283 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
1284
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1285 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1289 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1290 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
1291 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
1292 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1293 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1294 MsnUserList *userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1295
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1296 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
1297 userlist = session->userlist;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1298
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1299 msn_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
1300 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1301
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1302 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1303 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
1304 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
1305 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1306 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1307 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1308 int old_gid;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1309 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
1310
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1311 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
1312 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
1313 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
1314
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1315 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
1316
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1317 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
1318 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1319 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
1320 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
1321 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1322 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1323 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1324 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1328 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1329 msn_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
1330 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1331 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1332 MsnSwitchBoard *swboard;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1333 PurpleConversation *conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1334
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1335 session = gc->proto_data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1336
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1337 swboard = msn_session_find_swboard(session, who);
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 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1340 * 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
1341 * 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
1342 * 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
1343 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1344 if (swboard == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1345 return;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1346
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1347 conv = swboard->conv;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1348
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1349 /* 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
1350 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
1351 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
1352 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
1353 /* 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
1354 swboard->conv = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1355
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1356 /* 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
1357 * 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
1358 if (conv != NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1359 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1360 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
1361 swboard->conv = NULL;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1365 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1366 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
1367 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1368 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1369 MsnUser *user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1370
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1371 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
1372 user = session->user;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1373
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1374 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
1375
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1376 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
1377 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1378
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1379 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1380 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
1381 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1382 MsnSession *session;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1383 MsnCmdProc *cmdproc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1384 int group_id;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1385
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1386 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
1387 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
1388
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1389 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
1390 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1391 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
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 /**
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1396 * 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
1397 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1398 static gboolean
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1399 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
1400 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1401 PurpleBuddy *b;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1402
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1403 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
1404 info_data->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1405
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1406 if (b)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1407 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1408 char *tmp;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1409
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1410 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
1411 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1412 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
1413 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
1414 g_free(aliastext);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1417 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
1418 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1419 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
1420 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
1421 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
1422 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1423 g_free(nicktext);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1426 /* 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
1427 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
1428
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1429 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1430 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1431
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1432 return FALSE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1435 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1436
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1437 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1438 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
1439 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1440 char *p, *q;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1441
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1442 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
1443 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1444 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
1445 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1446
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1447 if (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
1448 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
1449
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1450 return NULL;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1453 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
1454 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
1455
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1456 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1457
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1458 #if 0
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1459 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
1460 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1461 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
1462 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
1463
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1464 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1465 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
1466 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1467 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1468
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1469 #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
1470 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
1471 "\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
1472 if (found) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1473 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1474
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1475 #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
1476 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
1477 "\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
1478 if (found) \
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1479 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1480
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1481 static char *
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1482 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
1483 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1484 const char *c;
22444
616a76954a97 Improve "Get Info" parsing on MSN - ignore all URLs in fields instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 22259
diff changeset
1485 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
1486 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
1487 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
1488 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1489
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1490 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1491 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
1492 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
1493 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1494 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
1495 PurpleNotifyUserInfo *user_info;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1496 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
1497 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
1498 gboolean found;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1499 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
1500 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
1501 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
1502 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
1503 char *url_buffer;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1504 int stripped_len;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1505 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1506 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
1507 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
1508 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1509
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1510 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
1511
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1512 /* 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
1513 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
1514 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1515 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
1516 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
1517 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
1518 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1521 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
1522 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
1523
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1524 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
1525 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1526 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
1527 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
1528 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1529
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1530 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
1531 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
1532
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->name);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1534 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
1535 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1538 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
1539
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1540 /* 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
1541 * 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
1542 /* 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
1543 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
1544 "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
1545 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1546 p += 50;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1547
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1548 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
1549 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
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 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1553 * 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
1554 * and &#183;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1555 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1556 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
1557 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1558 *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
1559 p += 1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1560 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
1561 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
1562 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1563
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1564 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
1565 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1566 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
1567 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
1568 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1569
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1570 /* 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
1571 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
1572
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1573 /* 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
1574 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
1575 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1576 *p = '\'';
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1577 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
1578 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
1579 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1580
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1581 /* 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
1582 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
1583 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
1584
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", "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
1586 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
1587
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1588 /* General section header */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1589 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
1590 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
1591
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1592 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
1593
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1594 /* 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
1595 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
1596
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1597 /* General */
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("Nickname", _("Nickname"));
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("Age", _("Age"));
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("Gender", _("Gender"));
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("Occupation", _("Occupation"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1602 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
1603
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1604 /* 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
1605 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
1606 "\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
1607 "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
1608 0, NULL, NULL);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1609
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1610 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1611 sect_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1612
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1613 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
1614
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1615 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1616 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1617 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1618 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1619 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1620 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1621 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1622 /* 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
1623 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
1624 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
1625 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
1626 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1627
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1628 /* Social */
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_break(user_info);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1630 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
1631
22444
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("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
1633 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
1634 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
1635 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
1636 MSN_GOT_INFO_GET_FIELD("Places lived", _("Places Lived"));
22444
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("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
1638 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
1639 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
1640 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
1641
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1642 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1643 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1644 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1645 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1646 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1647 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1648 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1649 /* 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
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 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
1652 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1653
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1654 /* Contact Info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1655 /* Personal */
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_break(user_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, _("Contact Info"));
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1658 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
1659
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("Name", _("Name"));
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("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
1662 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
1663 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
1664 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
1665 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
1666 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
1667 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
1668 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
1669 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
1670 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
1671 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
1672
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1673 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1674 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1675 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1676 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1677 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
1678 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1679 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1680 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1681 /* 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
1682 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
1683 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1684
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1685 /* Business */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1686 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
1687 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
1688 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
1689 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
1690 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
1691 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
1692 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
1693 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
1694 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
1695 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
1696 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
1697 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
1698 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
1699 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
1700 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
1701 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
1702
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1703 if (sect_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1704 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1705 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1706 sect_info = FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1707 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
1708 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1709 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1710 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1711 /* 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
1712 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
1713 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1714
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1715 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
1716 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1717 /* 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
1718 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
1719 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1720
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1721 #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
1722 /*
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1723 * 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
1724 * 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
1725 * 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
1726 * 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
1727 * distinct values.
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1730 /* 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
1731 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
1732 " 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
1733 _("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
1734
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1735 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1736 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1737 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
1738 " 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
1739 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
1740 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1741
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1742 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1743 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1744 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
1745 " 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
1746 _("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
1747 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1748
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1749 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1750 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1751 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
1752 " 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
1753 '\n',
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1754 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
1755 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1756
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1757 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1758 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1759 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
1760 " 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
1761 _("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
1762 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1763
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1764 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1765 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1766
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1767 /* 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
1768 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
1769 " 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
1770 _("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
1771
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1772 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1773 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1774 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
1775 " 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
1776 _("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
1777 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1778
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1779 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1780 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1781 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
1782 " 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
1783 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
1784 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1785
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1786 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1787 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1788 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
1789 " 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
1790 _("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
1791 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1792
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1793 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1794 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1795
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1796 /* 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
1797 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
1798 " 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
1799 _("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
1800
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1801 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1802 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1803 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
1804 " 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
1805 '\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
1806 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1807
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1808 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1809 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1810 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
1811 " 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
1812 _("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
1813 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1814
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1815 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1816 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1817
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1818 /* 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
1819 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
1820 "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
1821 _("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
1822
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1823 if (!found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1824 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1825 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
1826 "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
1827 _("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
1828 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1829
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1830 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1831 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1832
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1833 /* 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
1834 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
1835 " 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
1836 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
1837
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1838 if (found)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1839 has_info = TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1840 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1841
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1842 /* 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
1843 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
1844 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1845 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
1846 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
1847 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1848 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
1849
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1850 has_info = TRUE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1853 if (!has_info)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1854 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1855 /* 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
1856 * 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
1857 * 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
1858 * exists.
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1859 */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1860 /* 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
1861 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
1862 * 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
1863 /* 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
1864 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
1865 * 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
1866 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
1867 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
1868 (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
1869 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
1870 ((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
1871 (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
1872 "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
1873 "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
1874 "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
1875 _("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
1876 "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
1877 "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
1878 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1879
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1880 /* 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
1881 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
1882 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
1883 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
1884 g_free(tmp);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1885
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1886 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1887 /* 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
1888 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
1889
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1890 /* 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
1891 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
1892 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
1893 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
1894 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
1895 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
1896 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
1897
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1898 /* 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
1899 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
1900 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1901 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
1902 info2_data);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1903 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1904 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1905 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1906 /* Emulate a callback */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1907 /* TODO: Huh? */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1908 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1912 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1913 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
1914 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
1915 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1916 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
1917 int id = -1;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1918
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1919 /* 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
1920 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
1921 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
1922 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
1923 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
1924 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
1925
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1926 /* 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
1927 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
1928 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
1929 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1930 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
1931 g_free(stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1932 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
1933 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
1934 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
1935 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
1936 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
1937 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
1938
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1939 return;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1942 /* 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
1943 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
1944 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1945 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
1946 || 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
1947 || 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
1948 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1949
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1950 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
1951 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
1952 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1953 else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1954 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1955 char buf[1024];
22486
3225c99785b8 Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents: 22444
diff changeset
1956 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: 22444
diff changeset
1957 " 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
1958 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
1959 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
1960 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
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1964 /* 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
1965 #endif
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1966 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
1967
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1968 g_free(stripped);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1969 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
1970 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
1971 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
1972 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
1973 #if PHOTO_SUPPORT
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1974 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
1975 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
1976 if (id != -1)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1977 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
1978 #endif
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1981 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1982 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
1983 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1984 MsnGetInfoData *data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1985 char *url;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1986
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1987 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
1988 data->gc = gc;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1989 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
1990
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1991 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
1992
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1993 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
1994 "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
1995 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
1996
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1997 g_free(url);
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2000 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
2001 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2002 msn_notification_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2003 msn_switchboard_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2004 msn_sync_init();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2005
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2006 return TRUE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2009 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
2010 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2011 msn_notification_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2012 msn_switchboard_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2013 msn_sync_end();
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2014
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2015 return TRUE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2018 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
2019 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2020 PurpleAccount *acct = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2021
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2022 /* 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
2023 if (acct_id) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2024 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
2025 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
2026 acct = NULL;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2027 } 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
2028 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
2029 while (l) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2030 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
2031 && 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
2032 acct = l->data;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2033 break;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2034 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2035 l = l->next;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2039 return acct;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2040 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2041
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2042 static 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
2043 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2044 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
2045 PurpleAccount *acct;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2046
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2047 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
2048 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2049
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2050 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
2051
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2052 if (!acct)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2053 return FALSE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2054
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2055 /* 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
2056 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
2057 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
2058 if (sname) {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2059 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
2060 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
2061 if (conv == NULL)
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2062 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
2063 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
2064 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2065 /*else
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2066 **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
2067 * 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
2068 pidgindialogs_im();*/
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2069
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2070 return TRUE;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2071 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2072 /* 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
2073 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
2074 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
2075 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
2076 return TRUE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2079 return FALSE;
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2083 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
2084 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2085 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
2086 NULL, /* user_splits */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2087 NULL, /* protocol_options */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2088 {"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
2089 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
2090 NULL, /* list_emblems */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2091 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
2092 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
2093 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
2094 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
2095 NULL, /* chat_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2096 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
2097 msn_login, /* login */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2098 msn_close, /* close */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2099 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
2100 NULL, /* set_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2101 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
2102 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
2103 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
2104 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
2105 NULL, /* change_passwd */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2106 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
2107 NULL, /* add_buddies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2108 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
2109 NULL, /* remove_buddies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2110 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
2111 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
2112 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
2113 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
2114 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
2115 NULL, /* join_chat */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2116 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
2117 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
2118 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
2119 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
2120 NULL, /* chat_whisper */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2121 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
2122 msn_keepalive, /* keepalive */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2123 NULL, /* register_user */
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_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2125 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
2126 NULL, /* alias_buddy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2127 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
2128 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
2129 NULL, /* buddy_free */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2130 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
2131 msn_normalize, /* normalize */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2132 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
2133 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
2134 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
2135 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
2136 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
2137 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
2138 NULL, /* roomlist_cancel */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2139 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
2140 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
2141 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
2142 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
2143 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
2144 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
2145 NULL, /* send_raw */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2146 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
2147 NULL, /* unregister_user */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2148 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
2149 msn_attention_types, /* attention_types */
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21673
diff changeset
2150 sizeof(PurplePluginProtocolInfo), /* struct_size */
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21673
diff changeset
2151 NULL /* initiate_media */
21312
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2154 static PurplePluginInfo info =
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2155 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2156 PURPLE_PLUGIN_MAGIC,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2157 PURPLE_MAJOR_VERSION,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2158 PURPLE_MINOR_VERSION,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2159 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
2160 NULL, /**< ui_requirement */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2161 0, /**< flags */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2162 NULL, /**< dependencies */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2163 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
2164
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2165 "prpl-msn", /**< id */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2166 "MSN", /**< name */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2167 DISPLAY_VERSION, /**< version */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2168 /** summary */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2169 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
2170 /** description */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2171 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
2172 "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
2173 PURPLE_WEBSITE, /**< homepage */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2174
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2175 msn_load, /**< load */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2176 msn_unload, /**< unload */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2177 NULL, /**< destroy */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2178
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2179 NULL, /**< ui_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2180 &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
2181 NULL, /**< prefs_info */
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2182 msn_actions,
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2183
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2184 /* padding */
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 NULL
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
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2191 static void
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2192 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
2193 {
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2194 PurpleAccountOption *option;
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2195
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2196 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
2197 MSN_SERVER);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2198 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
2199 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2200
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2201 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
2202 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
2203 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2204
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2205 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
2206 "http_method", FALSE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2207 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
2208 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2209
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2210 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
2211 "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
2212 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
2213 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2214
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2215 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
2216 "custom_smileys", TRUE);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2217 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
2218 option);
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2219
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2220 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
2221 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
2222 "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
2223 _("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
2224
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2225 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
2226
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2227 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
2228 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
2229 }
a07cfce78345 Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2230
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
2231 PURPLE_INIT_PLUGIN(msnp9, init_plugin, info);