annotate libpurple/protocols/mxit/protocol.h @ 30356:4232e6b27bea

Add support for message delivery notification.
author andrew.victor@mxit.com
date Thu, 13 May 2010 09:02:58 +0000
parents 81ea740f92a4
children 207662bad69c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
1 /*
69aa4660401a 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
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
3 *
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
4 * -- MXit client protocol implementation --
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
5 *
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
6 * Pieter Loubser <libpurple@mxit.com>
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
7 *
69aa4660401a 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.
69aa4660401a 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>
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
10 *
69aa4660401a 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
69aa4660401a 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
69aa4660401a 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
69aa4660401a 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.
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
15 *
69aa4660401a 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,
69aa4660401a 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
69aa4660401a 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
69aa4660401a 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.
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
20 *
69aa4660401a 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
69aa4660401a 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
69aa4660401a 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
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
24 */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
25
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
26 #ifndef _MXIT_PROTO_H_
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
27 #define _MXIT_PROTO_H_
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
28
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
29
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
30 /* Client protocol constants */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
31 #define CP_SOCK_REC_TERM '\x00' /* socket record terminator */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
32 #define CP_HTTP_REC_TERM '\x26' /* http record terminator '&' */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
33 #define CP_FLD_TERM '\x01' /* field terminator */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
34 #define CP_PKT_TERM '\x02' /* packet terminator */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
35
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
36
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
37 #define CP_MAX_PACKET ( 1024 * 1024 ) /* maximum client protocol packet size (1 MiB) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
38 #define CP_MAX_FILESIZE ( 150 * 1000 ) /* maximum client protocol file transfer size (150 KB) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
39 #define MXIT_EMOTICON_SIZE 18 /* icon size for custom emoticons */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
40 #define CP_MAX_STATUS_MSG 250 /* maximum status message length (in characters) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
41
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
42 /* Avatars */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
43 #define MXIT_AVATAR_SIZE 96 /* default avatar image size 96x96 */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
44 #define MXIT_AVATAR_TYPE "PNG" /* request avatars in this file type (only a suggestion) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
45 #define MXIT_AVATAR_BITDEPT 24 /* request avatars with this bit depth (only a suggestion) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
46
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
47 /* Protocol error codes */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
48 #define MXIT_ERRCODE_SUCCESS 0
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
49 #define MXIT_ERRCODE_REDIRECT 16
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
50 #define MXIT_ERRCODE_LOGGEDOUT 42
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
51
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
52 /* MXit client features */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
53 #define MXIT_CF_NONE 0x000000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
54 #define MXIT_CF_FORMS 0x000001
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
55 #define MXIT_CF_FILE_TRANSFER 0x000002
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
56 #define MXIT_CF_CAMERA 0x000004
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
57 #define MXIT_CF_COMMANDS 0x000008
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
58 #define MXIT_CF_SMS 0x000010
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
59 #define MXIT_CF_FILE_ACCESS 0x000020
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
60 #define MXIT_CF_MIDP2 0x000040
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
61 #define MXIT_CF_SKINS 0x000080
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
62 #define MXIT_CF_AUDIO 0x000100
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
63 #define MXIT_CF_ENCRYPTION 0x000200
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
64 #define MXIT_CF_VOICE_REC 0x000400
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
65 #define MXIT_CF_VECTOR_GFX 0x000800
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
66 #define MXIT_CF_IMAGES 0x001000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
67 #define MXIT_CF_MARKUP 0x002000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
68 #define MXIT_CF_VIBES 0x004000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
69 #define MXIT_CF_SELECT_CONTACT 0x008000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
70 #define MXIT_CF_CUSTOM_EMO 0x010000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
71 #define MXIT_CF_ALERT_PROFILES 0x020000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
72 #define MXIT_CF_EXT_MARKUP 0x040000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
73 #define MXIT_CF_PLAIN_PWD 0x080000
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
74 #define MXIT_CF_NO_GATEWAYS 0x100000
30356
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
75 #define MXIT_CF_NO_AVATARS 0x200000
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
76 #define MXIT_CF_GAMING 0x400000
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
77 #define MXIT_CF_GAMING_UPDATE 0x800000
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
78
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
79 /* Client features supported by this implementation */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
80 #define MXIT_CP_FEATURES ( MXIT_CF_FILE_TRANSFER | MXIT_CF_FILE_ACCESS | MXIT_CF_AUDIO | MXIT_CF_MARKUP | MXIT_CF_EXT_MARKUP | MXIT_CF_NO_GATEWAYS | MXIT_CF_IMAGES | MXIT_CF_COMMANDS | MXIT_CF_VIBES | MXIT_CF_MIDP2 )
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
81
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
82
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
83 #define MXIT_PING_INTERVAL ( 5 * 60 ) /* ping the server after X seconds of being idle (5 minutes) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
84 #define MXIT_ACK_TIMEOUT ( 30 ) /* timeout after waiting X seconds for an ack from the server (30 seconds) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
85
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
86 /* MXit client version */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
87 #define MXIT_CP_DISTCODE "P" /* client distribution code (magic, do not touch!) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
88 #define MXIT_CP_RELEASE "5.9.0" /* client protocol release version supported */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
89 #define MXIT_CP_ARCH "Y" /* client architecture series (Y not for Yoda but for PC-client) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
90 #define MXIT_CLIENT_ID "LP" /* client ID as specified by MXit */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
91 #define MXIT_CP_PLATFORM "PURPLE" /* client platform */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
92 #define MXIT_CP_VERSION MXIT_CP_DISTCODE"-"MXIT_CP_RELEASE"-"MXIT_CP_ARCH"-"MXIT_CP_PLATFORM
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
93
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
94 /* set operating system name */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
95 #if defined( __APPLE__ )
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
96 #define MXIT_CP_OS "apple"
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
97 #elif defined( _WIN32 )
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
98 #define MXIT_CP_OS "windows"
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
99 #elif defined( __linux__ )
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
100 #define MXIT_CP_OS "linux"
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
101 #else
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
102 #define MXIT_CP_OS "unknown"
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
103 #endif
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
104
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
105 /* Client capabilities */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
106 #define MXIT_CP_CAP "utf8=true;cid="MXIT_CLIENT_ID
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
107
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
108 /* Client settings */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
109 #define MAX_QUEUE_SIZE ( 1 << 4 ) /* tx queue size (16 packets) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
110 #define MXIT_POPUP_WIN_NAME "MXit Notification" /* popup window name */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
111 #define MXIT_MAX_ATTRIBS 10 /* maximum profile attributes supported */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
112 #define MXIT_DEFAULT_LOCALE "en" /* default locale setting */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
113 #define MXIT_DEFAULT_LOC "planetpurple" /* the default location for registration */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
114
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
115 /* Client protocol commands */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
116 #define CP_CMD_LOGIN 0x0001 /* (1) login */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
117 #define CP_CMD_LOGOUT 0x0002 /* (2) logout */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
118 #define CP_CMD_CONTACT 0x0003 /* (3) get contacts */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
119 #define CP_CMD_UPDATE 0x0005 /* (5) update contact information */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
120 #define CP_CMD_INVITE 0x0006 /* (6) subscribe to new contact */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
121 #define CP_CMD_PRESENCE 0x0007 /* (7) get presence */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
122 #define CP_CMD_REMOVE 0x0008 /* (8) remove contact */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
123 #define CP_CMD_RX_MSG 0x0009 /* (9) get new messages */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
124 #define CP_CMD_TX_MSG 0x000A /* (10) send new message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
125 #define CP_CMD_REGISTER 0x000B /* (11) register */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
126 //#define CP_CMD_PROFILE_SET 0x000C /* (12) set profile (DEPRECATED see CP_CMD_EXTPROFILE_SET) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
127 #define CP_CMD_POLL 0x0011 /* (17) poll the HTTP server for an update */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
128 //#define CP_CMD_PROFILE_GET 0x001A /* (26) get profile (DEPRECATED see CP_CMD_EXTPROFILE_GET) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
129 #define CP_CMD_MEDIA 0x001B /* (27) get multimedia message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
130 #define CP_CMD_SPLASHCLICK 0x001F /* (31) splash-screen clickthrough */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
131 #define CP_CMD_STATUS 0x0020 /* (32) set shown presence & status */
30356
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
132 #define CP_CMD_MSGEVENT 0x0023 /* (35) Raise message event */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
133 #define CP_CMD_MOOD 0x0029 /* (41) set mood */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
134 #define CP_CMD_KICK 0x002B /* (43) login kick */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
135 #define CP_CMD_GRPCHAT_CREATE 0x002C /* (44) create new groupchat */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
136 #define CP_CMD_GRPCHAT_INVITE 0x002D /* (45) add new groupchat member */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
137 #define CP_CMD_NEW_SUB 0x0033 /* (51) get new subscription */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
138 #define CP_CMD_ALLOW 0x0034 /* (52) allow subscription */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
139 #define CP_CMD_DENY 0x0037 /* (55) deny subscription */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
140 #define CP_CMD_EXTPROFILE_GET 0x0039 /* (57) get extended profile */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
141 #define CP_CMD_EXTPROFILE_SET 0x003A /* (58) set extended profile */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
142 #define CP_CMD_PING 0x03E8 /* (1000) ping (keepalive) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
143
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
144 /* HTTP connection */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
145 #define MXIT_HTTP_POLL_MIN 7 /* minimum time between HTTP polls (seconds) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
146 #define MXIT_HTTP_POLL_MAX ( 10 * 60 ) /* maximum time between HTTP polls (seconds) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
147
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
148 /* receiver states */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
149 #define RX_STATE_RLEN 0x01 /* reading packet length section */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
150 #define RX_STATE_DATA 0x02 /* reading packet data section */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
151 #define RX_STATE_PROC 0x03 /* process read data */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
152
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
153 /* message flags */
30356
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
154 #define CP_MSG_NOTIFY_DELIVERY 0x0002 /* request delivery notification */
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
155 #define CP_MSG_NOTIFY_READ 0x0004 /* request read notification */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
156 #define CP_MSG_ENCRYPTED 0x0010 /* message is encrypted */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
157 #define CP_MSG_MARKUP 0x0200 /* message may contain markup */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
158 #define CP_MSG_EMOTICON 0x0400 /* message may contain custom emoticons */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
159
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
160 /* redirect types */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
161 #define CP_REDIRECT_PERMANENT 1 /* permanent redirect */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
162 #define CP_REDIRECT_TEMPORARY 2 /* temporary redirect */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
163
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
164 /* message tx types */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
165 #define CP_MSGTYPE_NORMAL 0x01 /* normal message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
166 #define CP_MSGTYPE_CHAT 0x02 /* chat message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
167 #define CP_MSGTYPE_HEADLINE 0x03 /* headline message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
168 #define CP_MSGTYPE_ERROR 0x04 /* error message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
169 #define CP_MSGTYPE_GROUPCHAT 0x05 /* groupchat message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
170 #define CP_MSGTYPE_FORM 0x06 /* mxit custom form */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
171 #define CP_MSGTYPE_COMMAND 0x07 /* mxit command */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
172
30356
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
173 /* message event types */
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
174 #define CP_MSGEVENT_DELIVERED 0x02 /* message was delivered */
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
175 #define CP_MSGEVENT_DISPLAYED 0x04 /* message was viewed */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
176
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
177 /* extended profile attribute fields */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
178 #define CP_PROFILE_BIRTHDATE "birthdate" /* Birthdate (String - ISO 8601 format) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
179 #define CP_PROFILE_GENDER "gender" /* Gender (Boolean - 0=female, 1=male) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
180 #define CP_PROFILE_HIDENUMBER "hidenumber" /* Hide Number (Boolean - 0=false, 1=true) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
181 #define CP_PROFILE_FULLNAME "fullname" /* Fullname (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
182 #define CP_PROFILE_STATUS "statusmsg" /* Status Message (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
183 #define CP_PROFILE_PREVSTATUS "prevstatusmsgs" /* Previous Status Messages (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
184 #define CP_PROFILE_AVATAR "avatarid" /* Avatar ID (String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
185 #define CP_PROFILE_MODIFIED "lastmodified" /* Last-Modified timestamp */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
186 #define CP_PROFILE_TITLE "title" /* Title (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
187 #define CP_PROFILE_FIRSTNAME "firstname" /* First name (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
188 #define CP_PROFILE_LASTNAME "lastname" /* Last name (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
189 #define CP_PROFILE_EMAIL "email" /* Email address (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
190 #define CP_PROFILE_MOBILENR "mobilenumber" /* Mobile Number (UTF8 String) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
191
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
192 /* extended profile field types */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
193 #define CP_PROF_TYPE_BOOL 0x02 /* boolean profile attribute type */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
194 #define CP_PROF_TYPE_INT 0x05 /* integer profile attribute type */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
195 #define CP_PROF_TYPE_UTF8 0x0A /* UTF8 string profile attribute type */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
196 #define CP_PROF_TYPE_DATE 0x0B /* date-time profile attribute type */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
197
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
198
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
199 /* define this to enable protocol debugging (very verbose logging) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
200 #define DEBUG_PROTOCOL
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
201
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
202
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
203 /* ======================================================================================= */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
204
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
205 struct MXitSession;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
206
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
207 /*------------------------------------------*/
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
208
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
209 struct field {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
210 char* data;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
211 int len;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
212 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
213
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
214 struct record {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
215 struct field** fields;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
216 int fcount;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
217 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
218
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
219 struct rx_packet {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
220 int cmd;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
221 int errcode;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
222 char* errmsg;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
223 struct record** records;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
224 int rcount;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
225 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
226
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
227 struct tx_packet {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
228 int cmd;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
229 char header[256];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
230 int headerlen;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
231 char* data;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
232 int datalen;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
233 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
234
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
235 /*------------------------------------------*/
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
236
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
237
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
238 /*
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
239 * A received message data object
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
240 */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
241 struct RXMsgData {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
242 struct MXitSession* session; /* MXit session object */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
243 char* from; /* the sender's name */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
244 time_t timestamp; /* time at which the message was sent */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
245 GString* msg; /* newly created message converted to libPurple formatting */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
246 gboolean got_img; /* flag to say if this message got any images/emoticons embedded */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
247 short img_count; /* the amount of images/emoticons still outstanding for the message */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
248 int chatid; /* multimx chatroom id */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
249 int flags; /* libPurple conversation flags */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
250 gboolean converted; /* true if the message has been completely parsed and converted to libPurple markup */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
251 gboolean processed; /* the message has been processed completely and should be freed up */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
252 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
253
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
254
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
255
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
256 /*
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
257 * The packet transmission queue.
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
258 */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
259 struct tx_queue {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
260 struct tx_packet* packets[MAX_QUEUE_SIZE]; /* array of packet pointers */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
261 int count; /* number of packets queued */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
262 int rd_i; /* queue current read index (queue offset for reading a packet) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
263 int wr_i; /* queue current write index (queue offset for adding new packet) */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
264 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
265
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
266
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
267 /* ======================================================================================= */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
268
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
269 void mxit_popup( int type, const char* heading, const char* message );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
270 void mxit_strip_domain( char* username );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
271 gboolean find_active_chat( const GList* chats, const char* who );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
272
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
273 void mxit_cb_rx( gpointer data, gint source, PurpleInputCondition cond );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
274 gboolean mxit_manage_queue( gpointer user_data );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
275 gboolean mxit_manage_polling( gpointer user_data );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
276
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
277 void mxit_send_register( struct MXitSession* session );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
278 void mxit_send_login( struct MXitSession* session );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
279 void mxit_send_logout( struct MXitSession* session );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
280 void mxit_send_ping( struct MXitSession* session );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
281 void mxit_send_poll( struct MXitSession* session );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
282
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
283 void mxit_send_presence( struct MXitSession* session, int presence, const char* statusmsg );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
284 void mxit_send_mood( struct MXitSession* session, int mood );
29782
81ea740f92a4 Add extra parameter to mxit_send_message() function to indicate if the message should be
andrew.victor@mxit.com
parents: 28903
diff changeset
285 void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup, gboolean is_command );
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
286
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
287 void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
288 void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
289
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
290 void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
291 void mxit_send_remove( struct MXitSession* session, const char* username );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
292 void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
293 void mxit_send_deny_sub( struct MXitSession* session, const char* username );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
294 void mxit_send_update_contact( struct MXitSession* session, const char* username, const char* alias, const char* groupname );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
295 void mxit_send_splashclick( struct MXitSession* session, const char* splashid );
30356
4232e6b27bea Add support for message delivery notification.
andrew.victor@mxit.com
parents: 29782
diff changeset
296 void mxit_send_msgevent( struct MXitSession* session, const char* to, const char* id, int event);
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
297
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
298 void mxit_send_file( struct MXitSession* session, const char* username, const char* filename, const unsigned char* buf, int buflen );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
299 void mxit_send_file_reject( struct MXitSession* session, const char* fileid );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
300 void mxit_send_file_accept( struct MXitSession* session, const char* fileid, int filesize, int offset );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
301 void mxit_send_file_received( struct MXitSession* session, const char* fileid, short status );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
302 void mxit_set_avatar( struct MXitSession* session, const unsigned char* avatar, int avatarlen );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
303 void mxit_get_avatar( struct MXitSession* session, const char* mxitId, const char* avatarId );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
304
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
305 void mxit_send_groupchat_create( struct MXitSession* session, const char* groupname, int nr_usernames, const char* usernames[] );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
306 void mxit_send_groupchat_invite( struct MXitSession* session, const char* roomid, int nr_usernames, const char* usernames[] );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
307
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
308 int mxit_parse_packet( struct MXitSession* session );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
309 void dump_bytes( struct MXitSession* session, const char* buf, int len );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
310 void mxit_close_connection( struct MXitSession* session );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
311
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
312
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
313 #endif /* _MXIT_PROTO_H_ */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
314