Frameworks/libpurple.framework/Versions/0.6.2/Headers/yahoo_doodle.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 1739 Frameworks/libpurple.framework/Versions/0.6.0/Headers/yahoo_doodle.h@8b0daad9656c
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
     1 /**
     2  * @file yahoo_doodle.h The Yahoo! protocol plugin Doodle IMVironment object
     3  *
     4  * purple
     5  *
     6  * Purple 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    23  */
    24 
    25 #ifndef _YAHOO_DOODLE_H_
    26 #define _YAHOO_DOODLE_H_
    27 
    28 /******************************************************************************
    29  * Includes
    30  *****************************************************************************/
    31 #include "whiteboard.h"
    32 #include "cmds.h"
    33 
    34 #define DOODLE_IMV_KEY "doodle;106"
    35 
    36 /******************************************************************************
    37  * Defines
    38  *****************************************************************************/
    39 /* Doodle communication commands */
    40 /* TODO: Should be an enum. */
    41 #define DOODLE_CMD_REQUEST	0
    42 #define DOODLE_CMD_CLEAR	1
    43 #define DOODLE_CMD_DRAW		2
    44 #define DOODLE_CMD_EXTRA	3
    45 #define DOODLE_CMD_READY	4
    46 #define DOODLE_CMD_CONFIRM	5
    47 /* Doodle communication command for shutting down (also 0) */
    48 #define DOODLE_CMD_SHUTDOWN 0
    49 
    50 #define DOODLE_EXTRA_NONE      "\"1\""
    51 #define DOODLE_EXTRA_TICTACTOE "\"3\""
    52 #define DOODLE_EXTRA_DOTS      "\"2\""
    53 
    54 /* Doodle session states */
    55 /* TODO: Should be an enum. */
    56 #define DOODLE_STATE_REQUESTING  0
    57 #define DOODLE_STATE_REQUESTED   1
    58 #define DOODLE_STATE_ESTABLISHED 2
    59 #define DOODLE_STATE_CANCELED    3
    60 
    61 /* Doodle canvas dimensions */
    62 #define DOODLE_CANVAS_WIDTH  368
    63 #define DOODLE_CANVAS_HEIGHT 256
    64 
    65 /* Doodle color codes (most likely RGB) */
    66 /* TODO: Should be an enum and sorted by color name. */
    67 #define	DOODLE_COLOR_RED    13369344
    68 #define	DOODLE_COLOR_ORANGE 16737792
    69 #define	DOODLE_COLOR_YELLOW 15658496
    70 #define	DOODLE_COLOR_GREEN     52224
    71 #define	DOODLE_COLOR_CYAN      52428
    72 #define	DOODLE_COLOR_BLUE        204
    73 #define	DOODLE_COLOR_VIOLET  5381277
    74 #define	DOODLE_COLOR_PURPLE 13369548
    75 #define	DOODLE_COLOR_TAN    12093547
    76 #define	DOODLE_COLOR_BROWN   5256485
    77 #define	DOODLE_COLOR_BLACK         0
    78 #define	DOODLE_COLOR_GREY   11184810
    79 #define	DOODLE_COLOR_WHITE  16777215
    80 
    81 #define PALETTE_NUM_OF_COLORS 12
    82 
    83 /* Doodle brush sizes (most likely variable) */
    84 #define DOODLE_BRUSH_SMALL   2
    85 #define DOODLE_BRUSH_MEDIUM  5
    86 #define DOODLE_BRUSH_LARGE  10
    87 
    88 #define DOODLE_MAX_BRUSH_MOTIONS 100
    89 
    90 /******************************************************************************
    91  * Datatypes
    92  *****************************************************************************/
    93 typedef struct _doodle_session
    94 {
    95 	int brush_size;  /* Size of drawing brush */
    96 	int brush_color; /* Color of drawing brush */
    97 	gchar *imv_key;
    98 } doodle_session;
    99 
   100 /******************************************************************************
   101  * API
   102  *****************************************************************************/
   103 
   104 PurpleCmdRet yahoo_doodle_purple_cmd_start(PurpleConversation *conv, const char *cmd, char **args,
   105 									   char **error, void *data);
   106 
   107 void yahoo_doodle_process(PurpleConnection *gc, const char *me, const char *from,
   108 						  const char *command, const char *message, const char *imv_key);
   109 void yahoo_doodle_initiate(PurpleConnection *gc, const char *to);
   110 
   111 void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from);
   112 
   113 void yahoo_doodle_command_send_request(PurpleConnection *gc, const char *to, const char *imv_key);
   114 void yahoo_doodle_command_send_ready(PurpleConnection *gc, const char *to, const char *imv_key);
   115 void yahoo_doodle_command_send_draw(PurpleConnection *gc, const char *to, const char *message, const char *imv_key);
   116 void yahoo_doodle_command_send_clear(PurpleConnection *gc, const char *to, const char *imv_key);
   117 void yahoo_doodle_command_send_extra(PurpleConnection *gc, const char *to, const char *message, const char *imv_key);
   118 void yahoo_doodle_command_send_confirm(PurpleConnection *gc, const char *to, const char *imv_key);
   119 void yahoo_doodle_command_send_shutdown(PurpleConnection *gc, const char *to);
   120 
   121 void yahoo_doodle_start(PurpleWhiteboard *wb);
   122 void yahoo_doodle_end(PurpleWhiteboard *wb);
   123 void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height);
   124 void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list);
   125 void yahoo_doodle_clear(PurpleWhiteboard *wb);
   126 
   127 void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list);
   128 void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color);
   129 void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color);
   130 
   131 #endif /* _YAHOO_DOODLE_H_ */