libpurple/protocols/mxit/formcmds.c

Sat, 13 Apr 2013 12:24:43 -0400

author
Daniel Atallah <datallah@pidgin.im>
date
Sat, 13 Apr 2013 12:24:43 -0400
changeset 33880
2f2dd47bf56b
parent 33852
368feedc80cf
child 34227
6d016a081401
child 34622
753f46dd000f
permissions
-rw-r--r--

Merge with release-2.x.y

28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
1 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
2 * MXit Protocol libPurple Plugin
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
3 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
4 * -- MXit Forms & Commands --
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
5 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
6 * Andrew Victor <libpurple@mxit.com>
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
7 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
8 * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
9 * <http://www.mxitlifestyle.com>
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
10 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
14 * (at your option) any later version.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
15 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
19 * GNU General Public License for more details.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
20 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
24 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
25
29106
51c7b2177e42 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents: 28993
diff changeset
26
51c7b2177e42 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents: 28993
diff changeset
27 #include "internal.h"
33844
e8edfd4e26ae MXit: Cleanup the #includes (no purple.h) so that it atleast compiles within InstantBird.
Andrew Victor <andrew.victor@mxit.com>
parents: 33831
diff changeset
28 #include "debug.h"
33424
9919d10ee405 Make old http-related code obsolete
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33052
diff changeset
29 #include "obsolete.h"
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
30
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
31 #include "protocol.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
32 #include "mxit.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
33 #include "markup.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
34 #include "formcmds.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
35
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
36 #undef MXIT_DEBUG_COMMANDS
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
37
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
38 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
39 * the MXit Command identifiers
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
40 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
41 typedef enum
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
42 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
43 MXIT_CMD_UNKNOWN = 0, /* Unknown command */
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
44 MXIT_CMD_CLEAR, /* Clear (clear) */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
45 MXIT_CMD_SENDSMS, /* Send SMS (sendsms) */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
46 MXIT_CMD_REPLY, /* Reply (reply) */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
47 MXIT_CMD_PLATREQ, /* Platform Request (platreq) */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
48 MXIT_CMD_SELECTCONTACT, /* Select Contact (selc) */
31493
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
49 MXIT_CMD_IMAGE, /* Inline image (img) */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
50 MXIT_CMD_SCREENCONFIG, /* Chat-screen config (csc) */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
51 MXIT_CMD_SCREENINFO, /* Chat-screen info (csi) */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
52 MXIT_CMD_IMAGESTRIP, /* Image Strip (is) */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
53 MXIT_CMD_TABLE /* Table (tbl) */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
54 } MXitCommandType;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
55
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
56 /* Chat-screen behaviours (bhvr) */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
57 #define SCREEN_NO_HEADINGS 0x01
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
58 #define SCREEN_FULLSCREEN 0x02
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
59 #define SCREEN_AUTOCLEAR 0x04
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
60 #define SCREEN_NO_AUDIO 0x08
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
61 #define SCREEN_NO_MSGPREFIX 0x10
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
62 #define SCREEN_NOTIFY 0x20
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
63 #define SCREEN_PROGRESSBAR 0x40
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
64
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
65
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
66 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
67 * object for an inline image request with an URL
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
68 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
69 struct ii_url_request
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
70 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
71 struct RXMsgData* mx;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
72 char* url;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
73 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
74
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
75
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
76 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
77 * Callback function invoked when an inline image request to a web site completes.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
78 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
79 * @param url_data
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
80 * @param user_data The Markup message object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
81 * @param url_text The data returned from the WAP site
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
82 * @param len The length of the data returned
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
83 * @param error_message Descriptive error message
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
84 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
85 static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
86 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
87 struct ii_url_request* iireq = (struct ii_url_request*) user_data;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
88 int* intptr = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
89 int id;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
90
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
91 #ifdef MXIT_DEBUG_COMMANDS
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
92 purple_debug_info(MXIT_PLUGIN_ID, "Inline Image returned from %s\n", iireq->url);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
93 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
94
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
95 if (!url_text) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
96 /* no reply from the WAP site */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
97 purple_debug_error(MXIT_PLUGIN_ID, "Error downloading Inline Image from %s.\n", iireq->url);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
98 goto done;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
99 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
100
31493
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
101 /* lets first see if we don't have the inline image already in cache */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
102 if (g_hash_table_lookup(iireq->mx->session->iimages, iireq->url)) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
103 /* inline image found in the cache, so we just ignore this reply */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
104 goto done;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
105 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
106
33615
658b4037b8f6 MXit: Rather use g_memdup() here than allocating a buffer and copying the data ourselves.
Andrew Victor <andrew.victor@mxit.com>
parents: 32085
diff changeset
107 /* we now have the inline image, store a copy in the imagestore */
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33648
diff changeset
108 id = purple_imgstore_new_with_id(g_memdup(url_text, len), len, NULL);
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
109
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
110 /* map the inline image id to purple image id */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
111 intptr = g_malloc(sizeof(int));
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
112 *intptr = id;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
113 g_hash_table_insert(iireq->mx->session->iimages, iireq->url, intptr);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
114
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
115 iireq->mx->flags |= PURPLE_MESSAGE_IMAGES;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
116
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
117 done:
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
118 iireq->mx->img_count--;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
119 if ((iireq->mx->img_count == 0) && (iireq->mx->converted)) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
120 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
121 * this was the last outstanding emoticon for this message,
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
122 * so we can now display it to the user.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
123 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
124 mxit_show_message(iireq->mx);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
125 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
126
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
127 g_free(iireq);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
128 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
129
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
130
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
131 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
132 * Return the command identifier of this MXit Command.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
133 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
134 * @param cmd The MXit command <key,value> map
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
135 * @return The MXit command identifier
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
136 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
137 static MXitCommandType command_type(GHashTable* hash)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
138 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
139 char* op;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
140 char* type;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
141
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
142 op = g_hash_table_lookup(hash, "op");
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
143 if (op) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
144 if ( strcmp(op, "cmd") == 0 ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
145 type = g_hash_table_lookup(hash, "type");
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
146 if (type == NULL) /* no command provided */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
147 return MXIT_CMD_UNKNOWN;
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
148 else if (strcmp(type, "clear") == 0) /* clear */
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
149 return MXIT_CMD_CLEAR;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
150 else if (strcmp(type, "sendsms") == 0) /* send an SMS */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
151 return MXIT_CMD_SENDSMS;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
152 else if (strcmp(type, "reply") == 0) /* list of options */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
153 return MXIT_CMD_REPLY;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
154 else if (strcmp(type, "platreq") == 0) /* platform request */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
155 return MXIT_CMD_PLATREQ;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
156 else if (strcmp(type, "selc") == 0) /* select contact */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
157 return MXIT_CMD_SELECTCONTACT;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
158 }
31493
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
159 else if (strcmp(op, "img") == 0) /* inline image */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
160 return MXIT_CMD_IMAGE;
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
161 else if (strcmp(op, "csc") == 0) /* chat-screen config */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
162 return MXIT_CMD_SCREENCONFIG;
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
163 else if (strcmp(op, "csi") == 0) /* chat-screen info */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
164 return MXIT_CMD_SCREENINFO;
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
165 else if (strcmp(op, "is") == 0) /* image-strip */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
166 return MXIT_CMD_IMAGESTRIP;
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
167 else if (strcmp(op, "tbl") == 0) /* table */
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
168 return MXIT_CMD_TABLE;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
169 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
170
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
171 return MXIT_CMD_UNKNOWN;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
172 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
173
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
174
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
175 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
176 * Tokenize a MXit Command string into a <key,value> map.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
177 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
178 * @param cmd The MXit command string
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
179 * @return The <key,value> hash-map, or NULL on error.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
180 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
181 static GHashTable* command_tokenize(char* cmd)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
182 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
183 GHashTable* hash = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
184 gchar** parts;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
185 int i = 0;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
186
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
187 #ifdef MXIT_DEBUG_COMMANDS
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
188 purple_debug_info(MXIT_PLUGIN_ID, "command: '%s'\n", cmd);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
189 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
190
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
191 /* explode the command into parts */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
192 parts = g_strsplit(cmd, "|", 0);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
193
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
194 hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
195
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
196 /* now break part into a key & value */
31804
847a13d5d3bb Get rid of a few other dead variables.
Paul Aurich <darkrain42@pidgin.im>
parents: 31727
diff changeset
197 while (parts[i] != NULL) {
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
198 char* value;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
199
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
200 value = strchr(parts[i], '='); /* find start of value */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
201 if (value != NULL) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
202 *value = '\0';
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
203 value++;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
204 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
205
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
206 #ifdef MXIT_DEBUG_COMMANDS
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
207 purple_debug_info(MXIT_PLUGIN_ID, " key='%s' value='%s'\n", parts[i], value);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
208 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
209
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
210 g_hash_table_insert(hash, g_strdup(parts[i]), g_strdup(value));
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
211
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
212 i++;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
213 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
214
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
215 g_strfreev(parts);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
216
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
217 return hash;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
218 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
219
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
220
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
221 /*------------------------------------------------------------------------
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
222 * Process a Clear MXit command.
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
223 * [::op=cmd|type=clear|clearmsgscreen=true|auto=true|id=12345:]
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
224 *
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
225 * @param session The MXit session object
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
226 * @param from The sender of the message.
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
227 * @param hash The MXit command <key,value> map
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
228 */
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
229 static void command_clear(struct MXitSession* session, const char* from, GHashTable* hash)
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
230 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
231 PurpleConversation *conv;
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
232 char* clearmsgscreen;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
233
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
234 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, session->acc);
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
235 if (conv == NULL) {
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
236 purple_debug_error(MXIT_PLUGIN_ID, _( "Conversation with '%s' not found\n" ), from);
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
237 return;
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
238 }
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
239
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
240 clearmsgscreen = g_hash_table_lookup(hash, "clearmsgscreen");
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
241 if ( (clearmsgscreen) && (strcmp(clearmsgscreen, "true") == 0) ) {
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
242 /* this is a command to clear the chat screen */
31724
b83da9bc6026 Fix comment - it does not clear the screen.
Andrew Victor <andrew.victor@mxit.com>
parents: 31493
diff changeset
243 purple_conversation_clear_message_history(conv);
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
244 }
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
245 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
246
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
247
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
248 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
249 * Process a Reply MXit command.
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
250 * [::op=cmd|type=reply|replymsg=back|selmsg=b) Back|displaymsg=Processing|id=12345:]
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
251 * [::op=cmd|nm=rep|type=reply|replymsg=back|selmsg=b) Back|displaymsg=Processing|id=12345:]
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
252 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
253 * @param mx The received message data object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
254 * @param hash The MXit command <key,value> map
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
255 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
256 static void command_reply(struct RXMsgData* mx, GHashTable* hash)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
257 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
258 char* replymsg;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
259 char* selmsg;
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
260 char* nm;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
261
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
262 selmsg = g_hash_table_lookup(hash, "selmsg"); /* selection message */
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
263 replymsg = g_hash_table_lookup(hash, "replymsg"); /* reply message */
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
264 nm = g_hash_table_lookup(hash, "nm"); /* name parameter */
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
265
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
266 if ((selmsg == NULL) || (replymsg == NULL))
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
267 return; /* these parameters are required */
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
268
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
269 if (nm) { /* indicates response must be a structured response */
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
270 gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1);
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
271 gchar* replycmd = g_strdup_printf("type=reply|nm=%s|res=%s|err=0", nm, replymsg);
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
272
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
273 mxit_add_html_link( mx, replycmd, TRUE, seltext );
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
274
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
275 g_free(seltext);
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
276 g_free(replycmd);
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
277 }
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
278 else {
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
279 gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
280
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
281 mxit_add_html_link( mx, purple_url_decode(replymsg), FALSE, seltext );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
282
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
283 g_free(seltext);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
284 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
285 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
286
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
287
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
288 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
289 * Process a PlatformRequest MXit command.
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
290 * [::op=cmd|type=platreq|selmsg=Upgrade MXit|dest=http%3a//m.mxit.com|id=12345:]
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
291 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
292 * @param hash The MXit command <key,value> map
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
293 * @param msg The message to display (as generated so far)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
294 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
295 static void command_platformreq(GHashTable* hash, GString* msg)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
296 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
297 gchar* text = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
298 char* selmsg;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
299 char* dest;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
300
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
301 selmsg = g_hash_table_lookup(hash, "selmsg"); /* find the selection message */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
302 if (selmsg) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
303 text = g_markup_escape_text(purple_url_decode(selmsg), -1);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
304 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
305
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
306 dest = g_hash_table_lookup(hash, "dest"); /* find the destination */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
307 if (dest) {
28945
f94c51ec07d9 Mark a bunch of mxit strings for translation
Mark Doliner <markdoliner@pidgin.im>
parents: 28841
diff changeset
308 g_string_append_printf(msg, "<a href=\"%s\">%s</a>", purple_url_decode(dest), (text) ? text : _( "Download" )); /* add link to display message */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
309 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
310
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
311 if (text)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
312 g_free(text);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
313 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
314
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
315
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
316 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
317 * Process an inline image MXit command.
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
318 * [::op=img|dat=ASDF23408asdflkj2309flkjsadf%3d%3d|algn=1|w=120|h=12|t=100|replymsg=text:]
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
319 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
320 * @param mx The received message data object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
321 * @param hash The MXit command <key,value> map
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
322 * @param msg The message to display (as generated so far)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
323 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
324 static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
325 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
326 const char* img;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
327 const char* reply;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
328 guchar* rawimg;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
329 gsize rawimglen;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
330 int imgid;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
331
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
332 img = g_hash_table_lookup(hash, "dat");
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
333 if (img) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
334 rawimg = purple_base64_decode(img, &rawimglen);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
335 //purple_util_write_data_to_file_absolute("/tmp/mxitinline.png", (char*) rawimg, rawimglen);
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33648
diff changeset
336 imgid = purple_imgstore_new_with_id(rawimg, rawimglen, NULL);
33052
df92c3d93904 From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32859
diff changeset
337 g_string_append_printf(msg,
df92c3d93904 From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32859
diff changeset
338 "<img src=\"" PURPLE_STORED_IMAGE_PROTOCOL "%i\">",
df92c3d93904 From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32859
diff changeset
339 imgid);
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
340 mx->flags |= PURPLE_MESSAGE_IMAGES;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
341 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
342 else {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
343 img = g_hash_table_lookup(hash, "src");
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
344 if (img) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
345 struct ii_url_request* iireq;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
346
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
347 iireq = g_new0(struct ii_url_request,1);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
348 iireq->url = g_strdup(purple_url_decode(img));
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
349 iireq->mx = mx;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
350
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
351 g_string_append_printf(msg, "%s%s>", MXIT_II_TAG, iireq->url);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
352 mx->got_img = TRUE;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
353
31493
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
354 /* lets first see if we don't have the inline image already in cache */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
355 if (g_hash_table_lookup(mx->session->iimages, iireq->url)) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
356 /* inline image found in the cache, so we do not have to request it from the web */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
357 g_free(iireq);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
358 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
359 else {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
360 /* send the request for the inline image */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
361 purple_debug_info(MXIT_PLUGIN_ID, "sending request for inline image '%s'\n", iireq->url);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
362
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
363 /* request the image (reference: "libpurple/util.h") */
32596
927575c2af4e * purple_util_fetch_url_request_len() renamed to purple_util_fetch_url_request().
Andrew Victor <andrew.victor@mxit.com>
parents: 32330
diff changeset
364 purple_util_fetch_url(iireq->url, TRUE, NULL, TRUE, -1, mxit_cb_ii_returned, iireq);
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
365 mx->img_count++;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
366 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
367 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
368 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
369
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
370 /* if this is a clickable image, show a click link */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
371 reply = g_hash_table_lookup(hash, "replymsg");
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
372 if (reply) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
373 g_string_append_printf(msg, "\n");
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33615
diff changeset
374 mxit_add_html_link(mx, purple_url_decode(reply), FALSE, _( "click here" ));
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
375 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
376 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
377
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
378
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
379 /*------------------------------------------------------------------------
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
380 * Process an Imagestrip MXit command.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
381 * [::op=is|nm=status|dat=iVBORw0KGgoAAAA%3d%3d|v=63398792426788|fw=8|fh=8|layer=0:]
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
382 *
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
383 * @param from The sender of the message.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
384 * @param hash The MXit command <key,value> map
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
385 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
386 static void command_imagestrip(struct MXitSession* session, const char* from, GHashTable* hash)
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
387 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
388 const char* name;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
389 const char* validator;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
390 const char* tmp;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
391 int width, height, layer;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
392
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
393 purple_debug_info(MXIT_PLUGIN_ID, "ImageStrip received from %s\n", from);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
394
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
395 /* image strip name */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
396 name = g_hash_table_lookup(hash, "nm");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
397
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
398 /* validator */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
399 validator = g_hash_table_lookup(hash, "v");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
400
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
401 /* image data */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
402 tmp = g_hash_table_lookup(hash, "dat");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
403 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
404 guchar* rawimg;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
405 gsize rawimglen;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
406 char* dir;
33743
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
407 char* escfrom;
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
408 char* escname;
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
409 char* escvalidator;
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
410 char* filename;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
411
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
412 /* base64 decode the image data */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
413 rawimg = purple_base64_decode(tmp, &rawimglen);
33816
9eb08b587d95 MXit: Ealier versions of GLib may cause purple_base64_decode() to return NULL.
Andrew Victor <andrew.victor@mxit.com>
parents: 33743
diff changeset
414 if (!rawimg)
9eb08b587d95 MXit: Ealier versions of GLib may cause purple_base64_decode() to return NULL.
Andrew Victor <andrew.victor@mxit.com>
parents: 33743
diff changeset
415 return;
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
416
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
417 /* save it to a file */
33743
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
418 dir = g_build_filename(purple_user_dir(), "mxit", "imagestrips", NULL);
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
419 purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR); /* ensure directory exists */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
420
33743
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
421 escfrom = g_strdup(purple_escape_filename(from));
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
422 escname = g_strdup(purple_escape_filename(name));
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
423 escvalidator = g_strdup(purple_escape_filename(validator));
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
424 filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s-%s-%s.png", dir, escfrom, escname, escvalidator);
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
425
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
426 purple_util_write_data_to_file_absolute(filename, (char*) rawimg, rawimglen);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
427
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
428 g_free(dir);
33743
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
429 g_free(escfrom);
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
430 g_free(escname);
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
431 g_free(escvalidator);
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
432 g_free(filename);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
433 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
434
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
435 tmp = g_hash_table_lookup(hash, "fw");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
436 width = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
437
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
438 tmp = g_hash_table_lookup(hash, "fh");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
439 height = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
440
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
441 tmp = g_hash_table_lookup(hash, "layer");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
442 layer = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
443
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
444 purple_debug_info(MXIT_PLUGIN_ID, "ImageStrip %s from %s: [w=%i h=%i l=%i validator=%s]\n", name, from, width, height, layer, validator);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
445 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
446
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
447
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
448 /*------------------------------------------------------------------------
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
449 * Process a Chat-Screen-Info MXit command.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
450 * [::op=csi:]
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
451 *
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
452 * @param session The MXit session object
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
453 * @param from The sender of the message.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
454 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
455 static void command_screeninfo(struct MXitSession* session, const char* from)
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
456 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
457 char* response;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
458
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
459 purple_debug_info(MXIT_PLUGIN_ID, "Chat Screen Info received from %s\n", from);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
460
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
461 // TODO: Determine width, height, colors of chat-screen.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
462
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
463 response = g_strdup_printf("::type=csi|res=bhvr,0;w,%i;h,%i;col,0.ffffffff,29.ff000000:", 300, 400);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
464
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
465 /* send response back to MXit */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
466 mxit_send_message( session, from, response, FALSE, TRUE );
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
467
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
468 g_free(response);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
469 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
470
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
471
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
472 /*------------------------------------------------------------------------
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
473 * Process a Chat-Screen-Configure MXit command.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
474 * [::op=csc|bhvr=|menu=<menu>|col=<colors>:]
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
475 * where:
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
476 * menu ::= <menuitem> { ";" <menuitem> }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
477 * menuitem ::= { type "," <text> "," <name> "," <meta> }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
478 * colors ::= <color> { ";" <color> }
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33816
diff changeset
479 * color ::= <colorid> "," <ARGB hex color>
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
480 *
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
481 * @param session The MXit session object
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
482 * @param from The sender of the message.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
483 * @param hash The MXit command <key,value> map
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
484 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
485 static void command_screenconfig(struct MXitSession* session, const char* from, GHashTable* hash)
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
486 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
487 const char* tmp;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
488
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
489 purple_debug_info(MXIT_PLUGIN_ID, "Chat Screen Configure received from %s\n", from);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
490
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
491 /* Behaviour */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
492 tmp = g_hash_table_lookup(hash, "bhvr");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
493 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
494 purple_debug_info(MXIT_PLUGIN_ID, " behaviour = %s\n", tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
495 // TODO: Re-configure conversation screen.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
496 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
497
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
498 /* Menu */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
499 tmp = g_hash_table_lookup(hash, "menu");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
500 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
501 purple_debug_info(MXIT_PLUGIN_ID, " menu = %s\n", tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
502 // TODO: Implement conversation-specific sub-menu.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
503 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
504
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
505 /* Colours */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
506 tmp = g_hash_table_lookup(hash, "col");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
507 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
508 purple_debug_info(MXIT_PLUGIN_ID, " colours = %s\n", tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
509 // TODO: Re-configuration conversation colors.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
510 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
511 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
512
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
513
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
514 /*------------------------------------------------------------------------
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
515 * Process a Table Markup MXit command.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
516 *
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
517 * @param mx The received message data object
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
518 * @param hash The MXit command <key,value> map
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
519 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
520 static void command_table(struct RXMsgData* mx, GHashTable* hash)
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
521 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
522 const char* tmp;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
523 const char* name;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
524 int mode;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
525 int nr_columns = 0, nr_rows = 0;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
526 gchar** coldata;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
527 int i, j;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
528
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
529 /* table name */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
530 name = g_hash_table_lookup(hash, "nm");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
531
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
532 /* number of columns */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
533 tmp = g_hash_table_lookup(hash, "col");
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33816
diff changeset
534 nr_columns = atoi(tmp);
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
535
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
536 /* number of rows */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
537 tmp = g_hash_table_lookup(hash, "row");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
538 nr_rows = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
539
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
540 /* mode */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
541 tmp = g_hash_table_lookup(hash, "mode");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
542 mode = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
543
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
544 /* table data */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
545 tmp = g_hash_table_lookup(hash, "d");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
546 coldata = g_strsplit(tmp, "~", 0); /* split into entries for each row & column */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
547
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
548 purple_debug_info(MXIT_PLUGIN_ID, "Table %s from %s: [cols=%i rows=%i mode=%i]\n", name, mx->from, nr_columns, nr_rows, mode);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
549
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
550 for (i = 0; i < nr_rows; i++) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
551 for (j = 0; j < nr_columns; j++) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
552 purple_debug_info(MXIT_PLUGIN_ID, " Row %i Column %i = %s\n", i, j, coldata[i*nr_columns + j]);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
553 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
554 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
555 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
556
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
557
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
558 /*------------------------------------------------------------------------
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
559 * Process a received MXit Command message.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
560 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
561 * @param mx The received message data object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
562 * @param message The message text
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
563 * @return The length of the command
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
564 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
565 int mxit_parse_command(struct RXMsgData* mx, char* message)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
566 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
567 GHashTable* hash = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
568 char* start;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
569 char* end;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
570
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
571 /* ensure that this is really a command */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
572 if ( ( message[0] != ':' ) || ( message[1] != ':' ) ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
573 /* this is not a command */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
574 return 0;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
575 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
576
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
577 start = message + 2;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
578 end = strstr(start, ":");
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
579 if (end) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
580 /* end of a command found */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
581 *end = '\0'; /* terminate command string */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
582
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
583 hash = command_tokenize(start); /* break into <key,value> pairs */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
584 if (hash) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
585 MXitCommandType type = command_type(hash);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
586
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
587 switch (type) {
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
588 case MXIT_CMD_CLEAR :
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
589 command_clear(mx->session, mx->from, hash);
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
590 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
591 case MXIT_CMD_REPLY :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
592 command_reply(mx, hash);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
593 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
594 case MXIT_CMD_PLATREQ :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
595 command_platformreq(hash, mx->msg);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
596 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
597 case MXIT_CMD_IMAGE :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
598 command_image(mx, hash, mx->msg);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
599 break;
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
600 case MXIT_CMD_SCREENCONFIG :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
601 command_screenconfig(mx->session, mx->from, hash);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
602 break;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
603 case MXIT_CMD_SCREENINFO :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
604 command_screeninfo(mx->session, mx->from);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
605 break;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
606 case MXIT_CMD_IMAGESTRIP :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
607 command_imagestrip(mx->session, mx->from, hash);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
608 break;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
609 case MXIT_CMD_TABLE :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
610 command_table(mx, hash);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
611 break;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
612 default :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
613 /* command unknown, or not currently supported */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
614 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
615 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
616 g_hash_table_destroy(hash);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
617 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
618 *end = ':';
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
619
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
620 return end - message;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
621 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
622 else {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
623 return 0;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
624 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
625 }

mercurial