Mercurial > pidgin.yaz
annotate src/protocols/yahoo/yahoo_doodle.h @ 14142:89d043d547cc
[gaim-migrate @ 16784]
Never allow Yahoo! to insert a NULL value into the outgoing packet
hash. This fixes some random crashes when the packet gets sent,
and yahoo_packet_length() is called, which eventually calls
strlen(NULL), which crashes
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 16 Aug 2006 06:58:59 +0000 |
parents | 2219f4bf4a57 |
children |
rev | line source |
---|---|
11475 | 1 /** |
2 * @file yahoo_doodle.h The Yahoo! protocol plugin Doodle IMVironment object | |
3 * | |
4 * gaim | |
5 * | |
6 * Gaim is the legal property of its developers, whose names are too numerous | |
7 * to list here. Please refer to the COPYRIGHT file distributed with this | |
8 * source distribution. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
24 | |
25 #ifndef _YAHOO_DOODLE_H_ | |
26 #define _YAHOO_DOODLE_H_ | |
27 | |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
28 /****************************************************************************** |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
29 * Includes |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
30 *****************************************************************************/ |
11475 | 31 #include "whiteboard.h" |
32 #include "cmds.h" | |
33 | |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
34 /****************************************************************************** |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
35 * Defines |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
36 *****************************************************************************/ |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
37 /* Doodle communication commands */ |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
38 /* TODO: Should be an enum. */ |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
39 #define DOODLE_CMD_REQUEST 0 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
40 #define DOODLE_CMD_READY 1 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
41 #define DOODLE_CMD_CLEAR 2 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
42 #define DOODLE_CMD_DRAW 3 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
43 #define DOODLE_CMD_EXTRA 4 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
44 #define DOODLE_CMD_CONFIRM 5 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
45 /* Doodle communication command for shutting down (also 0) */ |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
46 #define DOODLE_CMD_SHUTDOWN 0 |
11475 | 47 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
48 #define DOODLE_EXTRA_NONE "\"1\"" |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
49 #define DOODLE_EXTRA_TICTACTOE "\"3\"" |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
50 #define DOODLE_EXTRA_DOTS "\"2\"" |
11475 | 51 |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
52 /* Doodle session states */ |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
53 /* TODO: Should be an enum. */ |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
54 #define DOODLE_STATE_REQUESTING 0 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
55 #define DOODLE_STATE_REQUESTED 1 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
56 #define DOODLE_STATE_ESTABLISHED 2 |
11475 | 57 |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
58 /* Doodle canvas dimensions */ |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
59 #define DOODLE_CANVAS_WIDTH 368 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
60 #define DOODLE_CANVAS_HEIGHT 256 |
11475 | 61 |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
62 /* Doodle color codes (most likely RGB) */ |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
63 /* TODO: Should be an enum and sorted by color name. */ |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
64 #define DOODLE_COLOR_RED 13369344 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
65 #define DOODLE_COLOR_ORANGE 16737792 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
66 #define DOODLE_COLOR_YELLOW 15658496 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
67 #define DOODLE_COLOR_GREEN 52224 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
68 #define DOODLE_COLOR_CYAN 52428 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
69 #define DOODLE_COLOR_BLUE 204 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
70 #define DOODLE_COLOR_VIOLET 5381277 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
71 #define DOODLE_COLOR_PURPLE 13369548 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
72 #define DOODLE_COLOR_TAN 12093547 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
73 #define DOODLE_COLOR_BROWN 5256485 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
74 #define DOODLE_COLOR_BLACK 0 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
75 #define DOODLE_COLOR_GREY 11184810 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
76 #define DOODLE_COLOR_WHITE 16777215 |
11475 | 77 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
78 #define PALETTE_NUM_OF_COLORS 12 |
11475 | 79 |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
80 /* Doodle brush sizes (most likely variable) */ |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
81 #define DOODLE_BRUSH_SMALL 2 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
82 #define DOODLE_BRUSH_MEDIUM 5 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
83 #define DOODLE_BRUSH_LARGE 10 |
11475 | 84 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
85 #define DOODLE_MAX_BRUSH_MOTIONS 100 |
11475 | 86 |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
87 /****************************************************************************** |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
88 * Datatypes |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
89 *****************************************************************************/ |
11475 | 90 typedef struct _doodle_session |
91 { | |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
92 int brush_size; /* Size of drawing brush */ |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
93 int brush_color; /* Color of drawing brush */ |
11475 | 94 } doodle_session; |
95 | |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
96 /****************************************************************************** |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
97 * API |
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
98 *****************************************************************************/ |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
99 |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
100 GaimCmdRet yahoo_doodle_gaim_cmd_start(GaimConversation *conv, const char *cmd, char **args, |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
101 char **error, void *data); |
11475 | 102 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
103 void yahoo_doodle_process(GaimConnection *gc, const char *me, const char *from, |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
104 const char *command, const char *message); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
105 void yahoo_doodle_initiate(GaimConnection *gc, const char *to); |
11475 | 106 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
107 void yahoo_doodle_command_got_request(GaimConnection *gc, const char *from); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
108 void yahoo_doodle_command_got_ready(GaimConnection *gc, const char *from); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
109 void yahoo_doodle_command_got_draw(GaimConnection *gc, const char *from, const char *message); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
110 void yahoo_doodle_command_got_clear(GaimConnection *gc, const char *from); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
111 void yahoo_doodle_command_got_extra(GaimConnection *gc, const char *from, const char *message); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
112 void yahoo_doodle_command_got_confirm(GaimConnection *gc, const char *from); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
113 void yahoo_doodle_command_got_shutdown(GaimConnection *gc, const char *from); |
11475 | 114 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
115 void yahoo_doodle_command_send_request(GaimConnection *gc, const char *to); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
116 void yahoo_doodle_command_send_ready(GaimConnection *gc, const char *to); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
117 void yahoo_doodle_command_send_draw(GaimConnection *gc, const char *to, const char *message); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
118 void yahoo_doodle_command_send_clear(GaimConnection *gc, const char *to); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
119 void yahoo_doodle_command_send_extra(GaimConnection *gc, const char *to, const char *message); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
120 void yahoo_doodle_command_send_confirm(GaimConnection *gc, const char *to); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
121 void yahoo_doodle_command_send_shutdown(GaimConnection *gc, const char *to); |
11475 | 122 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
123 void yahoo_doodle_start(GaimWhiteboard *wb); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
124 void yahoo_doodle_end(GaimWhiteboard *wb); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
125 void yahoo_doodle_get_dimensions(GaimWhiteboard *wb, int *width, int *height); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
126 void yahoo_doodle_send_draw_list(GaimWhiteboard *wb, GList *draw_list); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
127 void yahoo_doodle_clear(GaimWhiteboard *wb); |
11475 | 128 |
11914
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
129 void yahoo_doodle_draw_stroke(GaimWhiteboard *wb, GList *draw_list); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
130 void yahoo_doodle_get_brush(GaimWhiteboard *wb, int *size, int *color); |
2219f4bf4a57
[gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents:
11801
diff
changeset
|
131 void yahoo_doodle_set_brush(GaimWhiteboard *wb, int size, int color); |
11475 | 132 |
11801
81806e9241be
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
133 #endif /* _YAHOO_DOODLE_H_ */ |