annotate libpurple/protocols/mxit/chunk.h @ 31960:c5bdf87770df

* Handle response to SendFile chunk packet, and display the error message if the file transfer failed. * Enable protocol version 6.3.
author andrew.victor@mxit.com
date Tue, 12 Apr 2011 21:25:51 +0000
parents 754459ff7b23
children
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 * -- handle chunked data (multimedia messages) --
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_CHUNK_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_CHUNK_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 #include "roster.h"
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
31
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
32
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
33 #define MXIT_CHUNK_FILEID_LEN 8 /* bytes */
29036
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
34 #define MXIT_CHUNK_HEADER_SIZE 5 /* type (1 byte) + length (4 bytes) */
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
35
28903
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 /* Multimedia chunk types */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
38 #define CP_CHUNK_NONE 0x00 /* (0) no chunk */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
39 #define CP_CHUNK_CUSTOM 0x01 /* (1) custom resource */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
40 #define CP_CHUNK_SPLASH 0x02 /* (2) splash image */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
41 #define CP_CHUNK_CLICK 0x03 /* (3) splash click through */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
42 #define CP_CHUNK_OFFER 0x06 /* (6) offer file */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
43 #define CP_CHUNK_REJECT 0x07 /* (7) reject file */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
44 #define CP_CHUNK_GET 0x08 /* (8) get file */
30379
815bd8b41638 I before E, except after C
Stu Tomlinson <stu@nosnilmot.com>
parents: 29036
diff changeset
45 #define CP_CHUNK_RECEIVED 0x09 /* (9) received file */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
46 #define CP_CHUNK_DIRECT_SND 0x0A /* (10) send file direct */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
47 #define CP_CHUNK_DIRECT_FWD 0x0B /* (11) forward file direct */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
48 #define CP_CHUNK_SKIN 0x0C /* (12) MXit client skin */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
49 #define CP_CHUNK_SET_AVATAR 0x0D /* (13) set avatar */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
50 #define CP_CHUNK_GET_AVATAR 0x0E /* (14) get avatar */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
51 #define CP_CHUNK_END 0x7E /* (126) end */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
52 #define CP_CHUNK_EXT 0x7F /* (127) extended type */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
53
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
54
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
55 /* Custom Resource operations */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
56 #define CR_OP_UPDATE 0
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
57 #define CR_OP_REMOVE 1
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
58
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
59 /* File Received status */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
60 #define RECV_STATUS_SUCCESS 0
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
61 #define RECV_STATUS_PARSE_FAIL 1
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
62 #define RECV_STATUS_CANNOT_OPEN 8
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
63 #define RECV_STATUS_BAD_CRC 9
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
64 #define RECV_STATUS_BAD_ID 10
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
65
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
66 /* File Reject status */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
67 #define REJECT_BY_USER 1
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
68 #define REJECT_FILETYPE 2
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
69 #define REJECT_NO_RESOURCES 3
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
70 #define REJECT_BAD_RECIPIENT 4
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
71
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
72 /*
29036
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
73 * Chunk header manipulation functions
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
74 */
29036
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
75 static inline guint chunk_type( gchar* chunkheader )
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
76 {
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
77 return *chunkheader;
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
78 }
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
79
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
80 static inline void set_chunk_type( gchar* chunkheader, guint type )
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
81 {
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
82 *chunkheader = type;
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
83 }
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
84
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
85 static inline guint32 chunk_length( gchar* chunkheader )
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
86 {
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
87 guint32 length = *( (const guint32*) &chunkheader[1] );
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
88 return htonl( length );
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
89 }
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
90
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
91 static inline void set_chunk_length( gchar* chunkheader, guint32 size )
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
92 {
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
93 size = htonl( size );
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
94 memcpy( &chunkheader[1], &size, sizeof( guint32 ) );
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
95 }
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
96
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
97 static inline gchar* chunk_data( gchar* chunkheader )
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
98 {
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
99 return &chunkheader[MXIT_CHUNK_HEADER_SIZE];
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
100 }
06fabb28bc69 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
andrew.victor@mxit.com
parents: 28903
diff changeset
101
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
102 /*
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
103 * Offer File chunk (6).
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
104 */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
105 struct offerfile_chunk {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
106 char fileid[MXIT_CHUNK_FILEID_LEN];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
107 char username[MXIT_CP_MAX_JID_LEN + 1];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
108 int filesize;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
109 char filename[FILENAME_MAX];
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
110 char mimetype[64];
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
111 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
112
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
113 /*
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
114 * Get File chunk (8) response.
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
115 */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
116 struct getfile_chunk {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
117 char fileid[MXIT_CHUNK_FILEID_LEN];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
118 int offset;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
119 int length;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
120 int crc;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
121 char* data;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
122 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
123
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
124 /*
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
125 * Custom Resource chunk (1).
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
126 */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
127 struct cr_chunk {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
128 char id[64];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
129 char handle[64];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
130 char operation;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
131 GList* resources;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
132 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
133
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
134 /*
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
135 * Splash Image chunk (2)
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
136 */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
137 struct splash_chunk {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
138 char anchor;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
139 char showtime;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
140 int bgcolor;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
141 char* data;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
142 int datalen;
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
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
145 /*
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
146 * Splash Click Through chunk (3)
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
147 */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
148 struct splash_click_chunk {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
149 char reserved[1];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
150 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
151
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
152 /*
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
153 * Get Avatar chunk (14) response.
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
154 */
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
155 struct getavatar_chunk {
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
156 char mxitid[50];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
157 char avatarid[64];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
158 char format[16];
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
159 char bitdepth;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
160 int crc;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
161 int width;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
162 int height;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
163 int length;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
164 char* data;
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
165 };
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
166
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
167 /*
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
168 * Send File Direct chunk (10) response.
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
169 */
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
170 struct sendfile_chunk {
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
171 char username[MXIT_CP_MAX_JID_LEN + 1];
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
172 int status;
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
173 char statusmsg[1024];
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
174 };
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
175
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
176 /* Encode chunk */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
177 int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
178 int mxit_chunk_create_reject( char* chunkdata, const char* fileid );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
179 int mxit_chunk_create_get( char* chunkdata, 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
180 int mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
181 int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen );
31741
754459ff7b23 * removed unneeded variable passing.
pieter.loubser@mxit.com
parents: 30379
diff changeset
182 int mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId );
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
183
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
184 /* Decode chunk */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
185 void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
186 void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
187 void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr );
31960
c5bdf87770df * Handle response to SendFile chunk packet, and display the error message
andrew.victor@mxit.com
parents: 31741
diff changeset
188 void mxit_chunk_parse_sendfile( char* chunkdata, int datalen, struct sendfile_chunk* sendfile );
28903
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
189 void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar );
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
190
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
191 #endif /* _MXIT_CHUNK_H_ */
69aa4660401a Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
192