14192
|
1 /*
|
|
2 * gaim
|
|
3 *
|
|
4 * Gaim is the legal property of its developers, whose names are too numerous
|
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
6 * source distribution.
|
|
7 *
|
|
8 * This program is free software; you can redistribute it and/or modify
|
|
9 * it under the terms of the GNU General Public License as published by
|
|
10 * the Free Software Foundation; either version 2 of the License, or
|
|
11 * (at your option) any later version.
|
|
12 *
|
|
13 * This program is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 * GNU General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU General Public License
|
|
19 * along with this program; if not, write to the Free Software
|
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21 *
|
|
22 */
|
|
23
|
|
24 /******************************************************************************
|
|
25 * INCLUDES
|
|
26 *****************************************************************************/
|
|
27 #include "internal.h"
|
|
28
|
|
29 #include "account.h"
|
|
30 #include "accountopt.h"
|
|
31 #include "blist.h"
|
|
32 #include "cipher.h"
|
|
33 #include "cmds.h"
|
|
34 #include "debug.h"
|
|
35 #include "notify.h"
|
|
36 #include "privacy.h"
|
|
37 #include "prpl.h"
|
|
38 #include "proxy.h"
|
|
39 #include "request.h"
|
|
40 #include "server.h"
|
|
41 #include "util.h"
|
|
42 #include "version.h"
|
|
43
|
|
44 #include "yahoo.h"
|
|
45 #include "yahoo_packet.h"
|
|
46 #include "yahoo_friend.h"
|
|
47 #include "yahoochat.h"
|
|
48 #include "ycht.h"
|
|
49 #include "yahoo_auth.h"
|
|
50 #include "yahoo_filexfer.h"
|
|
51 #include "yahoo_picture.h"
|
|
52
|
|
53 #include "whiteboard.h"
|
|
54 #include "yahoo_doodle.h"
|
|
55
|
|
56 /******************************************************************************
|
|
57 * Globals
|
|
58 *****************************************************************************/
|
|
59 const int DefaultColorRGB24[] =
|
|
60 {
|
|
61 DOODLE_COLOR_RED,
|
|
62 DOODLE_COLOR_ORANGE,
|
|
63 DOODLE_COLOR_YELLOW,
|
|
64 DOODLE_COLOR_GREEN,
|
|
65 DOODLE_COLOR_CYAN,
|
|
66 DOODLE_COLOR_BLUE,
|
|
67 DOODLE_COLOR_VIOLET,
|
|
68 DOODLE_COLOR_PURPLE,
|
|
69 DOODLE_COLOR_TAN,
|
|
70 DOODLE_COLOR_BROWN,
|
|
71 DOODLE_COLOR_BLACK,
|
|
72 DOODLE_COLOR_GREY,
|
|
73 DOODLE_COLOR_WHITE
|
|
74 };
|
|
75
|
|
76 /******************************************************************************
|
|
77 * Functions
|
|
78 *****************************************************************************/
|
|
79 GaimCmdRet yahoo_doodle_gaim_cmd_start(GaimConversation *conv, const char *cmd, char **args, char **error, void *data)
|
|
80 {
|
|
81 GaimAccount *account;
|
|
82 GaimConnection *gc;
|
|
83 const gchar *name;
|
|
84
|
|
85 if(*args && args[0])
|
|
86 return GAIM_CMD_RET_FAILED;
|
|
87
|
|
88 account = gaim_conversation_get_account(conv);
|
|
89 gc = gaim_account_get_connection(account);
|
|
90 name = gaim_conversation_get_name(conv);
|
|
91 yahoo_doodle_initiate(gc, name);
|
|
92
|
|
93 /* Write a local message to this conversation showing that a request for a
|
|
94 * Doodle session has been made
|
|
95 */
|
|
96 gaim_conv_im_write(GAIM_CONV_IM(conv), "", _("Sent Doodle request."),
|
|
97 GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time(NULL));
|
|
98
|
|
99 return GAIM_CMD_RET_OK;
|
|
100 }
|
|
101
|
|
102 void yahoo_doodle_initiate(GaimConnection *gc, const char *name)
|
|
103 {
|
|
104 GaimAccount *account;
|
|
105 char *to = (char*)name;
|
|
106 GaimWhiteboard *wb;
|
|
107
|
|
108 g_return_if_fail(gc);
|
|
109 g_return_if_fail(name);
|
|
110
|
|
111 account = gaim_connection_get_account(gc);
|
|
112 wb = gaim_whiteboard_get_session(account, to);
|
|
113
|
|
114 if(wb == NULL)
|
|
115 {
|
|
116 /* Insert this 'session' in the list. At this point, it's only a
|
|
117 * requested session.
|
|
118 */
|
|
119 gaim_whiteboard_create(account, to, DOODLE_STATE_REQUESTING);
|
|
120 }
|
|
121
|
|
122 /* NOTE Perhaps some careful handling of remote assumed established
|
|
123 * sessions
|
|
124 */
|
|
125
|
|
126 yahoo_doodle_command_send_request(gc, to);
|
|
127 yahoo_doodle_command_send_ready(gc, to);
|
|
128
|
|
129 }
|
|
130
|
|
131 void yahoo_doodle_process(GaimConnection *gc, const char *me, const char *from,
|
|
132 const char *command, const char *message)
|
|
133 {
|
|
134 if(!command)
|
|
135 return;
|
|
136
|
|
137 /* Now check to see what sort of Doodle message it is */
|
|
138 switch(atoi(command))
|
|
139 {
|
|
140 case DOODLE_CMD_REQUEST:
|
|
141 yahoo_doodle_command_got_request(gc, from);
|
|
142 break;
|
|
143
|
|
144 case DOODLE_CMD_READY:
|
|
145 yahoo_doodle_command_got_ready(gc, from);
|
|
146 break;
|
|
147
|
|
148 case DOODLE_CMD_CLEAR:
|
|
149 yahoo_doodle_command_got_clear(gc, from);
|
|
150 break;
|
|
151
|
|
152 case DOODLE_CMD_DRAW:
|
|
153 yahoo_doodle_command_got_draw(gc, from, message);
|
|
154 break;
|
|
155
|
|
156 case DOODLE_CMD_EXTRA:
|
|
157 yahoo_doodle_command_got_extra(gc, from, message);
|
|
158 break;
|
|
159
|
|
160 case DOODLE_CMD_CONFIRM:
|
|
161 yahoo_doodle_command_got_confirm(gc, from);
|
|
162 break;
|
|
163 }
|
|
164 }
|
|
165
|
|
166 void yahoo_doodle_command_got_request(GaimConnection *gc, const char *from)
|
|
167 {
|
|
168 GaimAccount *account;
|
|
169 GaimWhiteboard *wb;
|
|
170
|
|
171 gaim_debug_info("yahoo", "doodle: Got Request (%s)\n", from);
|
|
172
|
|
173 account = gaim_connection_get_account(gc);
|
|
174
|
|
175 /* Only handle this if local client requested Doodle session (else local
|
|
176 * client would have sent one)
|
|
177 */
|
|
178 wb = gaim_whiteboard_get_session(account, from);
|
|
179
|
|
180 /* If a session with the remote user doesn't exist */
|
|
181 if(wb == NULL)
|
|
182 {
|
|
183 /* Ask user if they wish to accept the request for a doodle session */
|
|
184 /* TODO Ask local user to start Doodle session with remote user */
|
|
185 /* NOTE This if/else statement won't work right--must use dialog
|
|
186 * results
|
|
187 */
|
|
188
|
|
189 /* char dialog_message[64];
|
|
190 g_sprintf(dialog_message, "%s is requesting to start a Doodle session with you.", from);
|
|
191
|
|
192 gaim_notify_message(NULL, GAIM_NOTIFY_MSG_INFO, "Doodle",
|
|
193 dialog_message, NULL, NULL, NULL);
|
|
194 */
|
|
195
|
|
196 gaim_whiteboard_create(account, from, DOODLE_STATE_REQUESTED);
|
|
197
|
|
198 yahoo_doodle_command_send_request(gc, from);
|
|
199 }
|
|
200
|
|
201 /* TODO Might be required to clear the canvas of an existing doodle
|
|
202 * session at this point
|
|
203 */
|
|
204 }
|
|
205
|
|
206 void yahoo_doodle_command_got_ready(GaimConnection *gc, const char *from)
|
|
207 {
|
|
208 GaimAccount *account;
|
|
209 GaimWhiteboard *wb;
|
|
210
|
|
211 gaim_debug_info("yahoo", "doodle: Got Ready (%s)\n", from);
|
|
212
|
|
213 account = gaim_connection_get_account(gc);
|
|
214
|
|
215 /* Only handle this if local client requested Doodle session (else local
|
|
216 * client would have sent one)
|
|
217 */
|
|
218 wb = gaim_whiteboard_get_session(account, from);
|
|
219
|
|
220 if(wb == NULL)
|
|
221 return;
|
|
222
|
|
223 if(wb->state == DOODLE_STATE_REQUESTING)
|
|
224 {
|
|
225 gaim_whiteboard_start(wb);
|
|
226
|
|
227 wb->state = DOODLE_STATE_ESTABLISHED;
|
|
228
|
|
229 yahoo_doodle_command_send_confirm(gc, from);
|
|
230 }
|
|
231
|
|
232 if(wb->state == DOODLE_STATE_ESTABLISHED)
|
|
233 {
|
|
234 /* TODO Ask whether to save picture too */
|
|
235 gaim_whiteboard_clear(wb);
|
|
236 }
|
|
237
|
|
238 /* NOTE Not sure about this... I am trying to handle if the remote user
|
|
239 * already thinks we're in a session with them (when their chat message
|
|
240 * contains the doodle;11 imv key)
|
|
241 */
|
|
242 if(wb->state == DOODLE_STATE_REQUESTED)
|
|
243 {
|
|
244 /* gaim_whiteboard_start(wb); */
|
|
245 yahoo_doodle_command_send_request(gc, from);
|
|
246 }
|
|
247 }
|
|
248
|
|
249 void yahoo_doodle_command_got_draw(GaimConnection *gc, const char *from, const char *message)
|
|
250 {
|
|
251 GaimAccount *account;
|
|
252 GaimWhiteboard *wb;
|
|
253 char **tokens;
|
|
254 int i;
|
|
255 GList *d_list = NULL; /* a local list of drawing info */
|
|
256
|
|
257 g_return_if_fail(message != NULL);
|
|
258
|
|
259 gaim_debug_info("yahoo", "doodle: Got Draw (%s)\n", from);
|
|
260 gaim_debug_info("yahoo", "doodle: Draw message: %s\n", message);
|
|
261
|
|
262 account = gaim_connection_get_account(gc);
|
|
263
|
|
264 /* Only handle this if local client requested Doodle session (else local
|
|
265 * client would have sent one)
|
|
266 */
|
|
267 wb = gaim_whiteboard_get_session(account, from);
|
|
268
|
|
269 if(wb == NULL)
|
|
270 return;
|
|
271
|
|
272 /* TODO Functionalize
|
|
273 * Convert drawing packet message to an integer list
|
|
274 */
|
|
275
|
|
276 /* Check to see if the message begans and ends with quotes */
|
|
277 if((message[0] != '\"') || (message[strlen(message) - 1] != '\"'))
|
|
278 return;
|
|
279
|
|
280 /* Ignore the inital quotation mark. */
|
|
281 message += 1;
|
|
282
|
|
283 tokens = g_strsplit(message, ",", 0);
|
|
284
|
|
285 /* Traverse and extract all integers divided by commas */
|
|
286 for (i = 0; tokens[i] != NULL; i++)
|
|
287 {
|
|
288 int last = strlen(tokens[i]) - 1;
|
|
289 if (tokens[i][last] == '"')
|
|
290 tokens[i][last] = '\0';
|
|
291
|
|
292 d_list = g_list_prepend(d_list, GINT_TO_POINTER(atoi(tokens[i])));
|
|
293 }
|
|
294 d_list = g_list_reverse(d_list);
|
|
295
|
|
296 g_strfreev(tokens);
|
|
297
|
|
298 yahoo_doodle_draw_stroke(wb, d_list);
|
|
299
|
|
300 /* goodle_doodle_session_set_canvas_as_icon(ds); */
|
|
301
|
|
302 g_list_free(d_list);
|
|
303 }
|
|
304
|
|
305 void yahoo_doodle_command_got_clear(GaimConnection *gc, const char *from)
|
|
306 {
|
|
307 GaimAccount *account;
|
|
308 GaimWhiteboard *wb;
|
|
309
|
|
310 gaim_debug_info("yahoo", "doodle: Got Clear (%s)\n", from);
|
|
311
|
|
312 account = gaim_connection_get_account(gc);
|
|
313
|
|
314 /* Only handle this if local client requested Doodle session (else local
|
|
315 * client would have sent one)
|
|
316 */
|
|
317 wb = gaim_whiteboard_get_session(account, from);
|
|
318
|
|
319 if(wb == NULL)
|
|
320 return;
|
|
321
|
|
322 if(wb->state == DOODLE_STATE_ESTABLISHED)
|
|
323 {
|
|
324 /* TODO Ask user whether to save the image before clearing it */
|
|
325
|
|
326 gaim_whiteboard_clear(wb);
|
|
327 }
|
|
328 }
|
|
329
|
|
330 void
|
|
331 yahoo_doodle_command_got_extra(GaimConnection *gc, const char *from, const char *message)
|
|
332 {
|
|
333 gaim_debug_info("yahoo", "doodle: Got Extra (%s)\n", from);
|
|
334
|
|
335 /* I do not like these 'extra' features, so I'll only handle them in one
|
|
336 * way, which is returning them with the command/packet to turn them off
|
|
337 */
|
|
338 yahoo_doodle_command_send_extra(gc, from, DOODLE_EXTRA_NONE);
|
|
339 }
|
|
340
|
|
341 void yahoo_doodle_command_got_confirm(GaimConnection *gc, const char *from)
|
|
342 {
|
|
343 GaimAccount *account;
|
|
344 GaimWhiteboard *wb;
|
|
345
|
|
346 gaim_debug_info("yahoo", "doodle: Got Confirm (%s)\n", from);
|
|
347
|
|
348 /* Get the doodle session */
|
|
349 account = gaim_connection_get_account(gc);
|
|
350
|
|
351 /* Only handle this if local client requested Doodle session (else local
|
|
352 * client would have sent one)
|
|
353 */
|
|
354 wb = gaim_whiteboard_get_session(account, from);
|
|
355
|
|
356 if(wb == NULL)
|
|
357 return;
|
|
358
|
|
359 /* TODO Combine the following IF's? */
|
|
360
|
|
361 /* Check if we requested a doodle session */
|
|
362 if(wb->state == DOODLE_STATE_REQUESTING)
|
|
363 {
|
|
364 wb->state = DOODLE_STATE_ESTABLISHED;
|
|
365
|
|
366 gaim_whiteboard_start(wb);
|
|
367
|
|
368 yahoo_doodle_command_send_confirm(gc, from);
|
|
369 }
|
|
370
|
|
371 /* Check if we accepted a request for a doodle session */
|
|
372 if(wb->state == DOODLE_STATE_REQUESTED)
|
|
373 {
|
|
374 wb->state = DOODLE_STATE_ESTABLISHED;
|
|
375
|
|
376 gaim_whiteboard_start(wb);
|
|
377 }
|
|
378 }
|
|
379
|
|
380 void yahoo_doodle_command_got_shutdown(GaimConnection *gc, const char *from)
|
|
381 {
|
|
382 GaimAccount *account;
|
|
383 GaimWhiteboard *wb;
|
|
384
|
|
385 g_return_if_fail(from != NULL);
|
|
386
|
|
387 gaim_debug_info("yahoo", "doodle: Got Shutdown (%s)\n", from);
|
|
388
|
|
389 account = gaim_connection_get_account(gc);
|
|
390
|
|
391 /* Only handle this if local client requested Doodle session (else local
|
|
392 * client would have sent one)
|
|
393 */
|
|
394 wb = gaim_whiteboard_get_session(account, from);
|
|
395
|
|
396 /* TODO Ask if user wants to save picture before the session is closed */
|
|
397
|
|
398 /* If this session doesn't exist, don't try and kill it */
|
|
399 if(wb == NULL)
|
|
400 return;
|
|
401 else
|
|
402 {
|
|
403 gaim_whiteboard_destroy(wb);
|
|
404
|
|
405 /* yahoo_doodle_command_send_shutdown(gc, from); */
|
|
406 }
|
|
407 }
|
|
408
|
|
409 static void yahoo_doodle_command_send_generic(const char *type,
|
|
410 GaimConnection *gc,
|
|
411 const char *to,
|
|
412 const char *message,
|
|
413 const char *thirteen,
|
|
414 const char *sixtythree,
|
|
415 const char *sixtyfour)
|
|
416 {
|
|
417 struct yahoo_data *yd;
|
|
418 struct yahoo_packet *pkt;
|
|
419
|
|
420 gaim_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to);
|
|
421
|
|
422 yd = gc->proto_data;
|
|
423
|
|
424 /* Make and send an acknowledge (ready) Doodle packet */
|
|
425 pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0);
|
|
426 yahoo_packet_hash_str(pkt, 49, "IMVIRONMENT");
|
|
427 yahoo_packet_hash_str(pkt, 1, gaim_account_get_username(gc->account));
|
|
428 yahoo_packet_hash_str(pkt, 14, message);
|
|
429 yahoo_packet_hash_str(pkt, 13, thirteen);
|
|
430 yahoo_packet_hash_str(pkt, 5, to);
|
|
431 yahoo_packet_hash_str(pkt, 63, sixtythree ? sixtythree : "doodle;11");
|
|
432 yahoo_packet_hash_str(pkt, 64, sixtyfour);
|
|
433 yahoo_packet_hash_str(pkt, 1002, "1");
|
|
434
|
|
435 yahoo_packet_send_and_free(pkt, yd);
|
|
436 }
|
|
437
|
|
438 void yahoo_doodle_command_send_request(GaimConnection *gc, const char *to)
|
|
439 {
|
|
440 yahoo_doodle_command_send_generic("Request", gc, to, "1", "1", NULL, "1");
|
|
441 }
|
|
442
|
|
443 void yahoo_doodle_command_send_ready(GaimConnection *gc, const char *to)
|
|
444 {
|
|
445 yahoo_doodle_command_send_generic("Ready", gc, to, "", "0", NULL, "0");
|
|
446 }
|
|
447
|
|
448 void yahoo_doodle_command_send_draw(GaimConnection *gc, const char *to, const char *message)
|
|
449 {
|
|
450 yahoo_doodle_command_send_generic("Draw", gc, to, message, "3", NULL, "1");
|
|
451 }
|
|
452
|
|
453 void yahoo_doodle_command_send_clear(GaimConnection *gc, const char *to)
|
|
454 {
|
|
455 yahoo_doodle_command_send_generic("Clear", gc, to, " ", "2", NULL, "1");
|
|
456 }
|
|
457
|
|
458 void yahoo_doodle_command_send_extra(GaimConnection *gc, const char *to, const char *message)
|
|
459 {
|
|
460 yahoo_doodle_command_send_generic("Extra", gc, to, message, "4", NULL, "1");
|
|
461 }
|
|
462
|
|
463 void yahoo_doodle_command_send_confirm(GaimConnection *gc, const char *to)
|
|
464 {
|
|
465 yahoo_doodle_command_send_generic("Confirm", gc, to, "1", "5", NULL, "1");
|
|
466 }
|
|
467
|
|
468 void yahoo_doodle_command_send_shutdown(GaimConnection *gc, const char *to)
|
|
469 {
|
|
470 yahoo_doodle_command_send_generic("Shutdown", gc, to, "", "0", ";0", "0");
|
|
471 }
|
|
472
|
|
473 void yahoo_doodle_start(GaimWhiteboard *wb)
|
|
474 {
|
|
475 doodle_session *ds = g_new0(doodle_session, 1);
|
|
476
|
|
477 /* gaim_debug_debug("yahoo", "doodle: yahoo_doodle_start()\n"); */
|
|
478
|
|
479 /* Set default brush size and color */
|
|
480 ds->brush_size = DOODLE_BRUSH_SMALL;
|
|
481 ds->brush_color = DOODLE_COLOR_RED;
|
|
482
|
|
483 wb->proto_data = ds;
|
|
484 }
|
|
485
|
|
486 void yahoo_doodle_end(GaimWhiteboard *wb)
|
|
487 {
|
|
488 GaimConnection *gc = gaim_account_get_connection(wb->account);
|
|
489
|
|
490 /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */
|
|
491
|
|
492 yahoo_doodle_command_send_shutdown(gc, wb->who);
|
|
493
|
|
494 g_free(wb->proto_data);
|
|
495 }
|
|
496
|
|
497 void yahoo_doodle_get_dimensions(GaimWhiteboard *wb, int *width, int *height)
|
|
498 {
|
|
499 /* standard Doodle canvases are of one size: 368x256 */
|
|
500 *width = DOODLE_CANVAS_WIDTH;
|
|
501 *height = DOODLE_CANVAS_HEIGHT;
|
|
502 }
|
|
503
|
|
504 static char *yahoo_doodle_build_draw_string(doodle_session *ds, GList *draw_list)
|
|
505 {
|
|
506 GString *message;
|
|
507
|
|
508 g_return_val_if_fail(draw_list != NULL, NULL);
|
|
509
|
|
510 message = g_string_new("");
|
|
511 g_string_printf(message, "\"%d,%d", ds->brush_color, ds->brush_size);
|
|
512
|
|
513 for(; draw_list != NULL; draw_list = draw_list->next)
|
|
514 {
|
|
515 g_string_append_printf(message, ",%d", GPOINTER_TO_INT(draw_list->data));
|
|
516 }
|
|
517 g_string_append_c(message, '"');
|
|
518
|
|
519 return g_string_free(message, FALSE);
|
|
520 }
|
|
521
|
|
522 void yahoo_doodle_send_draw_list(GaimWhiteboard *wb, GList *draw_list)
|
|
523 {
|
|
524 doodle_session *ds = wb->proto_data;
|
|
525 char *message;
|
|
526
|
|
527 g_return_if_fail(draw_list != NULL);
|
|
528
|
|
529 message = yahoo_doodle_build_draw_string(ds, draw_list);
|
|
530 yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message);
|
|
531 g_free(message);
|
|
532 }
|
|
533
|
|
534 void yahoo_doodle_clear(GaimWhiteboard *wb)
|
|
535 {
|
|
536 yahoo_doodle_command_send_clear(wb->account->gc, wb->who);
|
|
537 }
|
|
538
|
|
539
|
|
540 /* Traverse through the list and draw the points and lines */
|
|
541 void yahoo_doodle_draw_stroke(GaimWhiteboard *wb, GList *draw_list)
|
|
542 {
|
|
543 int brush_color;
|
|
544 int brush_size;
|
|
545 int x;
|
|
546 int y;
|
|
547
|
|
548 g_return_if_fail(draw_list != NULL);
|
|
549
|
|
550 brush_color = GPOINTER_TO_INT(draw_list->data);
|
|
551 draw_list = draw_list->next;
|
|
552 g_return_if_fail(draw_list != NULL);
|
|
553
|
|
554 brush_size = GPOINTER_TO_INT(draw_list->data);
|
|
555 draw_list = draw_list->next;
|
|
556 g_return_if_fail(draw_list != NULL);
|
|
557
|
|
558 x = GPOINTER_TO_INT(draw_list->data);
|
|
559 draw_list = draw_list->next;
|
|
560 g_return_if_fail(draw_list != NULL);
|
|
561
|
|
562 y = GPOINTER_TO_INT(draw_list->data);
|
|
563 draw_list = draw_list->next;
|
|
564 g_return_if_fail(draw_list != NULL);
|
|
565
|
|
566 /*
|
|
567 gaim_debug_debug("yahoo", "doodle: Drawing: color=%d, size=%d, (%d,%d)\n", brush_color, brush_size, x, y);
|
|
568 */
|
|
569
|
|
570 while(draw_list != NULL && draw_list->next != NULL)
|
|
571 {
|
|
572 int dx = GPOINTER_TO_INT(draw_list->data);
|
|
573 int dy = GPOINTER_TO_INT(draw_list->next->data);
|
|
574
|
|
575 gaim_whiteboard_draw_line(wb,
|
|
576 x, y,
|
|
577 x + dx, y + dy,
|
|
578 brush_color, brush_size);
|
|
579
|
|
580 x += dx;
|
|
581 y += dy;
|
|
582
|
|
583 draw_list = draw_list->next->next;
|
|
584 }
|
|
585 }
|
|
586
|
|
587 void yahoo_doodle_get_brush(GaimWhiteboard *wb, int *size, int *color)
|
|
588 {
|
|
589 doodle_session *ds = (doodle_session *)wb->proto_data;
|
|
590 *size = ds->brush_size;
|
|
591 *color = ds->brush_color;
|
|
592 }
|
|
593
|
|
594 void yahoo_doodle_set_brush(GaimWhiteboard *wb, int size, int color)
|
|
595 {
|
|
596 doodle_session *ds = (doodle_session *)wb->proto_data;
|
|
597 ds->brush_size = size;
|
|
598 ds->brush_color = color;
|
|
599
|
|
600 /* Notify the core about the changes */
|
|
601 gaim_whiteboard_set_brush(wb, size, color);
|
|
602 }
|
|
603
|