comparison 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
comparison
equal deleted inserted replaced
31959:efed7d3c5574 31960:c5bdf87770df
97 static inline gchar* chunk_data( gchar* chunkheader ) 97 static inline gchar* chunk_data( gchar* chunkheader )
98 { 98 {
99 return &chunkheader[MXIT_CHUNK_HEADER_SIZE]; 99 return &chunkheader[MXIT_CHUNK_HEADER_SIZE];
100 } 100 }
101 101
102 102 /*
103 * Offer File chunk (6).
104 */
103 struct offerfile_chunk { 105 struct offerfile_chunk {
104 char fileid[MXIT_CHUNK_FILEID_LEN]; 106 char fileid[MXIT_CHUNK_FILEID_LEN];
105 char username[MXIT_CP_MAX_JID_LEN + 1]; 107 char username[MXIT_CP_MAX_JID_LEN + 1];
106 int filesize; 108 int filesize;
107 char filename[FILENAME_MAX]; 109 char filename[FILENAME_MAX];
110 char mimetype[64];
108 }; 111 };
109 112
113 /*
114 * Get File chunk (8) response.
115 */
110 struct getfile_chunk { 116 struct getfile_chunk {
111 char fileid[MXIT_CHUNK_FILEID_LEN]; 117 char fileid[MXIT_CHUNK_FILEID_LEN];
112 int offset; 118 int offset;
113 int length; 119 int length;
114 int crc; 120 int crc;
115 char* data; 121 char* data;
116 }; 122 };
117 123
124 /*
125 * Custom Resource chunk (1).
126 */
118 struct cr_chunk { 127 struct cr_chunk {
119 char id[64]; 128 char id[64];
120 char handle[64]; 129 char handle[64];
121 char operation; 130 char operation;
122 GList* resources; 131 GList* resources;
123 }; 132 };
124 133
134 /*
135 * Splash Image chunk (2)
136 */
125 struct splash_chunk { 137 struct splash_chunk {
126 char anchor; 138 char anchor;
127 char showtime; 139 char showtime;
128 int bgcolor; 140 int bgcolor;
129 char* data; 141 char* data;
130 int datalen; 142 int datalen;
131 }; 143 };
132 144
145 /*
146 * Splash Click Through chunk (3)
147 */
133 struct splash_click_chunk { 148 struct splash_click_chunk {
134 char reserved[1]; 149 char reserved[1];
135 }; 150 };
136 151
152 /*
153 * Get Avatar chunk (14) response.
154 */
137 struct getavatar_chunk { 155 struct getavatar_chunk {
138 char mxitid[50]; 156 char mxitid[50];
139 char avatarid[64]; 157 char avatarid[64];
140 char format[16]; 158 char format[16];
141 char bitdepth; 159 char bitdepth;
142 int crc; 160 int crc;
143 int width; 161 int width;
144 int height; 162 int height;
145 int length; 163 int length;
146 char* data; 164 char* data;
165 };
166
167 /*
168 * Send File Direct chunk (10) response.
169 */
170 struct sendfile_chunk {
171 char username[MXIT_CP_MAX_JID_LEN + 1];
172 int status;
173 char statusmsg[1024];
147 }; 174 };
148 175
149 /* Encode chunk */ 176 /* Encode chunk */
150 int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen ); 177 int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen );
151 int mxit_chunk_create_reject( char* chunkdata, const char* fileid ); 178 int mxit_chunk_create_reject( char* chunkdata, const char* fileid );
156 183
157 /* Decode chunk */ 184 /* Decode chunk */
158 void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer ); 185 void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer );
159 void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile ); 186 void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile );
160 void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr ); 187 void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr );
188 void mxit_chunk_parse_sendfile( char* chunkdata, int datalen, struct sendfile_chunk* sendfile );
161 void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar ); 189 void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar );
162 190
163 #endif /* _MXIT_CHUNK_H_ */ 191 #endif /* _MXIT_CHUNK_H_ */
164 192