libpurple/protocols/mxit/formcmds.c

Fri, 19 Jul 2013 03:27:40 +0530

author
Ankit Vani <a@nevitus.org>
date
Fri, 19 Jul 2013 03:27:40 +0530
branch
soc.2013.gobjectification
changeset 34828
4477544f42a3
parent 34701
af4e269e4aa9
parent 34253
e5f98ea3b169
child 34878
41b9075c7714
permissions
-rw-r--r--

Merged default branch

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"
34253
e5f98ea3b169 HTTP: get rid of mxit's own http implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34233
diff changeset
29 #include "http.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 */
34227
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
79 static void
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
80 mxit_cb_ii_returned(PurpleHttpConnection *http_conn, PurpleHttpResponse *response,
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
81 gpointer _iireq)
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
82 {
34227
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
83 struct ii_url_request* iireq = _iireq;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
84 int* intptr = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
85 int id;
34227
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
86 const gchar* data;
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
87 size_t len;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
88
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
89 #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
90 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
91 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
92
34227
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
93 if (!purple_http_response_is_successfull(response)) {
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
94 /* 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
95 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
96 goto done;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
97 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
98
31493
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
99 /* 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
100 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
101 /* 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
102 goto done;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
103 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
104
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
105 /* we now have the inline image, store a copy in the imagestore */
34227
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
106 data = purple_http_response_get_data(response, &len);
6d016a081401 HTTP: migrate purple_util_fetch_url to new API for prpls
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33852
diff changeset
107 id = purple_imgstore_new_with_id(g_memdup(data, 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
108
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
109 /* 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
110 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
111 *intptr = id;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
112 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
113
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
114 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
115
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
116 done:
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
117 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
118 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
119 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
120 * 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
121 * 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
122 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
123 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
124 }
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 g_free(iireq);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
127 }
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 * 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
132 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
133 * @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
134 * @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
135 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
136 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
137 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
138 char* op;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
139 char* type;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
140
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
141 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
142 if (op) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
143 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
144 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
145 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
146 return MXIT_CMD_UNKNOWN;
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 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
155 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
156 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
157 }
31493
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
158 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
159 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
160 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 }
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 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
171 }
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 * 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
176 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
177 * @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
178 * @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
179 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
180 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
181 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
182 GHashTable* hash = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
183 gchar** parts;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
184 int i = 0;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
185
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
186 #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
187 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
188 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
189
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
190 /* 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
191 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
192
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
193 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
194
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
195 /* 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
196 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
197 char* value;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
198
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
199 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
200 if (value != NULL) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
201 *value = '\0';
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
202 value++;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
203 }
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 #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
206 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
207 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
208
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
209 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
210
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
211 i++;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
212 }
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 g_strfreev(parts);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
215
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
216 return hash;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
217 }
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 /*------------------------------------------------------------------------
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
221 * 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
222 * [::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
223 *
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
224 * @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
225 * @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
226 * @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
227 */
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
228 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
229 {
34637
9cdc9e6eecce Refactored mxit and myspace protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34625
diff changeset
230 PurpleIMConversation *im;
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
231 char* clearmsgscreen;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
232
34637
9cdc9e6eecce Refactored mxit and myspace protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34625
diff changeset
233 im = purple_conversations_find_im_with_account(from, session->acc);
9cdc9e6eecce Refactored mxit and myspace protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34625
diff changeset
234 if (im == NULL) {
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
235 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
236 return;
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
237 }
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
238
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
239 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
240 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
241 /* this is a command to clear the chat screen */
34637
9cdc9e6eecce Refactored mxit and myspace protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34625
diff changeset
242 purple_conversation_clear_message_history(PURPLE_CONVERSATION(im));
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
243 }
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
244 }
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 * 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
249 * [::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
250 * [::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
251 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
252 * @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
253 * @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
254 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
255 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
256 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
257 char* replymsg;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
258 char* selmsg;
30207
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
259 char* nm;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
260
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
261 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
262 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
263 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
264
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 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
266 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
267
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 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
269 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
270 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
271
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
272 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
273
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
274 g_free(seltext);
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
275 g_free(replycmd);
ca2838c8b6fa Add support for the "nm=" syle of clickable links.
Andrew Victor <andrew.victor@mxit.com>
parents: 30206
diff changeset
276 }
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
277 else {
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
278 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
279
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
280 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
281
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
282 g_free(seltext);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
283 }
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 * Process a PlatformRequest MXit command.
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
289 * [::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
290 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
291 * @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
292 * @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
293 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
294 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
295 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
296 gchar* text = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
297 char* selmsg;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
298 char* dest;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
299
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
300 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
301 if (selmsg) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
302 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
303 }
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 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
306 if (dest) {
28945
f94c51ec07d9 Mark a bunch of mxit strings for translation
Mark Doliner <markdoliner@pidgin.im>
parents: 28841
diff changeset
307 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
308 }
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 if (text)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
311 g_free(text);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
312 }
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 * 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
317 * [::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
318 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
319 * @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
320 * @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
321 * @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
322 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
323 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
324 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
325 const char* img;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
326 const char* reply;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
327 guchar* rawimg;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
328 gsize rawimglen;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
329 int imgid;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
330
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
331 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
332 if (img) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
333 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
334 //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
335 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
336 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
337 "<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
338 imgid);
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
339 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
340 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
341 else {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
342 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
343 if (img) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
344 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
345
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
346 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
347 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
348 iireq->mx = mx;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
349
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
350 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
351 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
352
31493
f0e79f3b63ae Recognize (and ignore for now) the Gaming/Table Markup commands.
Andrew Victor <andrew.victor@mxit.com>
parents: 30207
diff changeset
353 /* 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
354 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
355 /* 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
356 g_free(iireq);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
357 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
358 else {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
359 /* 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
360 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
361
34233
8bdcc4f84a5e HTTP: introduce purple_http_get_printf, make purple_http_get consistent with it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34227
diff changeset
362 purple_http_get(mx->session->con, mxit_cb_ii_returned, iireq, iireq->url);
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
363 mx->img_count++;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
364 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
365 }
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 /* 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
369 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
370 if (reply) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
371 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
372 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
373 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
374 }
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 /*------------------------------------------------------------------------
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
378 * Process an Imagestrip MXit command.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
379 * [::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
380 *
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
381 * @param from The sender of the message.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
382 * @param hash The MXit command <key,value> map
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
383 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
384 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
385 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
386 const char* name;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
387 const char* validator;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
388 const char* tmp;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
389 int width, height, layer;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
390
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
391 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
392
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
393 /* image strip name */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
394 name = g_hash_table_lookup(hash, "nm");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
395
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
396 /* validator */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
397 validator = g_hash_table_lookup(hash, "v");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
398
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
399 /* image data */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
400 tmp = g_hash_table_lookup(hash, "dat");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
401 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
402 guchar* rawimg;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
403 gsize rawimglen;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
404 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
405 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
406 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
407 char* escvalidator;
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
408 char* filename;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
409
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
410 /* base64 decode the image data */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
411 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
412 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
413 return;
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
414
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
415 /* 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
416 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
417 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
418
33743
a8aef1d340f2 Fix a bug where a remote MXit user could possibly specify a local
Mark Doliner <mark@kingant.net>
parents: 33617
diff changeset
419 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
420 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
421 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
422 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
423
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
424 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
425
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
426 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
427 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
428 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
429 g_free(escvalidator);
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
430 g_free(filename);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
431 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
432
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
433 tmp = g_hash_table_lookup(hash, "fw");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
434 width = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
435
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
436 tmp = g_hash_table_lookup(hash, "fh");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
437 height = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
438
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
439 tmp = g_hash_table_lookup(hash, "layer");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
440 layer = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
441
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
442 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
443 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
444
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 * Process a Chat-Screen-Info MXit command.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
448 * [::op=csi:]
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
449 *
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
450 * @param session The MXit session object
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
451 * @param from The sender of the message.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
452 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
453 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
454 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
455 char* response;
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 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
458
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
459 // TODO: Determine width, height, colors of chat-screen.
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 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
462
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
463 /* send response back to MXit */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
464 mxit_send_message( session, from, response, FALSE, TRUE );
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
465
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
466 g_free(response);
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
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 * Process a Chat-Screen-Configure MXit command.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
472 * [::op=csc|bhvr=|menu=<menu>|col=<colors>:]
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
473 * where:
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
474 * menu ::= <menuitem> { ";" <menuitem> }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
475 * menuitem ::= { type "," <text> "," <name> "," <meta> }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
476 * colors ::= <color> { ";" <color> }
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33816
diff changeset
477 * color ::= <colorid> "," <ARGB hex color>
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
478 *
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
479 * @param session The MXit session object
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
480 * @param from The sender of the message.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
481 * @param hash The MXit command <key,value> map
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
482 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
483 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
484 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
485 const char* tmp;
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 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
488
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
489 /* Behaviour */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
490 tmp = g_hash_table_lookup(hash, "bhvr");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
491 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
492 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
493 // TODO: Re-configure conversation screen.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
494 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
495
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
496 /* Menu */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
497 tmp = g_hash_table_lookup(hash, "menu");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
498 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
499 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
500 // TODO: Implement conversation-specific sub-menu.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
501 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
502
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
503 /* Colours */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
504 tmp = g_hash_table_lookup(hash, "col");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
505 if (tmp) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
506 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
507 // TODO: Re-configuration conversation colors.
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
508 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
509 }
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 * Process a Table Markup MXit command.
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 * @param mx The received message data object
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
516 * @param hash The MXit command <key,value> map
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
517 */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
518 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
519 {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
520 const char* tmp;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
521 const char* name;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
522 int mode;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
523 int nr_columns = 0, nr_rows = 0;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
524 gchar** coldata;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
525 int i, j;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
526
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
527 /* table name */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
528 name = g_hash_table_lookup(hash, "nm");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
529
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
530 /* number of columns */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
531 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
532 nr_columns = atoi(tmp);
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
533
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
534 /* number of rows */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
535 tmp = g_hash_table_lookup(hash, "row");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
536 nr_rows = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
537
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
538 /* mode */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
539 tmp = g_hash_table_lookup(hash, "mode");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
540 mode = atoi(tmp);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
541
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
542 /* table data */
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
543 tmp = g_hash_table_lookup(hash, "d");
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
544 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
545
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
546 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
547
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
548 for (i = 0; i < nr_rows; i++) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
549 for (j = 0; j < nr_columns; j++) {
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
550 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
551 }
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
552 }
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 /*------------------------------------------------------------------------
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
557 * 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
558 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
559 * @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
560 * @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
561 * @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
562 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
563 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
564 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
565 GHashTable* hash = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
566 char* start;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
567 char* end;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
568
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
569 /* 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
570 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
571 /* 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
572 return 0;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
573 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
574
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
575 start = message + 2;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
576 end = strstr(start, ":");
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
577 if (end) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
578 /* 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
579 *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
580
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
581 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
582 if (hash) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
583 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
584
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
585 switch (type) {
30206
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
586 case MXIT_CMD_CLEAR :
78a84b7ac7fe Fix the processing of the "Clear" MXit command.
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
587 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
588 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
589 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
590 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
591 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
592 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
593 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
594 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
595 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
596 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
597 break;
31727
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
598 case MXIT_CMD_SCREENCONFIG :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
599 command_screenconfig(mx->session, mx->from, hash);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
600 break;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
601 case MXIT_CMD_SCREENINFO :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
602 command_screeninfo(mx->session, mx->from);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
603 break;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
604 case MXIT_CMD_IMAGESTRIP :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
605 command_imagestrip(mx->session, mx->from, hash);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
606 break;
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
607 case MXIT_CMD_TABLE :
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
608 command_table(mx, hash);
c5097c76d9a3 Start on Gaming & Table markup.
Andrew Victor <andrew.victor@mxit.com>
parents: 31724
diff changeset
609 break;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
610 default :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
611 /* 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
612 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
613 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
614 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
615 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
616 *end = ':';
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 return end - message;
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 else {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
621 return 0;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
622 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
623 }

mercurial