comparison libpurple/protocols/yahoo/yahoo_doodle.c @ 15822:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents cf999f8e8a56
children 9b2cd6920475
comparison
equal deleted inserted replaced
15821:84b0f9b23ede 15822:32c366eeeb99
1 /* 1 /*
2 * gaim 2 * purple
3 * 3 *
4 * Gaim is the legal property of its developers, whose names are too numerous 4 * Purple 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 5 * to list here. Please refer to the COPYRIGHT file distributed with this
6 * source distribution. 6 * source distribution.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License as published by
76 #endif 76 #endif
77 77
78 /****************************************************************************** 78 /******************************************************************************
79 * Functions 79 * Functions
80 *****************************************************************************/ 80 *****************************************************************************/
81 GaimCmdRet yahoo_doodle_gaim_cmd_start(GaimConversation *conv, const char *cmd, char **args, char **error, void *data) 81 PurpleCmdRet yahoo_doodle_purple_cmd_start(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data)
82 { 82 {
83 GaimAccount *account; 83 PurpleAccount *account;
84 GaimConnection *gc; 84 PurpleConnection *gc;
85 const gchar *name; 85 const gchar *name;
86 86
87 if(*args && args[0]) 87 if(*args && args[0])
88 return GAIM_CMD_RET_FAILED; 88 return PURPLE_CMD_RET_FAILED;
89 89
90 account = gaim_conversation_get_account(conv); 90 account = purple_conversation_get_account(conv);
91 gc = gaim_account_get_connection(account); 91 gc = purple_account_get_connection(account);
92 name = gaim_conversation_get_name(conv); 92 name = purple_conversation_get_name(conv);
93 yahoo_doodle_initiate(gc, name); 93 yahoo_doodle_initiate(gc, name);
94 94
95 /* Write a local message to this conversation showing that a request for a 95 /* Write a local message to this conversation showing that a request for a
96 * Doodle session has been made 96 * Doodle session has been made
97 */ 97 */
98 gaim_conv_im_write(GAIM_CONV_IM(conv), "", _("Sent Doodle request."), 98 purple_conv_im_write(PURPLE_CONV_IM(conv), "", _("Sent Doodle request."),
99 GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time(NULL)); 99 PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_RECV, time(NULL));
100 100
101 return GAIM_CMD_RET_OK; 101 return PURPLE_CMD_RET_OK;
102 } 102 }
103 103
104 void yahoo_doodle_initiate(GaimConnection *gc, const char *name) 104 void yahoo_doodle_initiate(PurpleConnection *gc, const char *name)
105 { 105 {
106 GaimAccount *account; 106 PurpleAccount *account;
107 char *to = (char*)name; 107 char *to = (char*)name;
108 GaimWhiteboard *wb; 108 PurpleWhiteboard *wb;
109 109
110 g_return_if_fail(gc); 110 g_return_if_fail(gc);
111 g_return_if_fail(name); 111 g_return_if_fail(name);
112 112
113 account = gaim_connection_get_account(gc); 113 account = purple_connection_get_account(gc);
114 wb = gaim_whiteboard_get_session(account, to); 114 wb = purple_whiteboard_get_session(account, to);
115 115
116 if(wb == NULL) 116 if(wb == NULL)
117 { 117 {
118 /* Insert this 'session' in the list. At this point, it's only a 118 /* Insert this 'session' in the list. At this point, it's only a
119 * requested session. 119 * requested session.
120 */ 120 */
121 gaim_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); 121 purple_whiteboard_create(account, to, DOODLE_STATE_REQUESTING);
122 } 122 }
123 123
124 /* NOTE Perhaps some careful handling of remote assumed established 124 /* NOTE Perhaps some careful handling of remote assumed established
125 * sessions 125 * sessions
126 */ 126 */
128 yahoo_doodle_command_send_request(gc, to); 128 yahoo_doodle_command_send_request(gc, to);
129 yahoo_doodle_command_send_ready(gc, to); 129 yahoo_doodle_command_send_ready(gc, to);
130 130
131 } 131 }
132 132
133 void yahoo_doodle_process(GaimConnection *gc, const char *me, const char *from, 133 void yahoo_doodle_process(PurpleConnection *gc, const char *me, const char *from,
134 const char *command, const char *message) 134 const char *command, const char *message)
135 { 135 {
136 if(!command) 136 if(!command)
137 return; 137 return;
138 138
163 yahoo_doodle_command_got_confirm(gc, from); 163 yahoo_doodle_command_got_confirm(gc, from);
164 break; 164 break;
165 } 165 }
166 } 166 }
167 167
168 void yahoo_doodle_command_got_request(GaimConnection *gc, const char *from) 168 void yahoo_doodle_command_got_request(PurpleConnection *gc, const char *from)
169 { 169 {
170 GaimAccount *account; 170 PurpleAccount *account;
171 GaimWhiteboard *wb; 171 PurpleWhiteboard *wb;
172 172
173 gaim_debug_info("yahoo", "doodle: Got Request (%s)\n", from); 173 purple_debug_info("yahoo", "doodle: Got Request (%s)\n", from);
174 174
175 account = gaim_connection_get_account(gc); 175 account = purple_connection_get_account(gc);
176 176
177 /* Only handle this if local client requested Doodle session (else local 177 /* Only handle this if local client requested Doodle session (else local
178 * client would have sent one) 178 * client would have sent one)
179 */ 179 */
180 wb = gaim_whiteboard_get_session(account, from); 180 wb = purple_whiteboard_get_session(account, from);
181 181
182 /* If a session with the remote user doesn't exist */ 182 /* If a session with the remote user doesn't exist */
183 if(wb == NULL) 183 if(wb == NULL)
184 { 184 {
185 /* Ask user if they wish to accept the request for a doodle session */ 185 /* Ask user if they wish to accept the request for a doodle session */
189 */ 189 */
190 190
191 /* char dialog_message[64]; 191 /* char dialog_message[64];
192 g_sprintf(dialog_message, "%s is requesting to start a Doodle session with you.", from); 192 g_sprintf(dialog_message, "%s is requesting to start a Doodle session with you.", from);
193 193
194 gaim_notify_message(NULL, GAIM_NOTIFY_MSG_INFO, "Doodle", 194 purple_notify_message(NULL, PURPLE_NOTIFY_MSG_INFO, "Doodle",
195 dialog_message, NULL, NULL, NULL); 195 dialog_message, NULL, NULL, NULL);
196 */ 196 */
197 197
198 gaim_whiteboard_create(account, from, DOODLE_STATE_REQUESTED); 198 purple_whiteboard_create(account, from, DOODLE_STATE_REQUESTED);
199 199
200 yahoo_doodle_command_send_request(gc, from); 200 yahoo_doodle_command_send_request(gc, from);
201 } 201 }
202 202
203 /* TODO Might be required to clear the canvas of an existing doodle 203 /* TODO Might be required to clear the canvas of an existing doodle
204 * session at this point 204 * session at this point
205 */ 205 */
206 } 206 }
207 207
208 void yahoo_doodle_command_got_ready(GaimConnection *gc, const char *from) 208 void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *from)
209 { 209 {
210 GaimAccount *account; 210 PurpleAccount *account;
211 GaimWhiteboard *wb; 211 PurpleWhiteboard *wb;
212 212
213 gaim_debug_info("yahoo", "doodle: Got Ready (%s)\n", from); 213 purple_debug_info("yahoo", "doodle: Got Ready (%s)\n", from);
214 214
215 account = gaim_connection_get_account(gc); 215 account = purple_connection_get_account(gc);
216 216
217 /* Only handle this if local client requested Doodle session (else local 217 /* Only handle this if local client requested Doodle session (else local
218 * client would have sent one) 218 * client would have sent one)
219 */ 219 */
220 wb = gaim_whiteboard_get_session(account, from); 220 wb = purple_whiteboard_get_session(account, from);
221 221
222 if(wb == NULL) 222 if(wb == NULL)
223 return; 223 return;
224 224
225 if(wb->state == DOODLE_STATE_REQUESTING) 225 if(wb->state == DOODLE_STATE_REQUESTING)
226 { 226 {
227 gaim_whiteboard_start(wb); 227 purple_whiteboard_start(wb);
228 228
229 wb->state = DOODLE_STATE_ESTABLISHED; 229 wb->state = DOODLE_STATE_ESTABLISHED;
230 230
231 yahoo_doodle_command_send_confirm(gc, from); 231 yahoo_doodle_command_send_confirm(gc, from);
232 } 232 }
233 233
234 if(wb->state == DOODLE_STATE_ESTABLISHED) 234 if(wb->state == DOODLE_STATE_ESTABLISHED)
235 { 235 {
236 /* TODO Ask whether to save picture too */ 236 /* TODO Ask whether to save picture too */
237 gaim_whiteboard_clear(wb); 237 purple_whiteboard_clear(wb);
238 } 238 }
239 239
240 /* NOTE Not sure about this... I am trying to handle if the remote user 240 /* NOTE Not sure about this... I am trying to handle if the remote user
241 * already thinks we're in a session with them (when their chat message 241 * already thinks we're in a session with them (when their chat message
242 * contains the doodle;11 imv key) 242 * contains the doodle;11 imv key)
243 */ 243 */
244 if(wb->state == DOODLE_STATE_REQUESTED) 244 if(wb->state == DOODLE_STATE_REQUESTED)
245 { 245 {
246 /* gaim_whiteboard_start(wb); */ 246 /* purple_whiteboard_start(wb); */
247 yahoo_doodle_command_send_request(gc, from); 247 yahoo_doodle_command_send_request(gc, from);
248 } 248 }
249 } 249 }
250 250
251 void yahoo_doodle_command_got_draw(GaimConnection *gc, const char *from, const char *message) 251 void yahoo_doodle_command_got_draw(PurpleConnection *gc, const char *from, const char *message)
252 { 252 {
253 GaimAccount *account; 253 PurpleAccount *account;
254 GaimWhiteboard *wb; 254 PurpleWhiteboard *wb;
255 char **tokens; 255 char **tokens;
256 int i; 256 int i;
257 GList *d_list = NULL; /* a local list of drawing info */ 257 GList *d_list = NULL; /* a local list of drawing info */
258 258
259 g_return_if_fail(message != NULL); 259 g_return_if_fail(message != NULL);
260 260
261 gaim_debug_info("yahoo", "doodle: Got Draw (%s)\n", from); 261 purple_debug_info("yahoo", "doodle: Got Draw (%s)\n", from);
262 gaim_debug_info("yahoo", "doodle: Draw message: %s\n", message); 262 purple_debug_info("yahoo", "doodle: Draw message: %s\n", message);
263 263
264 account = gaim_connection_get_account(gc); 264 account = purple_connection_get_account(gc);
265 265
266 /* Only handle this if local client requested Doodle session (else local 266 /* Only handle this if local client requested Doodle session (else local
267 * client would have sent one) 267 * client would have sent one)
268 */ 268 */
269 wb = gaim_whiteboard_get_session(account, from); 269 wb = purple_whiteboard_get_session(account, from);
270 270
271 if(wb == NULL) 271 if(wb == NULL)
272 return; 272 return;
273 273
274 /* TODO Functionalize 274 /* TODO Functionalize
302 /* goodle_doodle_session_set_canvas_as_icon(ds); */ 302 /* goodle_doodle_session_set_canvas_as_icon(ds); */
303 303
304 g_list_free(d_list); 304 g_list_free(d_list);
305 } 305 }
306 306
307 void yahoo_doodle_command_got_clear(GaimConnection *gc, const char *from) 307 void yahoo_doodle_command_got_clear(PurpleConnection *gc, const char *from)
308 { 308 {
309 GaimAccount *account; 309 PurpleAccount *account;
310 GaimWhiteboard *wb; 310 PurpleWhiteboard *wb;
311 311
312 gaim_debug_info("yahoo", "doodle: Got Clear (%s)\n", from); 312 purple_debug_info("yahoo", "doodle: Got Clear (%s)\n", from);
313 313
314 account = gaim_connection_get_account(gc); 314 account = purple_connection_get_account(gc);
315 315
316 /* Only handle this if local client requested Doodle session (else local 316 /* Only handle this if local client requested Doodle session (else local
317 * client would have sent one) 317 * client would have sent one)
318 */ 318 */
319 wb = gaim_whiteboard_get_session(account, from); 319 wb = purple_whiteboard_get_session(account, from);
320 320
321 if(wb == NULL) 321 if(wb == NULL)
322 return; 322 return;
323 323
324 if(wb->state == DOODLE_STATE_ESTABLISHED) 324 if(wb->state == DOODLE_STATE_ESTABLISHED)
325 { 325 {
326 /* TODO Ask user whether to save the image before clearing it */ 326 /* TODO Ask user whether to save the image before clearing it */
327 327
328 gaim_whiteboard_clear(wb); 328 purple_whiteboard_clear(wb);
329 } 329 }
330 } 330 }
331 331
332 void 332 void
333 yahoo_doodle_command_got_extra(GaimConnection *gc, const char *from, const char *message) 333 yahoo_doodle_command_got_extra(PurpleConnection *gc, const char *from, const char *message)
334 { 334 {
335 gaim_debug_info("yahoo", "doodle: Got Extra (%s)\n", from); 335 purple_debug_info("yahoo", "doodle: Got Extra (%s)\n", from);
336 336
337 /* I do not like these 'extra' features, so I'll only handle them in one 337 /* I do not like these 'extra' features, so I'll only handle them in one
338 * way, which is returning them with the command/packet to turn them off 338 * way, which is returning them with the command/packet to turn them off
339 */ 339 */
340 yahoo_doodle_command_send_extra(gc, from, DOODLE_EXTRA_NONE); 340 yahoo_doodle_command_send_extra(gc, from, DOODLE_EXTRA_NONE);
341 } 341 }
342 342
343 void yahoo_doodle_command_got_confirm(GaimConnection *gc, const char *from) 343 void yahoo_doodle_command_got_confirm(PurpleConnection *gc, const char *from)
344 { 344 {
345 GaimAccount *account; 345 PurpleAccount *account;
346 GaimWhiteboard *wb; 346 PurpleWhiteboard *wb;
347 347
348 gaim_debug_info("yahoo", "doodle: Got Confirm (%s)\n", from); 348 purple_debug_info("yahoo", "doodle: Got Confirm (%s)\n", from);
349 349
350 /* Get the doodle session */ 350 /* Get the doodle session */
351 account = gaim_connection_get_account(gc); 351 account = purple_connection_get_account(gc);
352 352
353 /* Only handle this if local client requested Doodle session (else local 353 /* Only handle this if local client requested Doodle session (else local
354 * client would have sent one) 354 * client would have sent one)
355 */ 355 */
356 wb = gaim_whiteboard_get_session(account, from); 356 wb = purple_whiteboard_get_session(account, from);
357 357
358 if(wb == NULL) 358 if(wb == NULL)
359 return; 359 return;
360 360
361 /* TODO Combine the following IF's? */ 361 /* TODO Combine the following IF's? */
363 /* Check if we requested a doodle session */ 363 /* Check if we requested a doodle session */
364 if(wb->state == DOODLE_STATE_REQUESTING) 364 if(wb->state == DOODLE_STATE_REQUESTING)
365 { 365 {
366 wb->state = DOODLE_STATE_ESTABLISHED; 366 wb->state = DOODLE_STATE_ESTABLISHED;
367 367
368 gaim_whiteboard_start(wb); 368 purple_whiteboard_start(wb);
369 369
370 yahoo_doodle_command_send_confirm(gc, from); 370 yahoo_doodle_command_send_confirm(gc, from);
371 } 371 }
372 372
373 /* Check if we accepted a request for a doodle session */ 373 /* Check if we accepted a request for a doodle session */
374 if(wb->state == DOODLE_STATE_REQUESTED) 374 if(wb->state == DOODLE_STATE_REQUESTED)
375 { 375 {
376 wb->state = DOODLE_STATE_ESTABLISHED; 376 wb->state = DOODLE_STATE_ESTABLISHED;
377 377
378 gaim_whiteboard_start(wb); 378 purple_whiteboard_start(wb);
379 } 379 }
380 } 380 }
381 381
382 void yahoo_doodle_command_got_shutdown(GaimConnection *gc, const char *from) 382 void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from)
383 { 383 {
384 GaimAccount *account; 384 PurpleAccount *account;
385 GaimWhiteboard *wb; 385 PurpleWhiteboard *wb;
386 386
387 g_return_if_fail(from != NULL); 387 g_return_if_fail(from != NULL);
388 388
389 gaim_debug_info("yahoo", "doodle: Got Shutdown (%s)\n", from); 389 purple_debug_info("yahoo", "doodle: Got Shutdown (%s)\n", from);
390 390
391 account = gaim_connection_get_account(gc); 391 account = purple_connection_get_account(gc);
392 392
393 /* Only handle this if local client requested Doodle session (else local 393 /* Only handle this if local client requested Doodle session (else local
394 * client would have sent one) 394 * client would have sent one)
395 */ 395 */
396 wb = gaim_whiteboard_get_session(account, from); 396 wb = purple_whiteboard_get_session(account, from);
397 397
398 /* TODO Ask if user wants to save picture before the session is closed */ 398 /* TODO Ask if user wants to save picture before the session is closed */
399 399
400 /* If this session doesn't exist, don't try and kill it */ 400 /* If this session doesn't exist, don't try and kill it */
401 if(wb == NULL) 401 if(wb == NULL)
402 return; 402 return;
403 else 403 else
404 { 404 {
405 gaim_whiteboard_destroy(wb); 405 purple_whiteboard_destroy(wb);
406 406
407 /* yahoo_doodle_command_send_shutdown(gc, from); */ 407 /* yahoo_doodle_command_send_shutdown(gc, from); */
408 } 408 }
409 } 409 }
410 410
411 static void yahoo_doodle_command_send_generic(const char *type, 411 static void yahoo_doodle_command_send_generic(const char *type,
412 GaimConnection *gc, 412 PurpleConnection *gc,
413 const char *to, 413 const char *to,
414 const char *message, 414 const char *message,
415 const char *thirteen, 415 const char *thirteen,
416 const char *sixtythree, 416 const char *sixtythree,
417 const char *sixtyfour) 417 const char *sixtyfour)
418 { 418 {
419 struct yahoo_data *yd; 419 struct yahoo_data *yd;
420 struct yahoo_packet *pkt; 420 struct yahoo_packet *pkt;
421 421
422 gaim_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to); 422 purple_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to);
423 423
424 yd = gc->proto_data; 424 yd = gc->proto_data;
425 425
426 /* Make and send an acknowledge (ready) Doodle packet */ 426 /* Make and send an acknowledge (ready) Doodle packet */
427 pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0); 427 pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0);
428 yahoo_packet_hash_str(pkt, 49, "IMVIRONMENT"); 428 yahoo_packet_hash_str(pkt, 49, "IMVIRONMENT");
429 yahoo_packet_hash_str(pkt, 1, gaim_account_get_username(gc->account)); 429 yahoo_packet_hash_str(pkt, 1, purple_account_get_username(gc->account));
430 yahoo_packet_hash_str(pkt, 14, message); 430 yahoo_packet_hash_str(pkt, 14, message);
431 yahoo_packet_hash_str(pkt, 13, thirteen); 431 yahoo_packet_hash_str(pkt, 13, thirteen);
432 yahoo_packet_hash_str(pkt, 5, to); 432 yahoo_packet_hash_str(pkt, 5, to);
433 yahoo_packet_hash_str(pkt, 63, sixtythree ? sixtythree : "doodle;11"); 433 yahoo_packet_hash_str(pkt, 63, sixtythree ? sixtythree : "doodle;11");
434 yahoo_packet_hash_str(pkt, 64, sixtyfour); 434 yahoo_packet_hash_str(pkt, 64, sixtyfour);
435 yahoo_packet_hash_str(pkt, 1002, "1"); 435 yahoo_packet_hash_str(pkt, 1002, "1");
436 436
437 yahoo_packet_send_and_free(pkt, yd); 437 yahoo_packet_send_and_free(pkt, yd);
438 } 438 }
439 439
440 void yahoo_doodle_command_send_request(GaimConnection *gc, const char *to) 440 void yahoo_doodle_command_send_request(PurpleConnection *gc, const char *to)
441 { 441 {
442 yahoo_doodle_command_send_generic("Request", gc, to, "1", "1", NULL, "1"); 442 yahoo_doodle_command_send_generic("Request", gc, to, "1", "1", NULL, "1");
443 } 443 }
444 444
445 void yahoo_doodle_command_send_ready(GaimConnection *gc, const char *to) 445 void yahoo_doodle_command_send_ready(PurpleConnection *gc, const char *to)
446 { 446 {
447 yahoo_doodle_command_send_generic("Ready", gc, to, "", "0", NULL, "0"); 447 yahoo_doodle_command_send_generic("Ready", gc, to, "", "0", NULL, "0");
448 } 448 }
449 449
450 void yahoo_doodle_command_send_draw(GaimConnection *gc, const char *to, const char *message) 450 void yahoo_doodle_command_send_draw(PurpleConnection *gc, const char *to, const char *message)
451 { 451 {
452 yahoo_doodle_command_send_generic("Draw", gc, to, message, "3", NULL, "1"); 452 yahoo_doodle_command_send_generic("Draw", gc, to, message, "3", NULL, "1");
453 } 453 }
454 454
455 void yahoo_doodle_command_send_clear(GaimConnection *gc, const char *to) 455 void yahoo_doodle_command_send_clear(PurpleConnection *gc, const char *to)
456 { 456 {
457 yahoo_doodle_command_send_generic("Clear", gc, to, " ", "2", NULL, "1"); 457 yahoo_doodle_command_send_generic("Clear", gc, to, " ", "2", NULL, "1");
458 } 458 }
459 459
460 void yahoo_doodle_command_send_extra(GaimConnection *gc, const char *to, const char *message) 460 void yahoo_doodle_command_send_extra(PurpleConnection *gc, const char *to, const char *message)
461 { 461 {
462 yahoo_doodle_command_send_generic("Extra", gc, to, message, "4", NULL, "1"); 462 yahoo_doodle_command_send_generic("Extra", gc, to, message, "4", NULL, "1");
463 } 463 }
464 464
465 void yahoo_doodle_command_send_confirm(GaimConnection *gc, const char *to) 465 void yahoo_doodle_command_send_confirm(PurpleConnection *gc, const char *to)
466 { 466 {
467 yahoo_doodle_command_send_generic("Confirm", gc, to, "1", "5", NULL, "1"); 467 yahoo_doodle_command_send_generic("Confirm", gc, to, "1", "5", NULL, "1");
468 } 468 }
469 469
470 void yahoo_doodle_command_send_shutdown(GaimConnection *gc, const char *to) 470 void yahoo_doodle_command_send_shutdown(PurpleConnection *gc, const char *to)
471 { 471 {
472 yahoo_doodle_command_send_generic("Shutdown", gc, to, "", "0", ";0", "0"); 472 yahoo_doodle_command_send_generic("Shutdown", gc, to, "", "0", ";0", "0");
473 } 473 }
474 474
475 void yahoo_doodle_start(GaimWhiteboard *wb) 475 void yahoo_doodle_start(PurpleWhiteboard *wb)
476 { 476 {
477 doodle_session *ds = g_new0(doodle_session, 1); 477 doodle_session *ds = g_new0(doodle_session, 1);
478 478
479 /* gaim_debug_debug("yahoo", "doodle: yahoo_doodle_start()\n"); */ 479 /* purple_debug_debug("yahoo", "doodle: yahoo_doodle_start()\n"); */
480 480
481 /* Set default brush size and color */ 481 /* Set default brush size and color */
482 ds->brush_size = DOODLE_BRUSH_SMALL; 482 ds->brush_size = DOODLE_BRUSH_SMALL;
483 ds->brush_color = DOODLE_COLOR_RED; 483 ds->brush_color = DOODLE_COLOR_RED;
484 484
485 wb->proto_data = ds; 485 wb->proto_data = ds;
486 } 486 }
487 487
488 void yahoo_doodle_end(GaimWhiteboard *wb) 488 void yahoo_doodle_end(PurpleWhiteboard *wb)
489 { 489 {
490 GaimConnection *gc = gaim_account_get_connection(wb->account); 490 PurpleConnection *gc = purple_account_get_connection(wb->account);
491 491
492 /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */ 492 /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */
493 493
494 yahoo_doodle_command_send_shutdown(gc, wb->who); 494 yahoo_doodle_command_send_shutdown(gc, wb->who);
495 495
496 g_free(wb->proto_data); 496 g_free(wb->proto_data);
497 } 497 }
498 498
499 void yahoo_doodle_get_dimensions(const GaimWhiteboard *wb, int *width, int *height) 499 void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height)
500 { 500 {
501 /* standard Doodle canvases are of one size: 368x256 */ 501 /* standard Doodle canvases are of one size: 368x256 */
502 *width = DOODLE_CANVAS_WIDTH; 502 *width = DOODLE_CANVAS_WIDTH;
503 *height = DOODLE_CANVAS_HEIGHT; 503 *height = DOODLE_CANVAS_HEIGHT;
504 } 504 }
519 g_string_append_c(message, '"'); 519 g_string_append_c(message, '"');
520 520
521 return g_string_free(message, FALSE); 521 return g_string_free(message, FALSE);
522 } 522 }
523 523
524 void yahoo_doodle_send_draw_list(GaimWhiteboard *wb, GList *draw_list) 524 void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list)
525 { 525 {
526 doodle_session *ds = wb->proto_data; 526 doodle_session *ds = wb->proto_data;
527 char *message; 527 char *message;
528 528
529 g_return_if_fail(draw_list != NULL); 529 g_return_if_fail(draw_list != NULL);
531 message = yahoo_doodle_build_draw_string(ds, draw_list); 531 message = yahoo_doodle_build_draw_string(ds, draw_list);
532 yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message); 532 yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message);
533 g_free(message); 533 g_free(message);
534 } 534 }
535 535
536 void yahoo_doodle_clear(GaimWhiteboard *wb) 536 void yahoo_doodle_clear(PurpleWhiteboard *wb)
537 { 537 {
538 yahoo_doodle_command_send_clear(wb->account->gc, wb->who); 538 yahoo_doodle_command_send_clear(wb->account->gc, wb->who);
539 } 539 }
540 540
541 541
542 /* Traverse through the list and draw the points and lines */ 542 /* Traverse through the list and draw the points and lines */
543 void yahoo_doodle_draw_stroke(GaimWhiteboard *wb, GList *draw_list) 543 void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list)
544 { 544 {
545 int brush_color; 545 int brush_color;
546 int brush_size; 546 int brush_size;
547 int x; 547 int x;
548 int y; 548 int y;
564 y = GPOINTER_TO_INT(draw_list->data); 564 y = GPOINTER_TO_INT(draw_list->data);
565 draw_list = draw_list->next; 565 draw_list = draw_list->next;
566 g_return_if_fail(draw_list != NULL); 566 g_return_if_fail(draw_list != NULL);
567 567
568 /* 568 /*
569 gaim_debug_debug("yahoo", "doodle: Drawing: color=%d, size=%d, (%d,%d)\n", brush_color, brush_size, x, y); 569 purple_debug_debug("yahoo", "doodle: Drawing: color=%d, size=%d, (%d,%d)\n", brush_color, brush_size, x, y);
570 */ 570 */
571 571
572 while(draw_list != NULL && draw_list->next != NULL) 572 while(draw_list != NULL && draw_list->next != NULL)
573 { 573 {
574 int dx = GPOINTER_TO_INT(draw_list->data); 574 int dx = GPOINTER_TO_INT(draw_list->data);
575 int dy = GPOINTER_TO_INT(draw_list->next->data); 575 int dy = GPOINTER_TO_INT(draw_list->next->data);
576 576
577 gaim_whiteboard_draw_line(wb, 577 purple_whiteboard_draw_line(wb,
578 x, y, 578 x, y,
579 x + dx, y + dy, 579 x + dx, y + dy,
580 brush_color, brush_size); 580 brush_color, brush_size);
581 581
582 x += dx; 582 x += dx;
584 584
585 draw_list = draw_list->next->next; 585 draw_list = draw_list->next->next;
586 } 586 }
587 } 587 }
588 588
589 void yahoo_doodle_get_brush(const GaimWhiteboard *wb, int *size, int *color) 589 void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color)
590 { 590 {
591 doodle_session *ds = (doodle_session *)wb->proto_data; 591 doodle_session *ds = (doodle_session *)wb->proto_data;
592 *size = ds->brush_size; 592 *size = ds->brush_size;
593 *color = ds->brush_color; 593 *color = ds->brush_color;
594 } 594 }
595 595
596 void yahoo_doodle_set_brush(GaimWhiteboard *wb, int size, int color) 596 void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color)
597 { 597 {
598 doodle_session *ds = (doodle_session *)wb->proto_data; 598 doodle_session *ds = (doodle_session *)wb->proto_data;
599 ds->brush_size = size; 599 ds->brush_size = size;
600 ds->brush_color = color; 600 ds->brush_color = color;
601 601
602 /* Notify the core about the changes */ 602 /* Notify the core about the changes */
603 gaim_whiteboard_set_brush(wb, size, color); 603 purple_whiteboard_set_brush(wb, size, color);
604 } 604 }
605 605