comparison libpurple/protocols/silc/wb.c @ 17568:980a104267da

Patch from Pekka Riikonen to update the SILC protocol plugin to work with SILC Toolkit 1.1 I added the fallback to SILC Toolkit 1.0 support (silc10 protocol directory) and configure.ac adjustments, any problems with this are 100% my fault.
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 09 Jun 2007 17:31:28 +0000
parents a5176db228b7
children 285bb637a2b7 6b02dba5bf41
comparison
equal deleted inserted replaced
17567:ba1b50f114f6 17568:980a104267da
2 2
3 wb.c 3 wb.c
4 4
5 Author: Pekka Riikonen <priikone@silcnet.org> 5 Author: Pekka Riikonen <priikone@silcnet.org>
6 6
7 Copyright (C) 2005 Pekka Riikonen 7 Copyright (C) 2005 - 2007 Pekka Riikonen
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License. 11 the Free Software Foundation; version 2 of the License.
12 12
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 */ 18 */
19 19
20 #include "silcincludes.h" 20 #include "silc.h"
21 #include "silcclient.h" 21 #include "silcclient.h"
22 #include "silcpurple.h" 22 #include "silcpurple.h"
23 #include "wb.h" 23 #include "wb.h"
24 24
25 /* 25 /*
28 1 byte command 28 1 byte command
29 2 bytes width 29 2 bytes width
30 2 bytes height 30 2 bytes height
31 4 bytes brush color 31 4 bytes brush color
32 2 bytes brush size 32 2 bytes brush size
33 n bytes data 33 n bytes data
34 34
35 Data: 35 Data:
36 36
37 4 bytes x 37 4 bytes x
38 4 bytes y 38 4 bytes y
202 if (ret < 0) 202 if (ret < 0)
203 return; 203 return;
204 silc_buffer_pull(&buf, 8); 204 silc_buffer_pull(&buf, 8);
205 x = dx; 205 x = dx;
206 y = dy; 206 y = dy;
207 while (buf.len > 0) { 207 while (silc_buffer_len(&buf) > 0) {
208 ret = silc_buffer_unformat(&buf, 208 ret = silc_buffer_unformat(&buf,
209 SILC_STR_UI_INT(&dx), 209 SILC_STR_UI_INT(&dx),
210 SILC_STR_UI_INT(&dy), 210 SILC_STR_UI_INT(&dy),
211 SILC_STR_END); 211 SILC_STR_END);
212 if (ret < 0) 212 if (ret < 0)
213 return; 213 return;
214 silc_buffer_pull(&buf, 8); 214 silc_buffer_pull(&buf, 8);
215 215
216 purple_whiteboard_draw_line(wb, x, y, x + dx, y + dy, 216 purple_whiteboard_draw_line(wb, x, y, x + dx, y + dy,
217 brush_color, brush_size); 217 brush_color, brush_size);
218 x += dx; 218 x += dx;
219 y += dy; 219 y += dy;
220 } 220 }
221 } 221 }
222 222
251 silc_free(req->message); 251 silc_free(req->message);
252 silc_free(req); 252 silc_free(req);
253 } 253 }
254 254
255 static void 255 static void
256 silcpurple_wb_request(SilcClient client, const unsigned char *message, 256 silcpurple_wb_request(SilcClient client, const unsigned char *message,
257 SilcUInt32 message_len, SilcClientEntry sender, 257 SilcUInt32 message_len, SilcClientEntry sender,
258 SilcChannelEntry channel) 258 SilcChannelEntry channel)
259 { 259 {
260 char tmp[128]; 260 char tmp[128];
261 SilcPurpleWbRequest req; 261 SilcPurpleWbRequest req;
262 PurpleConnection *gc; 262 PurpleConnection *gc;
404 } 404 }
405 405
406 /* Send the message */ 406 /* Send the message */
407 if (wbs->type == 0) { 407 if (wbs->type == 0) {
408 /* Private message */ 408 /* Private message */
409 silc_client_send_private_message(sg->client, sg->conn, 409 silc_client_send_private_message(sg->client, sg->conn,
410 wbs->u.client, 410 wbs->u.client,
411 SILC_MESSAGE_FLAG_DATA, 411 SILC_MESSAGE_FLAG_DATA, NULL,
412 packet->head, len, TRUE); 412 packet->head, len);
413 } else if (wbs->type == 1) { 413 } else if (wbs->type == 1) {
414 /* Channel message. Channel private keys are not supported. */ 414 /* Channel message. Channel private keys are not supported. */
415 silc_client_send_channel_message(sg->client, sg->conn, 415 silc_client_send_channel_message(sg->client, sg->conn,
416 wbs->u.channel, NULL, 416 wbs->u.channel, NULL,
417 SILC_MESSAGE_FLAG_DATA, 417 SILC_MESSAGE_FLAG_DATA, NULL,
418 packet->head, len, TRUE); 418 packet->head, len);
419 } 419 }
420 420
421 silc_buffer_free(packet); 421 silc_buffer_free(packet);
422 } 422 }
423 423
499 SILC_STR_END); 499 SILC_STR_END);
500 500
501 /* Send the message */ 501 /* Send the message */
502 if (wbs->type == 0) { 502 if (wbs->type == 0) {
503 /* Private message */ 503 /* Private message */
504 silc_client_send_private_message(sg->client, sg->conn, 504 silc_client_send_private_message(sg->client, sg->conn,
505 wbs->u.client, 505 wbs->u.client,
506 SILC_MESSAGE_FLAG_DATA, 506 SILC_MESSAGE_FLAG_DATA, NULL,
507 packet->head, len, TRUE); 507 packet->head, len);
508 } else if (wbs->type == 1) { 508 } else if (wbs->type == 1) {
509 /* Channel message */ 509 /* Channel message */
510 silc_client_send_channel_message(sg->client, sg->conn, 510 silc_client_send_channel_message(sg->client, sg->conn,
511 wbs->u.channel, NULL, 511 wbs->u.channel, NULL,
512 SILC_MESSAGE_FLAG_DATA, 512 SILC_MESSAGE_FLAG_DATA, NULL,
513 packet->head, len, TRUE); 513 packet->head, len);
514 } 514 }
515 515
516 silc_buffer_free(packet); 516 silc_buffer_free(packet);
517 } 517 }