changeset 11914:2219f4bf4a57

[gaim-migrate @ 14205] SF Patch #1342017 from sadrul "This patch allows a user to change brush color during the doodle-session. This patch is mostly a rough one to get an idea whether the approach is correct. To make things simple, I have kept brush_size and brush_color in GaimGtkWhiteboard, although it's there in doodle_session. It could be in either place, although I would think it's best to be in GaimGtkWhiteboard because any/most implementations of doodle-ing would have these attributes. So keeping them within the prpl may not be the best option? Anyway, considering the brush-size and color stay at the prpl for now, I have introduced two functions in GaimWhiteboardPrplOps to get/set the size and color of the brush from the prpl. rekkanoryo (using Y! 7) and I (using gaim) have tested this, and it seemed to work OK." Plus, I cleaned up a whole bunch of code. My apologies for this all being committed together, but it was a case of "Oh, this will be quick." that lead into hours of making intertwined changes. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 31 Oct 2005 02:19:51 +0000
parents b3105d119a17
children 31343023953c
files src/gtkwhiteboard.c src/gtkwhiteboard.h src/protocols/yahoo/yahoo.c src/protocols/yahoo/yahoo_doodle.c src/protocols/yahoo/yahoo_doodle.h src/protocols/yahoo/yahoo_filexfer.c src/whiteboard.c src/whiteboard.h
diffstat 8 files changed, 836 insertions(+), 987 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkwhiteboard.c	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/gtkwhiteboard.c	Mon Oct 31 02:19:51 2005 +0000
@@ -24,57 +24,60 @@
 #include <stdlib.h>
 
 #include "blist.h"
+#include "debug.h"
 
 #include "gtkwhiteboard.h"
 
 /******************************************************************************
  * Prototypes
  *****************************************************************************/
-static void			gaim_gtk_whiteboard_create( GaimWhiteboard *wb );
+static void gaim_gtk_whiteboard_create(GaimWhiteboard *wb);
 
-static void			gaim_gtk_whiteboard_destroy( GaimWhiteboard *wb );
-static void			gaim_gtk_whiteboard_exit( GtkWidget *widget, gpointer data );
+static void gaim_gtk_whiteboard_destroy(GaimWhiteboard *wb);
+static void gaim_gtk_whiteboard_exit(GtkWidget *widget, gpointer data);
 
-/*static void			gaim_gtkwhiteboard_button_start_press( GtkButton *button, gpointer data ); */
+/*static void gaim_gtkwhiteboard_button_start_press(GtkButton *button, gpointer data); */
 
-static gboolean		gaim_gtk_whiteboard_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data );
-static gboolean		gaim_gtk_whiteboard_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data );
+static gboolean gaim_gtk_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data);
+static gboolean gaim_gtk_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data);
 
-static gboolean		gaim_gtk_whiteboard_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data );
-static gboolean		gaim_gtk_whiteboard_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data );
-static gboolean		gaim_gtk_whiteboard_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data );
+static gboolean gaim_gtk_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data);
+static gboolean gaim_gtk_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data);
+static gboolean gaim_gtk_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *event, gpointer data);
 
-static void			gaim_gtk_whiteboard_draw_brush_point( GaimWhiteboard *wb,
-							      int x, int y, int color, int size );
-static void			gaim_gtk_whiteboard_draw_brush_line( GaimWhiteboard *wb,
-							     int x0, int y0, int x1, int y1, int color, int size );
+static void gaim_gtk_whiteboard_draw_brush_point(GaimWhiteboard *wb,
+												  int x, int y, int color, int size);
+static void gaim_gtk_whiteboard_draw_brush_line(GaimWhiteboard *wb, int x0, int y0,
+												int x1, int y1, int color, int size);
+
+static void gaim_gtk_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height);
+static void gaim_gtk_whiteboard_clear(GaimWhiteboard *wb);
 
-static void			gaim_gtk_whiteboard_set_dimensions( GaimWhiteboard *wb, int width, int height );
-static void			gaim_gtk_whiteboard_clear( GaimWhiteboard *wb );
+static void gaim_gtk_whiteboard_button_clear_press(GtkWidget *widget, gpointer data);
+static void gaim_gtk_whiteboard_button_save_press(GtkWidget *widget, gpointer data);
 
-static void			gaim_gtk_whiteboard_button_clear_press( GtkWidget *widget, gpointer data );
-static void			gaim_gtk_whiteboard_button_save_press( GtkWidget *widget, gpointer data );
+static void gaim_gtk_whiteboard_set_canvas_as_icon(GaimGtkWhiteboard *gtkwb);
 
-static void			gaim_gtk_whiteboard_set_canvas_as_icon( GaimGtkWhiteboard *gtkwb );
+static void gaim_gtk_whiteboard_rgb24_to_rgb48(int color_rgb, GdkColor *color);
 
-static void			gaim_gtk_whiteboard_rgb24_to_rgb48( int color_rgb, GdkColor *color );
+static void change_color_cb(GtkColorButton *w, GaimGtkWhiteboard *gtkwb);
 
 /******************************************************************************
  * Globals
  *****************************************************************************/
 /*
-GList				*buttonList		= NULL;
-GdkColor			DefaultColor[PALETTE_NUM_COLORS];
+GList *buttonList = NULL;
+GdkColor DefaultColor[PALETTE_NUM_COLORS];
 */
 
-static gboolean			LocalShutdownRequest;
+static gboolean LocalShutdownRequest;
 
-static int			LastX;			/* Tracks last position of the mouse when drawing */
-static int			LastY;
-static int			MotionCount;		/* Tracks how many brush motions made */
-static int			BrushState		= BRUSH_STATE_UP;
+static int LastX;       /* Tracks last position of the mouse when drawing */
+static int LastY;
+static int MotionCount; /* Tracks how many brush motions made */
+static int BrushState = BRUSH_STATE_UP;
 
-static GaimWhiteboardUiOps 	ui_ops			=
+static GaimWhiteboardUiOps ui_ops =
 {
 	gaim_gtk_whiteboard_create,
 	gaim_gtk_whiteboard_destroy,
@@ -87,12 +90,12 @@
 /******************************************************************************
  * API
  *****************************************************************************/
-GaimWhiteboardUiOps *gaim_gtk_whiteboard_get_ui_ops( void )
+GaimWhiteboardUiOps *gaim_gtk_whiteboard_get_ui_ops(void)
 {
-	return( &ui_ops );
+	return &ui_ops;
 }
 
-void gaim_gtk_whiteboard_create( GaimWhiteboard *wb )
+void gaim_gtk_whiteboard_create(GaimWhiteboard *wb)
 {
 	int i;
 
@@ -119,178 +122,188 @@
 	GtkWidget *save_button;
 
 	GtkWidget *palette_color_box[PALETTE_NUM_COLORS];
-	/* GdkPixbuf *palette_color_area[PALETTE_NUM_COLORS]; */
 
-	GaimGtkWhiteboard *gtkwb = g_new0( GaimGtkWhiteboard, 1 );
+	GaimGtkWhiteboard *gtkwb = g_new0(GaimGtkWhiteboard, 1);
 
 	const char *window_title;
 
 	gtkwb->wb = wb;
+	/* TODO: Make these prefs. */
+	gtkwb->brush_size = 2;
+	gtkwb->brush_color = 0xff0000;
 	wb->ui_data = gtkwb;
 
 	/* Get dimensions (default?) for the whiteboard canvas */
-	if( wb->prpl_ops && wb->prpl_ops->get_dimensions )
-		wb->prpl_ops->get_dimensions( wb, &gtkwb->width, &gtkwb->height );
+	if(wb->prpl_ops && wb->prpl_ops->get_dimensions)
+		wb->prpl_ops->get_dimensions(wb, &gtkwb->width, &gtkwb->height);
 
-	window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	gtkwb->window = window;
-	gtk_widget_set_name( window, wb->who );
+	gtk_widget_set_name(window, wb->who);
 
 	/* Try and set window title as the name of the buddy, else just use their
 	 * username
 	 */
-	window_title = gaim_contact_get_alias( gaim_buddy_get_contact( gaim_find_buddy( wb->account, wb->who ) ) );
-	if( window_title )
-		gtk_window_set_title( ( GtkWindow* )( window ), window_title );
+	window_title = gaim_contact_get_alias(gaim_buddy_get_contact(gaim_find_buddy(wb->account, wb->who)));
+	if(window_title)
+		gtk_window_set_title((GtkWindow*)(window), window_title);
 	else
-		gtk_window_set_title( ( GtkWindow* )( window ), wb->who );
+		gtk_window_set_title((GtkWindow*)(window), wb->who);
 
-	gtk_window_set_resizable( ( GtkWindow* )( window ), FALSE );
+	gtk_window_set_resizable((GtkWindow*)(window), FALSE);
 
-	g_signal_connect( G_OBJECT( window ), "destroy",
-			  G_CALLBACK( gaim_gtk_whiteboard_exit ), ( gpointer )( gtkwb ) );
+	g_signal_connect(G_OBJECT(window), "destroy",
+					 G_CALLBACK(gaim_gtk_whiteboard_exit), gtkwb);
 
 	/* Create vertical box to place palette above the canvas and controls */
-	vbox_palette_above_canvas_and_controls = gtk_vbox_new( FALSE, 0 );
-	gtk_container_add( GTK_CONTAINER( window ), vbox_palette_above_canvas_and_controls );
-	gtk_widget_show( vbox_palette_above_canvas_and_controls );
+	vbox_palette_above_canvas_and_controls = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(window), vbox_palette_above_canvas_and_controls);
+	gtk_widget_show(vbox_palette_above_canvas_and_controls);
 
 	/* Create horizontal box for the palette and all its entries */
-	hbox_palette = gtk_hbox_new( FALSE, 0 );
-	gtk_container_add( GTK_CONTAINER( vbox_palette_above_canvas_and_controls ), hbox_palette );
-	gtk_widget_show( hbox_palette );
+	hbox_palette = gtk_hbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(vbox_palette_above_canvas_and_controls), hbox_palette);
+	gtk_widget_show(hbox_palette);
 
 	/* Create horizontal box to seperate the canvas from the controls */
-	hbox_canvas_and_controls = gtk_hbox_new( FALSE, 0 );
-	gtk_container_add( GTK_CONTAINER( vbox_palette_above_canvas_and_controls ), hbox_canvas_and_controls );
-	gtk_widget_show( hbox_canvas_and_controls );
+	hbox_canvas_and_controls = gtk_hbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(vbox_palette_above_canvas_and_controls), hbox_canvas_and_controls);
+	gtk_widget_show(hbox_canvas_and_controls);
 
-	for( i = 0; i < PALETTE_NUM_COLORS; i++ )
+	for(i = 0; i < PALETTE_NUM_COLORS; i++)
 	{
-		/* palette_color_area[i] = */
+		palette_color_box[i] = gtk_image_new_from_pixbuf(NULL);
+		gtk_widget_set_size_request(palette_color_box[i], gtkwb->width / PALETTE_NUM_COLORS ,32);
+		gtk_container_add(GTK_CONTAINER(hbox_palette), palette_color_box[i]);
 
-		palette_color_box[i] = gtk_image_new_from_pixbuf( NULL );
-		gtk_widget_set_size_request( palette_color_box[i], gtkwb->width / PALETTE_NUM_COLORS ,32 );
-		gtk_container_add( GTK_CONTAINER( hbox_palette ), palette_color_box[i] );
-
-		gtk_widget_show( palette_color_box[i] );
+		gtk_widget_show(palette_color_box[i]);
 	}
 
 	/* Create the drawing area */
 	drawing_area = gtk_drawing_area_new();
 	gtkwb->drawing_area = drawing_area;
-	gtk_widget_set_size_request( GTK_WIDGET( drawing_area ), gtkwb->width, gtkwb->height );
-	gtk_box_pack_start( GTK_BOX( hbox_canvas_and_controls ), drawing_area, TRUE, TRUE, 8 );
+	gtk_widget_set_size_request(GTK_WIDGET(drawing_area), gtkwb->width, gtkwb->height);
+	gtk_box_pack_start(GTK_BOX(hbox_canvas_and_controls), drawing_area, TRUE, TRUE, 8);
 
-	gtk_widget_show( drawing_area );
+	gtk_widget_show(drawing_area);
 
 	/* Signals used to handle backing pixmap */
-	g_signal_connect( G_OBJECT( drawing_area ), "expose_event",
-			  G_CALLBACK( gaim_gtk_whiteboard_expose_event ), ( gpointer )( gtkwb ) );
+	g_signal_connect(G_OBJECT(drawing_area), "expose_event",
+					 G_CALLBACK(gaim_gtk_whiteboard_expose_event), gtkwb);
 
-	g_signal_connect( G_OBJECT( drawing_area ), "configure_event",
-			  G_CALLBACK( gaim_gtk_whiteboard_configure_event ), ( gpointer )( gtkwb ) );
+	g_signal_connect(G_OBJECT(drawing_area), "configure_event",
+					 G_CALLBACK(gaim_gtk_whiteboard_configure_event), gtkwb);
 
 	/* Event signals */
-	g_signal_connect( G_OBJECT( drawing_area ), "button_press_event",
-			  G_CALLBACK( gaim_gtk_whiteboard_brush_down ), ( gpointer )( gtkwb ) );
+	g_signal_connect(G_OBJECT(drawing_area), "button_press_event",
+					 G_CALLBACK(gaim_gtk_whiteboard_brush_down), gtkwb);
 
-	g_signal_connect( G_OBJECT( drawing_area ), "motion_notify_event",
-			  G_CALLBACK( gaim_gtk_whiteboard_brush_motion ), ( gpointer )( gtkwb ) );
+	g_signal_connect(G_OBJECT(drawing_area), "motion_notify_event",
+					 G_CALLBACK(gaim_gtk_whiteboard_brush_motion), gtkwb);
 
-	g_signal_connect( G_OBJECT( drawing_area ), "button_release_event",
-			  G_CALLBACK( gaim_gtk_whiteboard_brush_up ), ( gpointer )( gtkwb ) );
+	g_signal_connect(G_OBJECT(drawing_area), "button_release_event",
+					 G_CALLBACK(gaim_gtk_whiteboard_brush_up), gtkwb);
 
-	gtk_widget_set_events( drawing_area, GDK_EXPOSURE_MASK		|
-					     GDK_LEAVE_NOTIFY_MASK	|
-					     GDK_BUTTON_PRESS_MASK	|
-					     GDK_POINTER_MOTION_MASK	|
-					     GDK_BUTTON_RELEASE_MASK	|
-					     GDK_POINTER_MOTION_HINT_MASK );
+	gtk_widget_set_events(drawing_area,
+						  GDK_EXPOSURE_MASK |
+						  GDK_LEAVE_NOTIFY_MASK |
+						  GDK_BUTTON_PRESS_MASK |
+						  GDK_POINTER_MOTION_MASK |
+						  GDK_BUTTON_RELEASE_MASK |
+						  GDK_POINTER_MOTION_HINT_MASK);
 
 	/* Create vertical box to contain the controls */
-	vbox_controls = gtk_vbox_new( FALSE, 0 );
-	gtk_container_add( GTK_CONTAINER( hbox_canvas_and_controls ), vbox_controls );
-	gtk_widget_show( vbox_controls );
+	vbox_controls = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(hbox_canvas_and_controls), vbox_controls);
+	gtk_widget_show(vbox_controls);
 
 	/* Add a clear button */
-	clear_button = gtk_button_new_with_label( "Clear" );
-	gtk_widget_set_size_request( clear_button, 96 ,32 );
-	gtk_box_pack_start( GTK_BOX( vbox_controls ), clear_button, FALSE, FALSE, 0 );
-	gtk_widget_show( clear_button );
-
-	g_signal_connect( G_OBJECT( clear_button ), "clicked",
-			  G_CALLBACK( gaim_gtk_whiteboard_button_clear_press ), ( gpointer )( gtkwb ) );
+	clear_button = gtk_button_new_from_stock(GTK_STOCK_CLEAR);
+	gtk_box_pack_start(GTK_BOX(vbox_controls), clear_button, FALSE, FALSE, 0);
+	gtk_widget_show(clear_button);
+	g_signal_connect(G_OBJECT(clear_button), "clicked",
+					 G_CALLBACK(gaim_gtk_whiteboard_button_clear_press), gtkwb);
 
 	/* Add a save button */
-	save_button = gtk_button_new_with_label( "Save" );
-	gtk_widget_set_size_request( save_button, 96 ,32 );
-	gtk_box_pack_start( GTK_BOX( vbox_controls ), save_button, FALSE, FALSE, 8 );
-	gtk_widget_show( save_button );
+	save_button = gtk_button_new_from_stock(GTK_STOCK_SAVE);
+	gtk_box_pack_start(GTK_BOX(vbox_controls), save_button, FALSE, FALSE, 8);
+	gtk_widget_show(save_button);
+
+	g_signal_connect(G_OBJECT(save_button), "clicked",
+					 G_CALLBACK(gaim_gtk_whiteboard_button_save_press), gtkwb);
 
-	g_signal_connect( G_OBJECT( save_button ), "clicked",
-			  G_CALLBACK( gaim_gtk_whiteboard_button_save_press ), ( gpointer )( gtkwb ) );
+	/* Add a color selector */
+	{
+		GdkColor color;
+		GtkWidget *color_button;
+
+		gaim_gtk_whiteboard_rgb24_to_rgb48(gtkwb->brush_color, &color);
+		color_button = gtk_color_button_new_with_color(&color);
+		gtk_box_pack_start(GTK_BOX(vbox_controls), color_button, FALSE, FALSE, 8);
+		gtk_widget_show(color_button);
+
+		g_signal_connect(G_OBJECT(color_button), "color-set",
+						G_CALLBACK(change_color_cb), gtkwb);
+	}
 
 	/* Make all this (window) visible */
-	gtk_widget_show( window );
+	gtk_widget_show(window);
 
-	gaim_gtk_whiteboard_set_canvas_as_icon( gtkwb );
+	gaim_gtk_whiteboard_set_canvas_as_icon(gtkwb);
 
 	/* TODO Specific protocol/whiteboard assignment here? Needs a UI Op? */
 	/* Set default brush size and color */
 	/*
-	ds->brush_size	= DOODLE_BRUSH_MEDIUM;
-	ds->brush_color	= 0;
+	ds->brush_size = DOODLE_BRUSH_MEDIUM;
+	ds->brush_color = 0;
 	*/
 }
 
-void gaim_gtk_whiteboard_destroy( GaimWhiteboard *wb )
+void gaim_gtk_whiteboard_destroy(GaimWhiteboard *wb)
 {
 	GaimGtkWhiteboard *gtkwb = wb->ui_data;
 
 	/* TODO Ask if user wants to save picture before the session is closed */
 
 	/* Clear graphical memory */
-	if( gtkwb->pixmap )
+	if(gtkwb->pixmap)
 	{
-		g_object_unref( gtkwb->pixmap );
+		g_object_unref(gtkwb->pixmap);
 		gtkwb->pixmap = NULL;
 	}
 
-	if( gtkwb->window )
+	if(gtkwb->window)
 	{
-		gtk_widget_destroy( gtkwb->window );
+		gtk_widget_destroy(gtkwb->window);
 		gtkwb->window = NULL;
 	}
 }
 
-void gaim_gtk_whiteboard_exit( GtkWidget *widget, gpointer data )
+void gaim_gtk_whiteboard_exit(GtkWidget *widget, gpointer data)
 {
-	GaimGtkWhiteboard	*gtkwb	= ( GaimGtkWhiteboard* )( data );
-	GaimWhiteboard		*wb	= gtkwb->wb;
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)data;
+	GaimWhiteboard *wb = gtkwb->wb;
 
-	if( gtkwb->window && gtkwb->pixmap )
+	if(gtkwb->window && gtkwb->pixmap)
 	{
 		LocalShutdownRequest = TRUE;
 
-		gaim_gtk_whiteboard_destroy( wb );
+		gaim_gtk_whiteboard_destroy(wb);
 	}
 	else
 		LocalShutdownRequest = FALSE;
 
-	if( gtkwb )
+	if(gtkwb)
 	{
-		g_free( gtkwb );
+		g_free(gtkwb);
 
-		gtkwb = NULL;
 		wb->ui_data = NULL;
 	}
 
 	/* Destroy whiteboard core, if the local user exited the whiteboard window */
-	if( wb && LocalShutdownRequest )
+	if(wb && LocalShutdownRequest)
 	{
-		gaim_whiteboard_destroy( wb );
-		wb = NULL;
+		gaim_whiteboard_destroy(wb);
 	}
 }
 
@@ -299,215 +312,198 @@
  * and use new prpl_info member?)
  */
 #if 0
-void gaim_gtkwhiteboard_button_start_press( GtkButton *button, gpointer data )
+void gaim_gtkwhiteboard_button_start_press(GtkButton *button, gpointer data)
 {
-	GaimConversation	*conv		= data;
-	GaimAccount		*account	= gaim_conversation_get_account( conv );
-	GaimConnection		*gc		= gaim_account_get_connection( account );
-	char			*to		= ( char* )( gaim_conversation_get_name( conv ) );
+	GaimConversation *conv = data;
+	GaimAccount *account = gaim_conversation_get_account(conv);
+	GaimConnection *gc = gaim_account_get_connection(account);
+	char *to = (char*)(gaim_conversation_get_name(conv));
 
 	/* Only handle this if local client requested Doodle session (else local
 	 * client would have sent one)
 	 */
-	GaimWhiteboard	*wb			= gaim_whiteboard_get( account, to );
+	GaimWhiteboard *wb = gaim_whiteboard_get(account, to);
 
 	/* Write a local message to this conversation showing that a request for a
 	 * Doodle session has been made
 	 */
-	gaim_conv_im_write( GAIM_CONV_IM( conv ), "", _("Sent Doodle request."),
-			    GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time( NULL ) );
+	gaim_conv_im_write(GAIM_CONV_IM(conv), "", _("Sent Doodle request."),
+					   GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time(NULL));
 
-	yahoo_doodle_command_send_request( gc, to );
-	yahoo_doodle_command_send_ready( gc, to );
+	yahoo_doodle_command_send_request(gc, to);
+	yahoo_doodle_command_send_ready(gc, to);
 
 	/* Insert this 'session' in the list.  At this point, it's only a requested
 	 * session.
 	 */
-	wb = gaim_whiteboard_create( account, to, DOODLE_STATE_REQUESTING );
+	wb = gaim_whiteboard_create(account, to, DOODLE_STATE_REQUESTING);
 }
 #endif
 
-gboolean gaim_gtk_whiteboard_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data )
+gboolean gaim_gtk_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
 {
-	GaimGtkWhiteboard	*gtkwb	= ( GaimGtkWhiteboard* )( data );
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)data;
 
-	GdkPixmap		*pixmap = gtkwb->pixmap;
+	GdkPixmap *pixmap = gtkwb->pixmap;
 
-	if( pixmap )
-		g_object_unref( pixmap );
+	if(pixmap)
+		g_object_unref(pixmap);
 
-	pixmap = gdk_pixmap_new( widget->window,
-				 widget->allocation.width,
-				 widget->allocation.height,
-				 -1 );
+	pixmap = gdk_pixmap_new(widget->window,
+							widget->allocation.width,
+							widget->allocation.height,
+							-1);
 
 	gtkwb->pixmap = pixmap;
 
-	gdk_draw_rectangle( pixmap,
-			    widget->style->white_gc,
-			    TRUE,
-			    0, 0,
-			    widget->allocation.width,
-			    widget->allocation.height );
+	gdk_draw_rectangle(pixmap,
+					   widget->style->white_gc,
+					   TRUE,
+					   0, 0,
+					   widget->allocation.width,
+					   widget->allocation.height);
 
-	return( TRUE );
+	return TRUE;
 }
 
-gboolean gaim_gtk_whiteboard_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data )
+gboolean gaim_gtk_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
 {
-	GaimGtkWhiteboard	*gtkwb	= ( GaimGtkWhiteboard* )( data );
-	GdkPixmap		*pixmap	= gtkwb->pixmap;
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)(data);
+	GdkPixmap *pixmap = gtkwb->pixmap;
 
-	gdk_draw_drawable( widget->window,
-			   widget->style->fg_gc[GTK_WIDGET_STATE( widget )],
-			   pixmap,
-			   event->area.x, event->area.y,
-			   event->area.x, event->area.y,
-			   event->area.width, event->area.height );
+	gdk_draw_drawable(widget->window,
+					  widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+					  pixmap,
+					  event->area.x, event->area.y,
+					  event->area.x, event->area.y,
+					  event->area.width, event->area.height);
 
-	return( FALSE );
+	return FALSE;
 }
 
-gboolean gaim_gtk_whiteboard_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data )
+gboolean gaim_gtk_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
-	GaimGtkWhiteboard	*gtkwb		= ( GaimGtkWhiteboard* )( data );
-	GdkPixmap		*pixmap		= gtkwb->pixmap;
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)data;
+	GdkPixmap *pixmap = gtkwb->pixmap;
 
-	GaimWhiteboard		*wb		= gtkwb->wb;
-	GList			*draw_list	= wb->draw_list;
+	GaimWhiteboard *wb = gtkwb->wb;
+	GList *draw_list = wb->draw_list;
 
-	int			*x0		= NULL;
-	int			*y0		= NULL;
-
-	if( BrushState != BRUSH_STATE_UP )
+	if(BrushState != BRUSH_STATE_UP)
 	{
 		/* Potential double-click DOWN to DOWN? */
 		BrushState = BRUSH_STATE_DOWN;
 
-		/* return( FALSE ); */
+		/* return FALSE; */
 	}
 
 	BrushState = BRUSH_STATE_DOWN;
 
-	if( event->button == 1 && pixmap != NULL )
+	if(event->button == 1 && pixmap != NULL)
 	{
 		/* Check if draw_list has contents; if so, clear it */
-		if( draw_list )
-			draw_list = gaim_whiteboard_draw_list_destroy( draw_list );
-
-		x0		= g_new0( int, 1 );
-		y0		= g_new0( int, 1 );
-
-		*x0		= event->x;
-		*y0		= event->y;
+		if(draw_list)
+		{
+			gaim_whiteboard_draw_list_destroy(draw_list);
+			draw_list = NULL;
+		}
 
 		/* Set tracking variables */
-		LastX		= *x0;
-		LastY		= *y0;
+		LastX = event->x;
+		LastY = event->y;
 
-		MotionCount	= 0;
+		MotionCount = 0;
 
-		draw_list	= g_list_append( draw_list, ( gpointer )( x0 ) );
-		draw_list	= g_list_append( draw_list, ( gpointer )( y0 ) );
+		draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastX));
+		draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastY));
 
-		gaim_gtk_whiteboard_draw_brush_point( gtkwb->wb,
-						      event->x, event->y,
-						      0,5 );
-		/* gtkwb->brush_color, gtkwb->brush_size ); NOTE temp const prot uiop */
+		gaim_gtk_whiteboard_draw_brush_point(gtkwb->wb,
+											 event->x, event->y,
+											 gtkwb->brush_color, gtkwb->brush_size);
 	}
 
 	wb->draw_list = draw_list;
 
-	return( TRUE );
+	return TRUE;
 }
 
-gboolean gaim_gtk_whiteboard_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data )
+gboolean gaim_gtk_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data)
 {
-	int			x;
-	int			y;
-	int			*dx;
-	int			*dy;
+	int x;
+	int y;
+	int dx;
+	int dy;
 
-	GdkModifierType		state;
+	GdkModifierType state;
 
-	GaimGtkWhiteboard	*gtkwb		= ( GaimGtkWhiteboard* )( data );
-	GdkPixmap		*pixmap		= gtkwb->pixmap;
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)data;
+	GdkPixmap *pixmap = gtkwb->pixmap;
 
-	GaimWhiteboard		*wb		= gtkwb->wb;
-	GList			*draw_list	= wb->draw_list;
+	GaimWhiteboard *wb = gtkwb->wb;
+	GList *draw_list = wb->draw_list;
 
-	if( event->is_hint )
-		gdk_window_get_pointer( event->window, &x, &y, &state );
+	if(event->is_hint)
+		gdk_window_get_pointer(event->window, &x, &y, &state);
 	else
 	{
-		x	= event->x;
-		y	= event->y;
-		state	= event->state;
+		x = event->x;
+		y = event->y;
+		state = event->state;
 	}
 
-	if( state & GDK_BUTTON1_MASK && pixmap != NULL )
+	if(state & GDK_BUTTON1_MASK && pixmap != NULL)
 	{
-		if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
+		if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION))
 		{
-			g_print( "***Bad brush state transition %d to MOTION\n", BrushState );
+			gaim_debug_error("gtkwhiteboard", "***Bad brush state transition %d to MOTION\n", BrushState);
 
 			BrushState = BRUSH_STATE_MOTION;
 
-			return( FALSE );
+			return FALSE;
 		}
 		BrushState = BRUSH_STATE_MOTION;
 
-		dx	= g_new0( int, 1 );
-		dy	= g_new0( int, 1 );
-
-		*dx	= x - LastX;
-		*dy	= y - LastY;
+		dx = x - LastX;
+		dy = y - LastY;
 
 		MotionCount++;
 
 		/* NOTE 100 is a temporary constant for how many deltas/motions in a
 		 * stroke (needs UI Ops?)
 		 */
-		if( MotionCount == 100 )
+		if(MotionCount == 100)
 		{
-			int *x0			= g_new0( int, 1 );
-			int *y0			= g_new0( int, 1 );
-
-			draw_list = g_list_append( draw_list, ( gpointer )( dx ) );
-			draw_list = g_list_append( draw_list, ( gpointer )( dy ) );
+			draw_list = g_list_append(draw_list, GINT_TO_POINTER(dx));
+			draw_list = g_list_append(draw_list, GINT_TO_POINTER(dy));
 
 			/* Send draw list to prpl draw_list handler */
-			if( gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->send_draw_list )
-				gtkwb->wb->prpl_ops->send_draw_list( gtkwb->wb, draw_list );
+			if(gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->send_draw_list)
+				gtkwb->wb->prpl_ops->send_draw_list(gtkwb->wb, draw_list);
 
 			/* The brush stroke is finished, clear the list for another one */
-			if( draw_list )
-				draw_list = gaim_whiteboard_draw_list_destroy( draw_list );
-
-			*x0			= LastX;
-			*y0			= LastY;
+			if(draw_list)
+			{
+				gaim_whiteboard_draw_list_destroy(draw_list);
+				draw_list = NULL;
+			}
 
 			/* Reset motion tracking */
-			MotionCount		= 0;
-
-			draw_list		= g_list_append( draw_list, ( gpointer )( x0 ) );
-			draw_list		= g_list_append( draw_list, ( gpointer )( y0 ) );
+			MotionCount = 0;
 
-			dx	= g_new0( int, 1 );
-			dy	= g_new0( int, 1 );
+			draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastX));
+			draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastY));
 
-			*dx	= x - LastX;
-			*dy	= y - LastY;
+			dx = x - LastX;
+			dy = y - LastY;
 		}
 
-		draw_list = g_list_append( draw_list, ( gpointer )( dx ) );
-		draw_list = g_list_append( draw_list, ( gpointer )( dy ) );
+		draw_list = g_list_append(draw_list, GINT_TO_POINTER(dx));
+		draw_list = g_list_append(draw_list, GINT_TO_POINTER(dy));
 
-		gaim_gtk_whiteboard_draw_brush_line( gtkwb->wb,
-						     LastX, LastY,
-						     x, y,
-						     0, 5 );
-		/*gtkwb->brush_color, gtkwb->brush_size ); temp const proto ui ops? */
+		gaim_gtk_whiteboard_draw_brush_line(gtkwb->wb,
+											LastX, LastY,
+											x, y,
+											gtkwb->brush_color, gtkwb->brush_size);
 
 		/* Set tracking variables */
 		LastX = x;
@@ -516,47 +512,43 @@
 
 	wb->draw_list = draw_list;
 
-	return( TRUE );
+	return TRUE;
 }
 
-gboolean gaim_gtk_whiteboard_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data )
+gboolean gaim_gtk_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
-	GaimGtkWhiteboard	*gtkwb		= ( GaimGtkWhiteboard* )( data );
-	GdkPixmap		*pixmap		= gtkwb->pixmap;
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)data;
+	GdkPixmap *pixmap = gtkwb->pixmap;
 
-	GaimWhiteboard		*wb		= gtkwb->wb;
-	GList			*draw_list	= wb->draw_list;
+	GaimWhiteboard *wb = gtkwb->wb;
+	GList *draw_list = wb->draw_list;
 
-	if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
+	if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION))
 	{
-		g_print( "***Bad brush state transition %d to UP\n", BrushState );
+		gaim_debug_error("gtkwhiteboard", "***Bad brush state transition %d to UP\n", BrushState);
 
 		BrushState = BRUSH_STATE_UP;
 
-		return( FALSE );
+		return FALSE;
 	}
 	BrushState = BRUSH_STATE_UP;
 
-	if( event->button == 1 && pixmap != NULL )
+	if(event->button == 1 && pixmap != NULL)
 	{
 		/* If the brush was never moved, express two sets of two deltas That's a
 		 * 'point,' but not for Yahoo!
 		 */
-		/* if( ( event->x == LastX ) && ( event->y == LastY ) ) */
-		if( MotionCount == 0 )
+		/* if((event->x == LastX) && (event->y == LastY)) */
+		if(MotionCount == 0)
 		{
 			int index;
 
-			for( index = 0; index < 2; index++ )/* NOTE Yahoo Doodle specific! */
+			/* For Yahoo!, a (0 0) indicates the end of drawing */
+			/* FIXME: Yahoo Doodle specific! */
+			for(index = 0; index < 2; index++)
 			{
-				int *x0		= NULL;
-				int *y0		= NULL;
-
-				x0		= g_new0( int, 1 );
-				y0		= g_new0( int, 1 );
-
-				draw_list	= g_list_append( draw_list, ( gpointer )( x0 ) );
-				draw_list	= g_list_append( draw_list, ( gpointer )( y0 ) );
+				draw_list = g_list_append(draw_list, 0);
+				draw_list = g_list_append(draw_list, 0);
 			}
 		}
 		/*
@@ -565,81 +557,75 @@
 		*/
 
 		/* Send draw list to prpl draw_list handler */
-		if( gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->send_draw_list )
-			gtkwb->wb->prpl_ops->send_draw_list( gtkwb->wb, draw_list );
+		if(gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->send_draw_list)
+			gtkwb->wb->prpl_ops->send_draw_list(gtkwb->wb, draw_list);
 
-		gaim_gtk_whiteboard_set_canvas_as_icon( gtkwb );
+		gaim_gtk_whiteboard_set_canvas_as_icon(gtkwb);
 
 		/* The brush stroke is finished, clear the list for another one */
-		if( draw_list )
-			draw_list = gaim_whiteboard_draw_list_destroy( draw_list );
+		if(draw_list)
+			gaim_whiteboard_draw_list_destroy(draw_list);
 
-		wb->draw_list = draw_list;
+		wb->draw_list = NULL;
 	}
 
-	return( TRUE );
+	return TRUE;
 }
 
-/* void gaim_gtk_whiteboard_draw_brush_point( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
-					  int x, int y, int color, int size )
-*/
-void gaim_gtk_whiteboard_draw_brush_point( GaimWhiteboard *wb, int x, int y, int color, int size )
+void gaim_gtk_whiteboard_draw_brush_point(GaimWhiteboard *wb, int x, int y, int color, int size)
 {
-	GaimGtkWhiteboard	*gtkwb	= wb->ui_data;
-	GtkWidget		*widget	= gtkwb->drawing_area;
-	GdkPixmap 		*pixmap	= gtkwb->pixmap;
+	GaimGtkWhiteboard *gtkwb = wb->ui_data;
+	GtkWidget *widget = gtkwb->drawing_area;
+	GdkPixmap *pixmap = gtkwb->pixmap;
+
+	GdkRectangle update_rect;
 
-	GdkRectangle		update_rect;
-
-	GdkGC			*gfx_con = gdk_gc_new( pixmap );
-	GdkColor		col;
+	GdkGC *gfx_con = gdk_gc_new(pixmap);
+	GdkColor col;
 
-	update_rect.x		= x - size / 2;
-	update_rect.y		= y - size / 2;
-	update_rect.width	= size;
-	update_rect.height	= size;
+	update_rect.x      = x - size / 2;
+	update_rect.y      = y - size / 2;
+	update_rect.width  = size;
+	update_rect.height = size;
 
 	/* Interpret and convert color */
-	gaim_gtk_whiteboard_rgb24_to_rgb48( color, &col );
+	gaim_gtk_whiteboard_rgb24_to_rgb48(color, &col);
 
-	gdk_gc_set_rgb_fg_color( gfx_con, &col );
-	/* gdk_gc_set_rgb_bg_color( gfx_con, &col ); */
+	gdk_gc_set_rgb_fg_color(gfx_con, &col);
+	/* gdk_gc_set_rgb_bg_color(gfx_con, &col); */
 
 	/* NOTE 5 is a size constant for now... this is because of how poorly the
 	 * gdk_draw_arc draws small circles
 	 */
-	if( size < 5 )
+	if(size < 5)
 	{
 		/* Draw a rectangle/square */
-		gdk_draw_rectangle( pixmap,
-				    gfx_con,
-				    TRUE,
-				    update_rect.x, update_rect.y,
-				    update_rect.width, update_rect.height );
+		gdk_draw_rectangle(pixmap,
+						   gfx_con,
+						   TRUE,
+						   update_rect.x, update_rect.y,
+						   update_rect.width, update_rect.height);
 	}
 	else
 	{
 		/* Draw a circle */
-		gdk_draw_arc( pixmap,
-			      gfx_con,
-			      TRUE,
-			      update_rect.x, update_rect.y,
-			      update_rect.width, update_rect.height,
-			      0, FULL_CIRCLE_DEGREES );
+		gdk_draw_arc(pixmap,
+					 gfx_con,
+					 TRUE,
+					 update_rect.x, update_rect.y,
+					 update_rect.width, update_rect.height,
+					 0, FULL_CIRCLE_DEGREES);
 	}
 
-	gtk_widget_queue_draw_area( widget, 
-				    update_rect.x, update_rect.y,
-				    update_rect.width, update_rect.height );
+	gtk_widget_queue_draw_area(widget,
+							   update_rect.x, update_rect.y,
+							   update_rect.width, update_rect.height);
 
-	gdk_gc_unref( gfx_con );
+	gdk_gc_unref(gfx_con);
 }
 
 /* Uses Bresenham's algorithm (as provided by Wikipedia) */
-/* void gaim_gtk_whiteboard_draw_brush_line( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
- 					 int x0, int y0, int x1, int y1, int color, int size )
-*/
-void gaim_gtk_whiteboard_draw_brush_line( GaimWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size )
+void gaim_gtk_whiteboard_draw_brush_line(GaimWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size)
 {
 	int temp;
 
@@ -655,98 +641,100 @@
 	int x;
 	int y;
 
-	gboolean steep = abs( y1 - y0 ) > abs( x1 - x0 );
+	gboolean steep = abs(y1 - y0) > abs(x1 - x0);
 
-	if( steep )
+	if(steep)
 	{
 		temp = x0; x0 = y0; y0 = temp;
 		temp = x1; x1 = y1; y1 = temp;
 	}
 
-	dx		= abs( x1 - x0 );
-	dy		= abs( y1 - y0 );
+	dx = abs(x1 - x0);
+	dy = abs(y1 - y0);
 
-	error	= 0;
-	derror	= dy;
+	error = 0;
+	derror = dy;
 
-	x		= x0;
-	y		= y0;
+	x = x0;
+	y = y0;
 
-	if( x0 < x1 )
+	if(x0 < x1)
 		xstep = 1;
 	else
 		xstep = -1;
 
-	if( y0 < y1 )
+	if(y0 < y1)
 		ystep = 1;
 	else
 		ystep = -1;
 
-	if( steep )
-		gaim_gtk_whiteboard_draw_brush_point( wb, y, x, color, size );
+	if(steep)
+		gaim_gtk_whiteboard_draw_brush_point(wb, y, x, color, size);
 	else
-		gaim_gtk_whiteboard_draw_brush_point( wb, x, y, color, size );
+		gaim_gtk_whiteboard_draw_brush_point(wb, x, y, color, size);
 
-	while( x != x1 )
+	while(x != x1)
 	{
-		x	= x + xstep;
-		error	= error + derror;
+		x += xstep;
+		error += derror;
 
-		if( ( error * 2 ) >= dx )
+		if((error * 2) >= dx)
 		{
-			y	= y + ystep;
-			error	= error - dx;
+			y += ystep;
+			error -= dx;
 		}
 
-		if( steep )
-			gaim_gtk_whiteboard_draw_brush_point( wb, y, x, color, size );
+		if(steep)
+			gaim_gtk_whiteboard_draw_brush_point(wb, y, x, color, size);
 		else
-			gaim_gtk_whiteboard_draw_brush_point( wb, x, y, color, size );
+			gaim_gtk_whiteboard_draw_brush_point(wb, x, y, color, size);
 	}
 }
 
-void gaim_gtk_whiteboard_set_dimensions( GaimWhiteboard *wb, int width, int height )
+void gaim_gtk_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height)
 {
 	GaimGtkWhiteboard *gtkwb = wb->ui_data;
 
-	gtkwb->width	= width;
-	gtkwb->height	= height;
+	gtkwb->width = width;
+	gtkwb->height = height;
 }
 
-void gaim_gtk_whiteboard_clear( GaimWhiteboard *wb )
+void gaim_gtk_whiteboard_clear(GaimWhiteboard *wb)
 {
-	GaimGtkWhiteboard	*gtkwb		= wb->ui_data;
-	GdkPixmap		*pixmap		= gtkwb->pixmap;
-	GtkWidget		*drawing_area	= gtkwb->drawing_area;
+	GaimGtkWhiteboard *gtkwb = wb->ui_data;
+	GdkPixmap *pixmap = gtkwb->pixmap;
+	GtkWidget *drawing_area = gtkwb->drawing_area;
 
-	gdk_draw_rectangle( pixmap,
-			    drawing_area->style->white_gc,
-			    TRUE,
-			    0, 0,
-			    drawing_area->allocation.width, drawing_area->allocation.height );
+	gdk_draw_rectangle(pixmap,
+					   drawing_area->style->white_gc,
+					   TRUE,
+					   0, 0,
+					   drawing_area->allocation.width,
+					   drawing_area->allocation.height);
 
-	gtk_widget_queue_draw_area( drawing_area,
-				    0, 0,
-				    drawing_area->allocation.width, drawing_area->allocation.height );
+	gtk_widget_queue_draw_area(drawing_area,
+							   0, 0,
+							   drawing_area->allocation.width,
+							   drawing_area->allocation.height);
 }
 
-void gaim_gtk_whiteboard_button_clear_press( GtkWidget *widget, gpointer data )
+void gaim_gtk_whiteboard_button_clear_press(GtkWidget *widget, gpointer data)
 {
-	GaimGtkWhiteboard	*gtkwb	= ( GaimGtkWhiteboard* )( data );
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)(data);
 
-	gaim_gtk_whiteboard_clear( gtkwb->wb );
+	gaim_gtk_whiteboard_clear(gtkwb->wb);
 
-	gaim_gtk_whiteboard_set_canvas_as_icon( gtkwb );
+	gaim_gtk_whiteboard_set_canvas_as_icon(gtkwb);
 
 	/* Do protocol specific clearing procedures */
-	if( gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->clear )
-		gtkwb->wb->prpl_ops->clear( gtkwb->wb );
+	if(gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->clear)
+		gtkwb->wb->prpl_ops->clear(gtkwb->wb);
 }
 
-void gaim_gtk_whiteboard_button_save_press( GtkWidget *widget, gpointer data )
+void gaim_gtk_whiteboard_button_save_press(GtkWidget *widget, gpointer data)
 {
-	GaimGtkWhiteboard	*gtkwb	= ( GaimGtkWhiteboard* )( data );
-	GdkPixbuf		*pixbuf;
+	GaimGtkWhiteboard *gtkwb = (GaimGtkWhiteboard*)(data);
+	GdkPixbuf *pixbuf;
 
 	GtkWidget *dialog;
 
@@ -754,88 +742,105 @@
 
 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
 	dialog = gtk_file_chooser_dialog_new ("Save File",
-					      GTK_WINDOW(gtkwb->window),
-					      GTK_FILE_CHOOSER_ACTION_SAVE,
-					      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-					      GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
-					      NULL );
+										  GTK_WINDOW(gtkwb->window),
+										  GTK_FILE_CHOOSER_ACTION_SAVE,
+										  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+										  GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+										  NULL);
 
-	/* gtk_file_chooser_set_do_overwrite_confirmation( GTK_FILE_CHOOSER( dialog ), (gboolean)(TRUE) ); */
+	/* gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), (gboolean)(TRUE)); */
 
-/*	if( user_edited_a_new_document ) */
+	/* if(user_edited_a_new_document) */
 	{
-/*		gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( dialog ), default_folder_for_saving ); */
-		gtk_file_chooser_set_current_name( GTK_FILE_CHOOSER( dialog ), "whiteboard.jpg" );
+	/* gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), default_folder_for_saving); */
+		gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "whiteboard.jpg");
 	}
-/*
+	/*
 	else
 		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document);
-*/
+	*/
 #else
 	dialog = gtk_file_selection_new("Save File");
 	gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), "whiteboard.jpg");
 #endif
-	result = gtk_dialog_run( GTK_DIALOG( dialog ) );
+	result = gtk_dialog_run(GTK_DIALOG(dialog));
 
-	if( result == GTK_RESPONSE_ACCEPT )
+	if(result == GTK_RESPONSE_ACCEPT)
 	{
 		char *filename;
 
 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
-		filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER( dialog ) );
+		filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
 #else
 		filename = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog)));
 #endif
-		gtk_widget_destroy( dialog );
+		gtk_widget_destroy(dialog);
 
 		/* Makes an icon from the whiteboard's canvas 'image' */
-		pixbuf = gdk_pixbuf_get_from_drawable( NULL,
-						( GdkDrawable* )( gtkwb->pixmap ),
-						gdk_drawable_get_colormap( gtkwb->pixmap ),
-						0, 0,
-						0, 0,
-						gtkwb->width, gtkwb->height );
+		pixbuf = gdk_pixbuf_get_from_drawable(NULL,
+											  (GdkDrawable*)(gtkwb->pixmap),
+											  gdk_drawable_get_colormap(gtkwb->pixmap),
+											  0, 0,
+											  0, 0,
+											  gtkwb->width, gtkwb->height);
 
-		if( gdk_pixbuf_save( pixbuf,
-		    		     filename,
-				     "jpeg",
-				     NULL,
-				     "quality",
-				     "100",
-				     NULL ) )
-			g_print( "File Saved...\n" );
+		if(gdk_pixbuf_save(pixbuf, filename, "jpeg", NULL, "quality", "100", NULL))
+			gaim_debug_info("gtkwhiteboard", "File Saved...\n");
 		else
-			g_print( "File not Saved... Error\n" );
+			gaim_debug_info("gtkwhiteboard", "File not Saved... Error\n");
 		g_free(filename);
 	}
-	else
-	if( result == GTK_RESPONSE_CANCEL )
+	else if(result == GTK_RESPONSE_CANCEL)
 	{
-		gtk_widget_destroy( dialog );
+		gtk_widget_destroy(dialog);
 
-		g_print( "File not Saved... Canceled\n" );
+		gaim_debug_info("gtkwhiteboard", "File not Saved... Canceled\n");
 	}
 }
 
-void gaim_gtk_whiteboard_set_canvas_as_icon( GaimGtkWhiteboard *gtkwb )
+void gaim_gtk_whiteboard_set_canvas_as_icon(GaimGtkWhiteboard *gtkwb)
 {
 	GdkPixbuf *pixbuf;
 
 	/* Makes an icon from the whiteboard's canvas 'image' */
-	pixbuf = gdk_pixbuf_get_from_drawable( NULL,
-					       ( GdkDrawable* )( gtkwb->pixmap ),
-					       gdk_drawable_get_colormap( gtkwb->pixmap ),
-					       0, 0,
-					       0, 0,
-					       gtkwb->width, gtkwb->height );
+	pixbuf = gdk_pixbuf_get_from_drawable(NULL,
+										  (GdkDrawable*)(gtkwb->pixmap),
+										  gdk_drawable_get_colormap(gtkwb->pixmap),
+										  0, 0,
+										  0, 0,
+										  gtkwb->width, gtkwb->height);
 
-	gtk_window_set_icon( ( GtkWindow* )( gtkwb->window ), pixbuf );
+	gtk_window_set_icon((GtkWindow*)(gtkwb->window), pixbuf);
+}
+
+void gaim_gtk_whiteboard_rgb24_to_rgb48(int color_rgb, GdkColor *color)
+{
+	color->red   = (color_rgb >> 8) | 0xFF;
+	color->green = (color_rgb & 0xFF00) | 0xFF;
+	color->blue  = ((color_rgb & 0xFF) << 8) | 0xFF;
 }
 
-void gaim_gtk_whiteboard_rgb24_to_rgb48( int color_rgb, GdkColor *color )
+static void
+change_color_cb(GtkColorButton *w, GaimGtkWhiteboard *gtkwb)
 {
-	color->red	= ( color_rgb >> 8 ) | 0xFF;
-	color->green	= ( color_rgb & 0xFF00 ) | 0xFF;
-	color->blue	= ( ( color_rgb & 0xFF ) << 8 ) | 0xFF;
+	GdkColor color;
+	int old_size = 5;
+	int old_color = 0;
+	GaimWhiteboard *wb = gtkwb->wb;
+	GaimWhiteboardPrplOps *prpl = wb->prpl_ops;
+
+	gtk_color_button_get_color(w, &color);
+	gtkwb->brush_color = (color.red & 0xFF00) << 8;
+	gtkwb->brush_color |= (color.green & 0xFF00);
+	gtkwb->brush_color |= (color.blue & 0xFF00) >> 8;
+
+	if (prpl)
+	{
+		if (prpl->get_brush)
+			prpl->get_brush(wb, &old_size, &old_color);
+
+		if (prpl->set_brush)
+			prpl->set_brush(wb, old_size, gtkwb->brush_color);
+	}
 }
 
--- a/src/gtkwhiteboard.h	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/gtkwhiteboard.h	Mon Oct 31 02:19:51 2005 +0000
@@ -29,28 +29,33 @@
 
 #include "whiteboard.h"
 
-#define FULL_CIRCLE_DEGREES		23040
+#define FULL_CIRCLE_DEGREES 23040
 
-#define BRUSH_STATE_UP			0
-#define BRUSH_STATE_DOWN		1
-#define BRUSH_STATE_MOTION		2
+/* TODO: Make into an enum. */
+#define BRUSH_STATE_UP      0
+#define BRUSH_STATE_DOWN    1
+#define BRUSH_STATE_MOTION  2
 
-#define PALETTE_NUM_COLORS		7
+/* XXX: This seems duplicated with the Yahoo! Doodle prpl code.
+ * XXX: How should they work together? */
+#define PALETTE_NUM_COLORS  7
 
 /**
  * A GaimGtkWhiteboard
  */
 typedef struct _GaimGtkWhiteboard
 {
-	GaimWhiteboard	*wb;		/**< backend data for this whiteboard */
+	GaimWhiteboard *wb;      /**< backend data for this whiteboard */
 
-	GtkWidget	*window;	/**< Window for the Doodle session */
-	GtkWidget	*drawing_area;	/**< Drawing area */
+	GtkWidget *window;       /**< Window for the Doodle session */
+	GtkWidget *drawing_area; /**< Drawing area */
 
-	GdkPixmap	*pixmap;	/**< Memory for drawing area */
+	GdkPixmap *pixmap;       /**< Memory for drawing area */
 
-	int		width;		/**< Canvas width */
-	int		height;		/**< Canvas height */
+	int  width;              /**< Canvas width */
+	int  height;             /**< Canvas height */
+	int brush_color;         /**< Foreground color */
+	int brush_size;          /**< Brush size */
 } GaimGtkWhiteboard;
 
 #ifdef __cplusplus
@@ -67,7 +72,7 @@
  *
  * @return The GtkWhiteboard UI Operations.
  */
-GaimWhiteboardUiOps	*gaim_gtk_whiteboard_get_ui_ops( void );
+GaimWhiteboardUiOps *gaim_gtk_whiteboard_get_ui_ops( void );
 
 /*@}*/
 
--- a/src/protocols/yahoo/yahoo.c	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/protocols/yahoo/yahoo.c	Mon Oct 31 02:19:51 2005 +0000
@@ -673,7 +673,7 @@
 	char imv[16];
 
 	if (pkt->status <= 1 || pkt->status == 5) {
-		while (l) {
+		while (l != NULL) {
 			struct yahoo_pair *pair = l->data;
 			if (pair->key == 4) {
 				im = g_new0(struct _yahoo_im, 1);
@@ -697,7 +697,7 @@
 			/* IMV key */
 			if (pair->key == 63)
 			{
-				strcpy( imv, pair->value );
+				strcpy(imv, pair->value);
 			}
 			l = l->next;
 		}
@@ -707,7 +707,7 @@
 	}
 
 	/* Check for the Doodle IMV */
-	if( !strcmp( imv, "doodle;11" ) )
+	if(!strcmp(imv, "doodle;11"))
 	{
 		GaimWhiteboard *wb;
 
@@ -716,15 +716,15 @@
 			return;
 		}
 
-		wb = gaim_whiteboard_get_session( gc->account, im->from );
+		wb = gaim_whiteboard_get_session(gc->account, im->from);
 
 		/* If a Doodle session doesn't exist between this user */
-		if( wb == NULL )
+		if(wb == NULL)
 		{
-			wb = gaim_whiteboard_create( gc->account, im->from, DOODLE_STATE_REQUESTED );
-
-			yahoo_doodle_command_send_request( gc, im->from );
-			yahoo_doodle_command_send_ready( gc, im->from );
+			wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED);
+
+			yahoo_doodle_command_send_request(gc, im->from);
+			yahoo_doodle_command_send_ready(gc, im->from);
 		}
 	}
 
@@ -2083,7 +2083,7 @@
 		break;
 	case YAHOO_SERVICE_P2PFILEXFER:
 		/* This case had no break and continued; thus keeping it this way.*/
-		yahoo_process_p2pfilexfer( gc, pkt ); 
+		yahoo_process_p2pfilexfer(gc, pkt);
 	case YAHOO_SERVICE_FILETRANSFER:
 		yahoo_process_filetransfer(gc, pkt);
 		break;
@@ -3556,6 +3556,8 @@
 	yahoo_doodle_end,
 	yahoo_doodle_get_dimensions,
 	NULL,
+	yahoo_doodle_get_brush,
+	yahoo_doodle_set_brush,
 	yahoo_doodle_send_draw_list,
 	yahoo_doodle_clear
 };
--- a/src/protocols/yahoo/yahoo_doodle.c	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/protocols/yahoo/yahoo_doodle.c	Mon Oct 31 02:19:51 2005 +0000
@@ -76,63 +76,60 @@
 /******************************************************************************
  * Functions
  *****************************************************************************/
-GaimCmdRet yahoo_doodle_gaim_cmd_start( GaimConversation *conv, const char *cmd, char **args, char **error, void *data )
+GaimCmdRet yahoo_doodle_gaim_cmd_start(GaimConversation *conv, const char *cmd, char **args, char **error, void *data)
 {
 	GaimAccount *account;
 	GaimConnection *gc;
 	const gchar *name;
 
-	if( *args && args[0] )
-		return( GAIM_CMD_RET_FAILED );
+	if(*args && args[0])
+		return GAIM_CMD_RET_FAILED;
 
-	account	= gaim_conversation_get_account( conv );
-	gc		= gaim_account_get_connection( account );
-	name	= gaim_conversation_get_name(conv);
+	account = gaim_conversation_get_account(conv);
+	gc = gaim_account_get_connection(account);
+	name = gaim_conversation_get_name(conv);
 	yahoo_doodle_initiate(gc, name);
 
 	/* Write a local message to this conversation showing that a request for a
 	 * Doodle session has been made
 	 */
-	gaim_conv_im_write( GAIM_CONV_IM( conv ), "", _("Sent Doodle request."),
-			    GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time( NULL ) );
+	gaim_conv_im_write(GAIM_CONV_IM(conv), "", _("Sent Doodle request."),
+					   GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time(NULL));
 
-	return( GAIM_CMD_RET_OK );
+	return GAIM_CMD_RET_OK;
 }
 
 void yahoo_doodle_initiate(GaimConnection *gc, const char *name)
 {
 	GaimAccount *account;
-	char *to;
+	char *to = (char*)name;
 	GaimWhiteboard *wb;
 
 	g_return_if_fail(gc);
 	g_return_if_fail(name);
 
-	account = gaim_connection_get_account( gc );
-	to = (char* )name;
-	wb = gaim_whiteboard_get_session( account, to );
+	account = gaim_connection_get_account(gc);
+	wb = gaim_whiteboard_get_session(account, to);
 
-	if( wb == NULL )
+	if(wb == NULL)
 	{
 		/* Insert this 'session' in the list.  At this point, it's only a
 		 * requested session.
 		 */
-		wb = gaim_whiteboard_create( account, to, DOODLE_STATE_REQUESTING );
+		wb = gaim_whiteboard_create(account, to, DOODLE_STATE_REQUESTING);
 	}
-	/*
-	else
-		;
-	 */
+
 	/* NOTE Perhaps some careful handling of remote assumed established
 	 * sessions
 	 */
 
-	yahoo_doodle_command_send_request( gc, to );
-	yahoo_doodle_command_send_ready( gc, to );
+	yahoo_doodle_command_send_request(gc, to);
+	yahoo_doodle_command_send_ready(gc, to);
 
 }
 
-void yahoo_doodle_process( GaimConnection *gc, char *me, char *from, char *command, char *message )
+void yahoo_doodle_process(GaimConnection *gc, const char *me, const char *from,
+						  const char *command, const char *message)
 {
 	if(!command)
 		return;
@@ -141,53 +138,47 @@
 	switch(atoi(command))
 	{
 		case DOODLE_CMD_REQUEST:
-		{
-			yahoo_doodle_command_got_request( gc, from );
-		} break;
+			yahoo_doodle_command_got_request(gc, from);
+			break;
 
 		case DOODLE_CMD_READY:
-		{
-			yahoo_doodle_command_got_ready( gc, from );
-		} break;
+			yahoo_doodle_command_got_ready(gc, from);
+			break;
 
 		case DOODLE_CMD_CLEAR:
-		{
-			yahoo_doodle_command_got_clear( gc, from );
-		} break;
+			yahoo_doodle_command_got_clear(gc, from);
+			break;
 
 		case DOODLE_CMD_DRAW:
-		{
-			yahoo_doodle_command_got_draw( gc, from, message );
-		} break;
+			yahoo_doodle_command_got_draw(gc, from, message);
+			break;
 
 		case DOODLE_CMD_EXTRA:
-		{
-			yahoo_doodle_command_got_extra( gc, from, message );
-		} break;
+			yahoo_doodle_command_got_extra(gc, from, message);
+			break;
 
 		case DOODLE_CMD_CONFIRM:
-		{
-			yahoo_doodle_command_got_confirm( gc, from );
-		} break;
+			yahoo_doodle_command_got_confirm(gc, from);
+			break;
 	}
 }
 
-void yahoo_doodle_command_got_request( GaimConnection *gc, char *from )
+void yahoo_doodle_command_got_request(GaimConnection *gc, const char *from)
 {
 	GaimAccount *account;
 	GaimWhiteboard *wb;
 
 	gaim_debug_info("yahoo", "doodle: Got Request (%s)\n", from);
 
-	account	= gaim_connection_get_account( gc );
+	account = gaim_connection_get_account(gc);
 
 	/* Only handle this if local client requested Doodle session (else local
 	 * client would have sent one)
 	 */
-	wb		= gaim_whiteboard_get_session( account, from );
+	wb = gaim_whiteboard_get_session(account, from);
 
 	/* If a session with the remote user doesn't exist */
-	if( wb == NULL )
+	if(wb == NULL)
 	{
 		/* Ask user if they wish to accept the request for a doodle session */
 		/* TODO Ask local user to start Doodle session with remote user */
@@ -195,16 +186,16 @@
 		 * results
 		 */
 
-		/*	char dialog_message[64];
-		g_sprintf( dialog_message, "%s is requesting to start a Doodle session with you.", from );
+		/* char dialog_message[64];
+		g_sprintf(dialog_message, "%s is requesting to start a Doodle session with you.", from);
 
-		gaim_notify_message( NULL, GAIM_NOTIFY_MSG_INFO, "Doodle",
-		dialog_message, NULL, NULL, NULL );
+		gaim_notify_message(NULL, GAIM_NOTIFY_MSG_INFO, "Doodle",
+		dialog_message, NULL, NULL, NULL);
 		*/
 
-		wb = gaim_whiteboard_create( account, from, DOODLE_STATE_REQUESTED );
+		wb = gaim_whiteboard_create(account, from, DOODLE_STATE_REQUESTED);
 
-		yahoo_doodle_command_send_request( gc, from );
+		yahoo_doodle_command_send_request(gc, from);
 	}
 
 	/* TODO Might be required to clear the canvas of an existing doodle
@@ -212,162 +203,140 @@
 	 */
 }
 
-void yahoo_doodle_command_got_ready( GaimConnection *gc, char *from )
+void yahoo_doodle_command_got_ready(GaimConnection *gc, const char *from)
 {
 	GaimAccount *account;
 	GaimWhiteboard *wb;
 
 	gaim_debug_info("yahoo", "doodle: Got Ready (%s)\n", from);
 
-	account	= gaim_connection_get_account( gc );
+	account = gaim_connection_get_account(gc);
 
 	/* Only handle this if local client requested Doodle session (else local
 	 * client would have sent one)
 	 */
-	wb		= gaim_whiteboard_get_session( account, from );
-					
-	if( wb == NULL )
+	wb = gaim_whiteboard_get_session(account, from);
+
+	if(wb == NULL)
 		return;
 
-	if( wb->state == DOODLE_STATE_REQUESTING )
+	if(wb->state == DOODLE_STATE_REQUESTING)
 	{
-		gaim_whiteboard_start( wb );
+		gaim_whiteboard_start(wb);
 
 		wb->state = DOODLE_STATE_ESTABLISHED;
 
-		yahoo_doodle_command_send_confirm( gc, from );
+		yahoo_doodle_command_send_confirm(gc, from);
 	}
 
-	if( wb->state == DOODLE_STATE_ESTABLISHED )
+	if(wb->state == DOODLE_STATE_ESTABLISHED)
 	{
 		/* TODO Ask whether to save picture too */
-		gaim_whiteboard_clear( wb );
+		gaim_whiteboard_clear(wb);
 	}
 
 	/* NOTE Not sure about this... I am trying to handle if the remote user
 	 * already thinks we're in a session with them (when their chat message
 	 * contains the doodle;11 imv key)
 	 */
-	if( wb->state == DOODLE_STATE_REQUESTED )
+	if(wb->state == DOODLE_STATE_REQUESTED)
 	{
-		/* gaim_whiteboard_start( wb ); */
-		yahoo_doodle_command_send_request( gc, from );
+		/* gaim_whiteboard_start(wb); */
+		yahoo_doodle_command_send_request(gc, from);
 	}
 }
 
-void yahoo_doodle_command_got_draw( GaimConnection *gc, char *from, char *message )
+void yahoo_doodle_command_got_draw(GaimConnection *gc, const char *from, const char *message)
 {
 	GaimAccount *account;
 	GaimWhiteboard *wb;
-	int *token;
-	int length;
-	char *token_end;
-	GList *d_list;
-	int *n;
-	GList *l;
+	char **tokens;
+	int i;
+	GList *d_list = NULL; /* a local list of drawing info */
 
 	gaim_debug_info("yahoo", "doodle: Got Draw (%s)\n", from);
 	gaim_debug_info("yahoo", "doodle: Draw message: %s\n", message);
 
-	account	= gaim_connection_get_account( gc );
+	account = gaim_connection_get_account(gc);
 
 	/* Only handle this if local client requested Doodle session (else local
 	 * client would have sent one)
 	 */
-	wb		= gaim_whiteboard_get_session( account, from );
+	wb = gaim_whiteboard_get_session(account, from);
 
-	if( wb == NULL )
+	if(wb == NULL)
 		return;
 
 	/* TODO Functionalize
 	 * Convert drawing packet message to an integer list
 	 */
-	token		= NULL;
-	length		= strlen( message );
-
-	d_list		= NULL;	/* a local list of drawing info */
 
 	/* Check to see if the message begans and ends with quotes */
-	if( ( message[0] != '\"' ) || ( message[length - 1] != '\"' ) )
+	if((message[0] != '\"') || (message[strlen(message) - 1] != '\"'))
 		return;
 
-	/* Truncate the quotations off of our message (why the hell did they add
-	 * them anyways!?)
-	 */
-	message[length - 1]	= ',';
-	message			= message + 1;
+	/* Ignore the inital quotation mark. */
+	message += 1;
+
+	tokens = g_strsplit(message, ",", 0);
 
 	/* Traverse and extract all integers divided by commas */
-	while( ( token_end = strchr( message, ',' ) ) )
+	for (i = 0; tokens[i] != NULL; i++)
 	{
-		token_end[0]	= 0;
-
-		token		= g_new0( int, 1 );
-
-		*token		= atoi( message );
-
-		d_list		= g_list_append( d_list, ( gpointer )( token ) );
-
-		message		= token_end + 1;
-	}
-
-	yahoo_doodle_draw_stroke( wb, d_list );
+		int last = strlen(tokens[i]) - 1;
+		if (tokens[i][last] == '"')
+			tokens[i][last] == '\0';
 
-	/* goodle_doodle_session_set_canvas_as_icon( ds ); */
+		d_list = g_list_prepend(d_list, GINT_TO_POINTER(atoi(tokens[i])));
+	}
+	d_list = g_list_reverse(d_list);
+
+	g_strfreev(tokens);
 
-	/* Remove that shit */
-	n = NULL;
-	l = d_list;
-	while( l )
-	{
-		n = l->data;
+	yahoo_doodle_draw_stroke(wb, d_list);
 
-		g_free( n );
+	/* goodle_doodle_session_set_canvas_as_icon(ds); */
 
-		l = l->next;
-	}
-
-	g_list_free( d_list );
-	d_list = NULL;
+	g_list_free(d_list);
 }
 
-void yahoo_doodle_command_got_clear( GaimConnection *gc, char *from )
+void yahoo_doodle_command_got_clear(GaimConnection *gc, const char *from)
 {
 	GaimAccount *account;
 	GaimWhiteboard *wb;
 
 	gaim_debug_info("yahoo", "doodle: Got Clear (%s)\n", from);
 
-	account	= gaim_connection_get_account( gc );
+	account = gaim_connection_get_account(gc);
 
 	/* Only handle this if local client requested Doodle session (else local
 	 * client would have sent one)
 	 */
-	wb		= gaim_whiteboard_get_session( account, from );
+	wb = gaim_whiteboard_get_session(account, from);
 
-	if( wb == NULL )
+	if(wb == NULL)
 		return;
 
-	if( wb->state == DOODLE_STATE_ESTABLISHED )
+	if(wb->state == DOODLE_STATE_ESTABLISHED)
 	{
 		/* TODO Ask user whether to save the image before clearing it */
 
-		gaim_whiteboard_clear( wb );
+		gaim_whiteboard_clear(wb);
 	}
 }
 
 void
-yahoo_doodle_command_got_extra( GaimConnection *gc, char *from, char *message )
+yahoo_doodle_command_got_extra(GaimConnection *gc, const char *from, const char *message)
 {
 	gaim_debug_info("yahoo", "doodle: Got Extra (%s)\n", from);
 
 	/* I do not like these 'extra' features, so I'll only handle them in one
 	 * way, which is returning them with the command/packet to turn them off
 	 */
-	yahoo_doodle_command_send_extra( gc, from, DOODLE_EXTRA_NONE );
+	yahoo_doodle_command_send_extra(gc, from, DOODLE_EXTRA_NONE);
 }
 
-void yahoo_doodle_command_got_confirm( GaimConnection *gc, char *from )
+void yahoo_doodle_command_got_confirm(GaimConnection *gc, const char *from)
 {
 	GaimAccount *account;
 	GaimWhiteboard *wb;
@@ -375,362 +344,253 @@
 	gaim_debug_info("yahoo", "doodle: Got Confirm (%s)\n", from);
 
 	/* Get the doodle session */
-	account	= gaim_connection_get_account( gc );
+	account = gaim_connection_get_account(gc);
 
 	/* Only handle this if local client requested Doodle session (else local
 	 * client would have sent one)
 	 */
-	wb		= gaim_whiteboard_get_session( account, from );
+	wb = gaim_whiteboard_get_session(account, from);
 
-	if( wb == NULL )
+	if(wb == NULL)
 		return;
 
 	/* TODO Combine the following IF's? */
 
 	/* Check if we requested a doodle session */
-	if( wb->state == DOODLE_STATE_REQUESTING )
+	if(wb->state == DOODLE_STATE_REQUESTING)
 	{
 		wb->state = DOODLE_STATE_ESTABLISHED;
 
-		gaim_whiteboard_start( wb );
+		gaim_whiteboard_start(wb);
 
-		yahoo_doodle_command_send_confirm( gc, from );
+		yahoo_doodle_command_send_confirm(gc, from);
 	}
 
 	/* Check if we accepted a request for a doodle session */
-	if( wb->state == DOODLE_STATE_REQUESTED )
+	if(wb->state == DOODLE_STATE_REQUESTED)
 	{
 		wb->state = DOODLE_STATE_ESTABLISHED;
 
-		gaim_whiteboard_start( wb );
+		gaim_whiteboard_start(wb);
 	}
 }
 
-void yahoo_doodle_command_got_shutdown( GaimConnection *gc, char *from )
+void yahoo_doodle_command_got_shutdown(GaimConnection *gc, const char *from)
 {
 	GaimAccount *account;
 	GaimWhiteboard *wb;
 
 	gaim_debug_info("yahoo", "doodle: Got Shutdown (%s)\n", from);
 
-	account	= gaim_connection_get_account( gc );
+	account = gaim_connection_get_account(gc);
 
 	/* Only handle this if local client requested Doodle session (else local
 	 * client would have sent one)
 	 */
-	wb		= gaim_whiteboard_get_session( account, from );
+	wb = gaim_whiteboard_get_session(account, from);
 
 	/* TODO Ask if user wants to save picture before the session is closed */
 
 	/* If this session doesn't exist, don't try and kill it */
-	if( wb == NULL )
+	if(wb == NULL)
 		return;
 	else
 	{
-		gaim_whiteboard_destroy( wb );
+		gaim_whiteboard_destroy(wb);
 
-		/* yahoo_doodle_command_send_shutdown( gc, from ); */
+		/* yahoo_doodle_command_send_shutdown(gc, from); */
 	}
 }
 
-void yahoo_doodle_command_send_request( GaimConnection *gc, char *to )
+static void yahoo_doodle_command_send_generic(const char *type,
+											  GaimConnection *gc,
+											  const char *to,
+											  const char *message,
+											  const char *thirteen,
+											  const char *sixtythree,
+											  const char *sixtyfour)
 {
-	struct yahoo_data	*yd;
-	struct yahoo_packet	*pkt;
+	struct yahoo_data *yd;
+	struct yahoo_packet *pkt;
 
-	gaim_debug_info("yahoo", "doodle: Sent Request (%s)\n", to);
+	gaim_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to);
 
 	yd = gc->proto_data;
 
 	/* Make and send an acknowledge (ready) Doodle packet */
-	pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
-	yahoo_packet_hash_str( pkt, 49,		"IMVIRONMENT" );
-	yahoo_packet_hash_str( pkt, 1,		gaim_account_get_username( gc->account ) );
-	yahoo_packet_hash_str( pkt, 14,		"1" );
-	yahoo_packet_hash_str( pkt, 13,		"1" );
-	yahoo_packet_hash_str( pkt, 5,		to );
-	yahoo_packet_hash_str( pkt, 63,		"doodle;11" );
-	yahoo_packet_hash_str( pkt, 64,		"1" );
-	yahoo_packet_hash_str( pkt, 1002,	"1" );
+	pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0);
+	yahoo_packet_hash_str(pkt, 49,  "IMVIRONMENT");
+	yahoo_packet_hash_str(pkt, 1,    gaim_account_get_username(gc->account));
+	yahoo_packet_hash_str(pkt, 14,   message);
+	yahoo_packet_hash_str(pkt, 13,   thirteen);
+	yahoo_packet_hash_str(pkt, 5,    to);
+	yahoo_packet_hash_str(pkt, 63,   sixtythree ? sixtythree : "doodle;11");
+	yahoo_packet_hash_str(pkt, 64,   sixtyfour);
+	yahoo_packet_hash_str(pkt, 1002, "1");
 
-	yahoo_packet_send_and_free( pkt, yd );
+	yahoo_packet_send_and_free(pkt, yd);
+}
+
+void yahoo_doodle_command_send_request(GaimConnection *gc, const char *to)
+{
+	yahoo_doodle_command_send_generic("Request", gc, to, "1", "1", NULL, "1");
 }
 
-void yahoo_doodle_command_send_ready( GaimConnection *gc, char *to )
+void yahoo_doodle_command_send_ready(GaimConnection *gc, const char *to)
 {
-	struct yahoo_data	*yd;
-	struct yahoo_packet	*pkt;
-
-	gaim_debug_info("yahoo", "doodle: Sent Ready (%s)\n", to);
-
-	yd = gc->proto_data;
+	yahoo_doodle_command_send_generic("Ready", gc, to, "", "0", NULL, "0");
+}
 
-	/* Make and send a request to start a Doodle session */
-	pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
-	yahoo_packet_hash_str( pkt, 49,		"IMVIRONMENT" );
-	yahoo_packet_hash_str( pkt, 1,		gaim_account_get_username( gc->account ) );
-	yahoo_packet_hash_str( pkt, 14,		"" );
-	yahoo_packet_hash_str( pkt, 13,		"0" );
-	yahoo_packet_hash_str( pkt, 5,		to );
-	yahoo_packet_hash_str( pkt, 63,		"doodle;11" );
-	yahoo_packet_hash_str( pkt, 64,		"0" );
-	yahoo_packet_hash_str( pkt, 1002,	"1" );
+void yahoo_doodle_command_send_draw(GaimConnection *gc, const char *to, const char *message)
+{
+	yahoo_doodle_command_send_generic("Draw", gc, to, message, "3", NULL, "1");
+}
 
-	yahoo_packet_send_and_free( pkt, yd );
+void yahoo_doodle_command_send_clear(GaimConnection *gc, const char *to)
+{
+	yahoo_doodle_command_send_generic("Clear", gc, to, " ", "2", NULL, "1");
+}
+
+void yahoo_doodle_command_send_extra(GaimConnection *gc, const char *to, const char *message)
+{
+	yahoo_doodle_command_send_generic("Extra", gc, to, message, "4", NULL, "1");
 }
 
-void yahoo_doodle_command_send_draw( GaimConnection *gc, char *to, char *message )
+void yahoo_doodle_command_send_confirm(GaimConnection *gc, const char *to)
 {
-	struct yahoo_data	*yd;
-	struct yahoo_packet	*pkt;
-
-	gaim_debug_info("yahoo", "doodle: Sent Draw (%s)\n", to);
-
-	yd = gc->proto_data;
+	yahoo_doodle_command_send_generic("Confirm", gc, to, "1", "5", NULL, "1");
+}
 
-	/* Make and send a drawing packet */
-	pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
-	yahoo_packet_hash_str( pkt, 49,		"IMVIRONMENT" );
-	yahoo_packet_hash_str( pkt, 1,		gaim_account_get_username( gc->account ) );
-	yahoo_packet_hash_str( pkt, 14,		message );
-	yahoo_packet_hash_str( pkt, 13,		"3" );
-	yahoo_packet_hash_str( pkt, 5,		to );
-	yahoo_packet_hash_str( pkt, 63,		"doodle;11" );
-	yahoo_packet_hash_str( pkt, 64,		"1" );
-	yahoo_packet_hash_str( pkt, 1002,	"1" );
-
-	yahoo_packet_send_and_free( pkt, yd );
+void yahoo_doodle_command_send_shutdown(GaimConnection *gc, const char *to)
+{
+	yahoo_doodle_command_send_generic("Shutdown", gc, to, "", "0", ";0", "0");
 }
 
-void yahoo_doodle_command_send_clear( GaimConnection *gc, char *to )
+void yahoo_doodle_start(GaimWhiteboard *wb)
 {
-	struct yahoo_data	*yd;
-	struct yahoo_packet	*pkt;
+	doodle_session *ds = g_new0(doodle_session, 1);
 
-	gaim_debug_info("yahoo", "doodle: Sent Clear (%s)\n", to);
-
-	yd = gc->proto_data;
+	/* gaim_debug_debug("yahoo", "doodle: yahoo_doodle_start()\n"); */
 
-	/* Make and send a request to clear packet */
-	pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
-	yahoo_packet_hash_str( pkt, 49,		"IMVIRONMENT" );
-	yahoo_packet_hash_str( pkt, 1,		gaim_account_get_username( gc->account ) );
-	yahoo_packet_hash_str( pkt, 14,		" " );
-	yahoo_packet_hash_str( pkt, 13,		"2" );
-	yahoo_packet_hash_str( pkt, 5,		to );
-	yahoo_packet_hash_str( pkt, 63,		"doodle;11" );
-	yahoo_packet_hash_str( pkt, 64,		"1" );
-	yahoo_packet_hash_str( pkt, 1002,	"1" );
+	/* Set default brush size and color */
+	ds->brush_size  = DOODLE_BRUSH_SMALL;
+	ds->brush_color = DOODLE_COLOR_RED;
 
-	yahoo_packet_send_and_free( pkt, yd );
+	wb->proto_data = ds;
 }
 
-void yahoo_doodle_command_send_extra( GaimConnection *gc, char *to, char *message )
+void yahoo_doodle_end(GaimWhiteboard *wb)
 {
-	struct yahoo_data	*yd;
-	struct yahoo_packet	*pkt;
+	GaimConnection *gc = gaim_account_get_connection(wb->account);
 
-	gaim_debug_info("yahoo", "doodle: Sent Extra (%s)\n", to);
+	/* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */
 
-	yd = gc->proto_data;
+	yahoo_doodle_command_send_shutdown(gc, wb->who);
 
-	/* Send out a request to use a specified 'extra' feature (message) */
-	pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
-	yahoo_packet_hash_str( pkt, 49,		"IMVIRONMENT" );
-	yahoo_packet_hash_str( pkt, 1,		gaim_account_get_username( gc->account ) );
-	yahoo_packet_hash_str( pkt, 14,		message );
-	yahoo_packet_hash_str( pkt, 13,		"4" );
-	yahoo_packet_hash_str( pkt, 5,		to );
-	yahoo_packet_hash_str( pkt, 63,		"doodle;11" );
-	yahoo_packet_hash_str( pkt, 64,		"1" );
-	yahoo_packet_hash_str( pkt, 1002,	"1" );
+	g_free(wb->proto_data);
+}
 
-	yahoo_packet_send_and_free( pkt, yd );
+void yahoo_doodle_get_dimensions(GaimWhiteboard *wb, int *width, int *height)
+{
+	/* standard Doodle canvases are of one size:  368x256 */
+	*width = DOODLE_CANVAS_WIDTH;
+	*height = DOODLE_CANVAS_HEIGHT;
 }
 
-void yahoo_doodle_command_send_confirm( GaimConnection *gc, char *to )
+static char *yahoo_doodle_build_draw_string(doodle_session *ds, GList *draw_list)
 {
-	struct yahoo_data	*yd;
-	struct yahoo_packet	*pkt;
+	GString *message;
 
-	gaim_debug_info("yahoo", "doodle: Sent Confirm (%s)\n", to);
-
-	yd = gc->proto_data;
+	g_return_val_if_fail(draw_list != NULL, NULL);
 
-	/* Send ready packet (that local client accepted and is ready) */
-	pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
-	yahoo_packet_hash_str( pkt, 49,		"IMVIRONMENT" );
-	yahoo_packet_hash_str( pkt, 1,		( char* )( gaim_account_get_username( gc->account ) ) );
-	yahoo_packet_hash_str( pkt, 14,		"1" );
-	yahoo_packet_hash_str( pkt, 13,		"5" );
-	yahoo_packet_hash_str( pkt, 5,		to );
-	yahoo_packet_hash_str( pkt, 63,		"doodle;11" );
-	yahoo_packet_hash_str( pkt, 64,		"1" );
-	yahoo_packet_hash_str( pkt, 1002,	"1" );
+	message = g_string_new("");
+	g_string_printf(message, "\"%d,%d", ds->brush_color, ds->brush_size);
 
-	yahoo_packet_send_and_free( pkt, yd );
+	for(; draw_list != NULL; draw_list = draw_list->next)
+	{
+		g_string_append_printf(message, ",%d", GPOINTER_TO_INT(draw_list->data));
+	}
+	g_string_append_c(message, '"');
+
+	return g_string_free(message, FALSE);
 }
 
-void yahoo_doodle_command_send_shutdown( GaimConnection *gc, char *to )
+void yahoo_doodle_send_draw_list(GaimWhiteboard *wb, GList *draw_list)
 {
-	struct yahoo_data	*yd;
-	struct yahoo_packet	*pkt;
-
-	gaim_debug_info("yahoo", "doodle: Sent Shutdown (%s)\n", to);
-
-	yd = gc->proto_data;
+	doodle_session *ds = wb->proto_data;
+	char *message;
 
-	/* Declare that you are ending the Doodle session */
-	pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
-	yahoo_packet_hash_str( pkt, 49,		"IMVIRONMENT" );
-	yahoo_packet_hash_str( pkt, 1,		gaim_account_get_username( gc->account ) );
-	yahoo_packet_hash_str( pkt, 14,		"" );
-	yahoo_packet_hash_str( pkt, 13,		"0" );
-	yahoo_packet_hash_str( pkt, 5,		to );
-	yahoo_packet_hash_str( pkt, 63,		";0" );
-	yahoo_packet_hash_str( pkt, 64,		"0" );
-	yahoo_packet_hash_str( pkt, 1002,	"1" );
+	g_return_if_fail(draw_list != NULL);
 
-	yahoo_packet_send_and_free( pkt, yd );
+	message = yahoo_doodle_build_draw_string(ds, draw_list);
+		yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message);
+	g_free(message);
 }
 
-void yahoo_doodle_start( GaimWhiteboard *wb )
+void yahoo_doodle_clear(GaimWhiteboard *wb)
 {
-	doodle_session *ds	= g_new0( doodle_session, 1 );
-
-	/* g_print( "yahoo_doodle_start()\n" ); */
-
-	/* Set default brush size and color */
-	ds->brush_size		= DOODLE_BRUSH_MEDIUM;
-	ds->brush_color		= 0;	/* black */
-
-	wb->proto_data		= ds;
+	yahoo_doodle_command_send_clear(wb->account->gc, wb->who);
 }
 
-void yahoo_doodle_end( GaimWhiteboard *wb )
-{
-	GaimConnection *gc = gaim_account_get_connection( wb->account );
-	doodle_session *ds;
-
-	/* g_print( "yahoo_doodle_end()\n" ); */
-
-	yahoo_doodle_command_send_shutdown( gc, wb->who );
 
-	ds = wb->proto_data;
-	if( ds )
-		g_free( ds );
-}
-
-void yahoo_doodle_get_dimensions( GaimWhiteboard *wb, int *width, int *height )
+/* Traverse through the list and draw the points and lines */
+void yahoo_doodle_draw_stroke(GaimWhiteboard *wb, GList *draw_list)
 {
-	/* standard Doodle canvases are of one size:  368x256 */
-	*width	= DOODLE_CANVAS_WIDTH;
-	*height	= DOODLE_CANVAS_HEIGHT;
-}
+	int brush_color;
+	int brush_size;
+	int x;
+	int y;
 
-void yahoo_doodle_send_draw_list( GaimWhiteboard *wb, GList *draw_list )
-{
-	doodle_session	*ds		= wb->proto_data;
-	char 		*message	= yahoo_doodle_build_draw_string( ds, draw_list );
+	g_return_if_fail(draw_list != NULL);
 
-	/* g_print( "yahoo_doodle_send_draw_list()\n" ); */
-
-	if( message )
-		yahoo_doodle_command_send_draw( wb->account->gc, wb->who, message );
+	brush_color = GPOINTER_TO_INT(draw_list->data);
+	draw_list = draw_list->next;
+	g_return_if_fail(draw_list != NULL);
 
-}
-
-void yahoo_doodle_clear( GaimWhiteboard *wb )
-{
-	yahoo_doodle_command_send_clear( wb->account->gc, wb->who );
-}
+	brush_size = GPOINTER_TO_INT(draw_list->data);
+	draw_list = draw_list->next;
+	g_return_if_fail(draw_list != NULL);
 
-void yahoo_doodle_draw_stroke( GaimWhiteboard *wb, GList *draw_list )
-{
-	/* Traverse through the list and draw the points and lines */
-
-	GList	*l = draw_list;
-
-	int	*n = NULL;
+	x = GPOINTER_TO_INT(draw_list->data);
+	draw_list = draw_list->next;
+	g_return_if_fail(draw_list != NULL);
 
-	int	brush_color;
-	int	brush_size;
-	int	x;
-	int	y;
-
-	int	dx, dy;
-
-	int count = 0;
+	y = GPOINTER_TO_INT(draw_list->data);
+	draw_list = draw_list->next;
+	g_return_if_fail(draw_list != NULL);
 
 	/*
-	g_print( "Drawing: color=%d, size=%d, (%d,%d)\n", brush_color, brush_size,
-			x, y );
+	gaim_debug_debug("yahoo", "doodle: Drawing: color=%d, size=%d, (%d,%d)\n", brush_color, brush_size, x, y);
 	*/
 
-	n = l->data; brush_color = *n; l = l->next;
-	n = l->data; brush_size	 = *n; l = l->next;
-	n = l->data; x		 = *n; l = l->next;
-	n = l->data; y		 = *n; l = l->next;
-
-	/* Pray this works and pray that the list has an even number of elements */
-	while( l )
+	while(draw_list != NULL && draw_list->next != NULL)
 	{
-		count++;
+		int dx = GPOINTER_TO_INT(draw_list->data);
+		int dy = GPOINTER_TO_INT(draw_list->next->data);
 
-		n = l->data; dx	= *n; l = l->next;
-		n = l->data; dy	= *n; l = l->next;
+		gaim_whiteboard_draw_line(wb,
+								  x, y,
+								  x + dx, y + dy,
+								  brush_color, brush_size);
 
-		gaim_whiteboard_draw_line( wb,
-					   x, y,
-					   x + dx, y + dy,
-					   brush_color, brush_size );
+		x += dx;
+		y += dy;
 
-		x = x + dx;
-		y = y + dy;
+		draw_list = draw_list->next->next;
 	}
 }
 
-char *yahoo_doodle_build_draw_string( doodle_session *ds, GList *draw_list )
-{
-	GList		*l = draw_list;
-
-	int		*n = NULL;
-
-	static char	message[1024]; /* Hope that 1024 is enough */
-	char		token_string[16]; /* Token string extracted from draw list */
-
-	if( draw_list == NULL )
-		return( NULL );
-
-	strcpy( message, "\"" );
-
-	sprintf( token_string, "%d,%d,", ds->brush_color, ds->brush_size );
-	strcat( message, token_string );
-
-	/* Pray this works and pray that the list has an even number of elements */
-	while( l )
+void yahoo_doodle_get_brush(GaimWhiteboard *wb, int *size, int *color)
 	{
-		n = l->data;
-
-		sprintf( token_string, "%d,", *n );
-
-		/* This check prevents overflow */
-		if( ( strlen( message ) + strlen( token_string ) ) < 1024 )
-			strcat( message, token_string );
-		else
-			break;
-
-		l = l->next;
+	doodle_session *ds = (doodle_session *)wb->proto_data;
+	*size = ds->brush_size;
+	*color = ds->brush_color;
 	}
 
-	message[strlen( message ) - 1]	= '\"';
-	/*
-	message[strlen( message )]	= 0;
-	message[511]			= 0;
-
-	g_print( "Draw Message:  %s\n", message );
-	*/
-
-	return( message );
+void yahoo_doodle_set_brush(GaimWhiteboard *wb, int size, int color)
+{
+	doodle_session *ds = (doodle_session *)wb->proto_data;
+	ds->brush_size = size;
+	ds->brush_color = color;
 }
 
--- a/src/protocols/yahoo/yahoo_doodle.h	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/protocols/yahoo/yahoo_doodle.h	Mon Oct 31 02:19:51 2005 +0000
@@ -35,96 +35,99 @@
  * Defines
  *****************************************************************************/
 /* Doodle communication commands */
-#define DOODLE_CMD_REQUEST		0
-#define DOODLE_CMD_READY		1
-#define DOODLE_CMD_CLEAR		2
-#define DOODLE_CMD_DRAW			3
-#define DOODLE_CMD_EXTRA		4
-#define DOODLE_CMD_CONFIRM		5
+/* TODO: Should be an enum. */
+#define DOODLE_CMD_REQUEST  0
+#define DOODLE_CMD_READY    1
+#define DOODLE_CMD_CLEAR    2
+#define DOODLE_CMD_DRAW     3
+#define DOODLE_CMD_EXTRA    4
+#define DOODLE_CMD_CONFIRM  5
+/* Doodle communication command for shutting down (also 0) */
+#define DOODLE_CMD_SHUTDOWN 0
 
-/* Doodle communication command for shutting down (also 0) */
-#define DOODLE_CMD_SHUTDOWN		DOODLE_CMD_REQUEST
-
-#define DOODLE_EXTRA_NONE		"\"1\""
-#define DOODLE_EXTRA_TICTACTOE		"\"3\""
-#define DOODLE_EXTRA_DOTS		"\"2\""
+#define DOODLE_EXTRA_NONE      "\"1\""
+#define DOODLE_EXTRA_TICTACTOE "\"3\""
+#define DOODLE_EXTRA_DOTS      "\"2\""
 
 /* Doodle session states */
-#define DOODLE_STATE_REQUESTING		0
-#define DOODLE_STATE_REQUESTED		1
-#define DOODLE_STATE_ESTABLISHED	2
+/* TODO: Should be an enum. */
+#define DOODLE_STATE_REQUESTING  0
+#define DOODLE_STATE_REQUESTED   1
+#define DOODLE_STATE_ESTABLISHED 2
 
 /* Doodle canvas dimensions */
-#define DOODLE_CANVAS_WIDTH		368
-#define DOODLE_CANVAS_HEIGHT		256
+#define DOODLE_CANVAS_WIDTH  368
+#define DOODLE_CANVAS_HEIGHT 256
 
 /* Doodle color codes (most likely RGB) */
-#define	DOODLE_COLOR_RED		13369344
-#define	DOODLE_COLOR_ORANGE		16737792
-#define	DOODLE_COLOR_YELLOW		15658496
-#define	DOODLE_COLOR_GREEN		52224
-#define	DOODLE_COLOR_CYAN		52428
-#define	DOODLE_COLOR_BLUE		204
-#define	DOODLE_COLOR_VIOLET		5381277
-#define	DOODLE_COLOR_PURPLE		13369548
-#define	DOODLE_COLOR_TAN		12093547
-#define	DOODLE_COLOR_BROWN		5256485
-#define	DOODLE_COLOR_BLACK		0
-#define	DOODLE_COLOR_GREY		11184810
-#define	DOODLE_COLOR_WHITE		16777215
+/* TODO: Should be an enum and sorted by color name. */
+#define	DOODLE_COLOR_RED    13369344
+#define	DOODLE_COLOR_ORANGE 16737792
+#define	DOODLE_COLOR_YELLOW 15658496
+#define	DOODLE_COLOR_GREEN     52224
+#define	DOODLE_COLOR_CYAN      52428
+#define	DOODLE_COLOR_BLUE        204
+#define	DOODLE_COLOR_VIOLET  5381277
+#define	DOODLE_COLOR_PURPLE 13369548
+#define	DOODLE_COLOR_TAN    12093547
+#define	DOODLE_COLOR_BROWN   5256485
+#define	DOODLE_COLOR_BLACK         0
+#define	DOODLE_COLOR_GREY   11184810
+#define	DOODLE_COLOR_WHITE  16777215
 
-#define PALETTE_NUM_OF_COLORS		12
+#define PALETTE_NUM_OF_COLORS 12
 
 /* Doodle brush sizes (most likely variable) */
-#define DOODLE_BRUSH_SMALL		2
-#define DOODLE_BRUSH_MEDIUM		5
-#define DOODLE_BRUSH_LARGE		10
+#define DOODLE_BRUSH_SMALL   2
+#define DOODLE_BRUSH_MEDIUM  5
+#define DOODLE_BRUSH_LARGE  10
 
-#define DOODLE_MAX_BRUSH_MOTIONS	100
+#define DOODLE_MAX_BRUSH_MOTIONS 100
 
 /******************************************************************************
  * Datatypes
  *****************************************************************************/
 typedef struct _doodle_session
 {
-	int		brush_size;	/* Size of drawing brush */
-	int		brush_color;	/* Color of drawing brush */
+	int brush_size;  /* Size of drawing brush */
+	int brush_color; /* Color of drawing brush */
 } doodle_session;
 
 /******************************************************************************
  * API
  *****************************************************************************/
-void dummy_func( void );
+
+GaimCmdRet yahoo_doodle_gaim_cmd_start(GaimConversation *conv, const char *cmd, char **args,
+									   char **error, void *data);
 
-GaimCmdRet		yahoo_doodle_gaim_cmd_start( GaimConversation *conv, const char *cmd, char **args,
-						     char **error, void *data );
-
-void			yahoo_doodle_process( GaimConnection *gc, char *me, char *from, char *command, char *message );
-void			yahoo_doodle_initiate( GaimConnection *gc, const char *to);
+void yahoo_doodle_process(GaimConnection *gc, const char *me, const char *from,
+						  const char *command, const char *message);
+void yahoo_doodle_initiate(GaimConnection *gc, const char *to);
 
-void			yahoo_doodle_command_got_request( GaimConnection *gc, char *from );
-void			yahoo_doodle_command_got_ready( GaimConnection *gc, char *from );
-void			yahoo_doodle_command_got_draw( GaimConnection *gc, char *from, char *message );
-void			yahoo_doodle_command_got_clear( GaimConnection *gc, char *from );
-void			yahoo_doodle_command_got_extra( GaimConnection *gc, char *from, char *message );
-void			yahoo_doodle_command_got_confirm( GaimConnection *gc, char *from );
-void			yahoo_doodle_command_got_shutdown( GaimConnection *gc, char *from );
+void yahoo_doodle_command_got_request(GaimConnection *gc, const char *from);
+void yahoo_doodle_command_got_ready(GaimConnection *gc, const char *from);
+void yahoo_doodle_command_got_draw(GaimConnection *gc, const char *from, const char *message);
+void yahoo_doodle_command_got_clear(GaimConnection *gc, const char *from);
+void yahoo_doodle_command_got_extra(GaimConnection *gc, const char *from, const char *message);
+void yahoo_doodle_command_got_confirm(GaimConnection *gc, const char *from);
+void yahoo_doodle_command_got_shutdown(GaimConnection *gc, const char *from);
 
-void			yahoo_doodle_command_send_request( GaimConnection *gc, char *to );
-void			yahoo_doodle_command_send_ready( GaimConnection *gc, char *to );
-void			yahoo_doodle_command_send_draw( GaimConnection *gc, char *to, char *message );
-void			yahoo_doodle_command_send_clear( GaimConnection *gc, char *to );
-void			yahoo_doodle_command_send_extra( GaimConnection *gc, char *to, char *message );
-void			yahoo_doodle_command_send_confirm( GaimConnection *gc, char *to );
-void			yahoo_doodle_command_send_shutdown( GaimConnection *gc, char *to );
+void yahoo_doodle_command_send_request(GaimConnection *gc, const char *to);
+void yahoo_doodle_command_send_ready(GaimConnection *gc, const char *to);
+void yahoo_doodle_command_send_draw(GaimConnection *gc, const char *to, const char *message);
+void yahoo_doodle_command_send_clear(GaimConnection *gc, const char *to);
+void yahoo_doodle_command_send_extra(GaimConnection *gc, const char *to, const char *message);
+void yahoo_doodle_command_send_confirm(GaimConnection *gc, const char *to);
+void yahoo_doodle_command_send_shutdown(GaimConnection *gc, const char *to);
 
-void			yahoo_doodle_start( GaimWhiteboard *wb );
-void			yahoo_doodle_end( GaimWhiteboard *wb );
-void			yahoo_doodle_get_dimensions( GaimWhiteboard *wb, int *width, int *height );
-void			yahoo_doodle_send_draw_list( GaimWhiteboard *wb, GList *draw_list );
-void			yahoo_doodle_clear( GaimWhiteboard *wb );
+void yahoo_doodle_start(GaimWhiteboard *wb);
+void yahoo_doodle_end(GaimWhiteboard *wb);
+void yahoo_doodle_get_dimensions(GaimWhiteboard *wb, int *width, int *height);
+void yahoo_doodle_send_draw_list(GaimWhiteboard *wb, GList *draw_list);
+void yahoo_doodle_clear(GaimWhiteboard *wb);
 
-void			yahoo_doodle_draw_stroke( GaimWhiteboard *wb, GList *draw_list );
-char			*yahoo_doodle_build_draw_string( doodle_session *ds, GList *draw_list );
+void yahoo_doodle_draw_stroke(GaimWhiteboard *wb, GList *draw_list);
+void yahoo_doodle_get_brush(GaimWhiteboard *wb, int *size, int *color);
+void yahoo_doodle_set_brush(GaimWhiteboard *wb, int size, int color);
 
 #endif /* _YAHOO_DOODLE_H_ */
--- a/src/protocols/yahoo/yahoo_filexfer.c	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/protocols/yahoo/yahoo_filexfer.c	Mon Oct 31 02:19:51 2005 +0000
@@ -345,61 +345,59 @@
 	xfer->data = NULL;
 }
 
-void yahoo_process_p2pfilexfer( GaimConnection *gc, struct yahoo_packet *pkt )
+void yahoo_process_p2pfilexfer(GaimConnection *gc, struct yahoo_packet *pkt)
 {
-	GSList	*l		= pkt->hash;
+	GSList *l = pkt->hash;
 
-	char	*me 		= NULL;
-	char	*from		= NULL;
-	char	*service	= NULL;
-	char	*message	= NULL;
-	char	*command	= NULL;
-	char	*imv		= NULL;
-	char	*unknown	= NULL;
+	char *me      = NULL;
+	char *from    = NULL;
+	char *service = NULL;
+	char *message = NULL;
+	char *command = NULL;
+	char *imv     = NULL;
+	char *unknown = NULL;
 
 	/* Get all the necessary values from this new packet */
-	while( l )
+	while(l != NULL)
 	{
 		struct yahoo_pair *pair = l->data;
 
-		if( pair->key == 5 )		/* Get who the packet is for */
+		if(pair->key == 5)         /* Get who the packet is for */
 			me = pair->value;
 
-		if( pair->key == 4 )		/* Get who the packet is from */
+		if(pair->key == 4)         /* Get who the packet is from */
 			from = pair->value;
 
-		if( pair->key == 49 )		/* Get the type of service */
+		if(pair->key == 49)        /* Get the type of service */
 			service = pair->value;
 
-		if( pair->key == 14 )		/* Get the 'message' of the packet */
+		if(pair->key == 14)        /* Get the 'message' of the packet */
 			message = pair->value;
 
-		if( pair->key == 13 )		/* Get the command associated with this packet */
+		if(pair->key == 13)        /* Get the command associated with this packet */
 			command = pair->value;
 
-		if( pair->key == 63 )		/* IMVironment name and version */
+		if(pair->key == 63)        /* IMVironment name and version */
 			imv = pair->value;
 
-		if( pair->key == 64 )		/* Not sure, but it does vary with initialization of Doodle */
-			unknown = pair->value;	/* So, I'll keep it (for a little while atleast) */
+		if(pair->key == 64)        /* Not sure, but it does vary with initialization of Doodle */
+			unknown = pair->value; /* So, I'll keep it (for a little while atleast) */
 
 		l = l->next;
 	}
 
 	/* If this packet is an IMVIRONMENT, handle it accordingly */
-	if( !strcmp( service, "IMVIRONMENT" ) )
+	if(!strcmp(service, "IMVIRONMENT"))
 	{
 		/* Check for a Doodle packet and handle it accordingly */
-		if( !strcmp( imv, "doodle;11" ) )
-			yahoo_doodle_process( gc, me, from, command, message );
+		if(!strcmp(imv, "doodle;11"))
+			yahoo_doodle_process(gc, me, from, command, message);
 
 		/* If an IMVIRONMENT packet comes without a specific imviroment name */
-		if( !strcmp( imv, ";0" ) )
+		if(!strcmp(imv, ";0"))
 		{
-			/* It is unfortunately time to close all IMVironments with remote
-			 * client
-			 */
-			yahoo_doodle_command_got_shutdown( gc, from );
+			/* It is unfortunately time to close all IMVironments with the remote client */
+			yahoo_doodle_command_got_shutdown(gc, from);
 		}
 	}
 }
@@ -533,7 +531,7 @@
 	gaim_xfer_set_write_fnc(xfer,       yahoo_xfer_write);
 
 	/* Now perform the request */
-	if (file) 
+	if (file)
 		gaim_xfer_request_accepted(xfer, file);
 	else
 		gaim_xfer_request(xfer);
--- a/src/whiteboard.c	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/whiteboard.c	Mon Oct 31 02:19:51 2005 +0000
@@ -29,157 +29,130 @@
 /******************************************************************************
  * Globals
  *****************************************************************************/
-static GaimWhiteboardUiOps	*whiteboard_ui_ops	= NULL;
-/* static GaimWhiteboardPrplOps	*whiteboard_prpl_ops	= NULL; */
+static GaimWhiteboardUiOps *whiteboard_ui_ops = NULL;
+/* static GaimWhiteboardPrplOps *whiteboard_prpl_ops = NULL; */
 
-static GList			*wbList			= NULL;
+static GList *wbList = NULL;
 
-/*static gboolean		auto_accept		= TRUE; */
+/*static gboolean auto_accept = TRUE; */
 
 /******************************************************************************
  * API
  *****************************************************************************/
-void gaim_whiteboard_set_ui_ops( GaimWhiteboardUiOps *ops )
+void gaim_whiteboard_set_ui_ops(GaimWhiteboardUiOps *ops)
 {
 	whiteboard_ui_ops = ops;
 }
 
-void gaim_whiteboard_set_prpl_ops( GaimWhiteboard *wb, GaimWhiteboardPrplOps *ops )
+void gaim_whiteboard_set_prpl_ops(GaimWhiteboard *wb, GaimWhiteboardPrplOps *ops)
 {
 	wb->prpl_ops = ops;
 }
 
-GaimWhiteboard *gaim_whiteboard_create( GaimAccount *account, char *who, int state )
+GaimWhiteboard *gaim_whiteboard_create(GaimAccount *account, const char *who, int state)
 {
 	GaimPluginProtocolInfo *prpl_info;
-	GaimWhiteboard *wb	= g_new0( GaimWhiteboard, 1 );
+	GaimWhiteboard *wb = g_new0(GaimWhiteboard, 1);
 
-	wb->account		= account;
-	wb->state		= state;
-	wb->who			= g_strdup( who );
+	wb->account = account;
+	wb->state   = state;
+	wb->who     = g_strdup(who);
 
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO( account->gc->prpl );
-	gaim_whiteboard_set_prpl_ops( wb, prpl_info->whiteboard_prpl_ops );
+	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
+	gaim_whiteboard_set_prpl_ops(wb, prpl_info->whiteboard_prpl_ops);
 
 	/* Start up protocol specifics */
-	if( wb->prpl_ops && wb->prpl_ops->start )
-		wb->prpl_ops->start( wb );
+	if(wb->prpl_ops && wb->prpl_ops->start)
+		wb->prpl_ops->start(wb);
 
-	wbList			= g_list_append( wbList, ( gpointer )( wb ) );
+	wbList = g_list_append(wbList, wb);
 
-	return( wb );
+	return wb;
 }
 
-void gaim_whiteboard_destroy( GaimWhiteboard *wb )
+void gaim_whiteboard_destroy(GaimWhiteboard *wb)
 {
-	if( wb->ui_data )
+	if(wb->ui_data)
 	{
 		/* Destroy frontend */
-		if( whiteboard_ui_ops && whiteboard_ui_ops->destroy )
-			whiteboard_ui_ops->destroy( wb );
+		if(whiteboard_ui_ops && whiteboard_ui_ops->destroy)
+			whiteboard_ui_ops->destroy(wb);
 	}
 
 	/* Do protocol specific session ending procedures */
-	if( wb->prpl_ops && wb->prpl_ops->end )
-		wb->prpl_ops->end( wb );
-
-	if( wb )
-	{
-		wb->account	= NULL;
-		wb->state	= 0;
+	if(wb->prpl_ops && wb->prpl_ops->end)
+		wb->prpl_ops->end(wb);
 
-		if( wb->who )
-			g_free( wb->who );
+	if(wb)
+	{
+		if(wb->who)
+			g_free(wb->who);
 
-		wbList = g_list_remove( wbList, wb );
+		wbList = g_list_remove(wbList, wb);
 
-		g_free( wb );
-		wb = NULL;
+		g_free(wb);
 	}
 }
 
-void gaim_whiteboard_start( GaimWhiteboard *wb )
+void gaim_whiteboard_start(GaimWhiteboard *wb)
 {
 	/* Create frontend for whiteboard */
-	if( whiteboard_ui_ops && whiteboard_ui_ops->create )
-		whiteboard_ui_ops->create( wb );
+	if(whiteboard_ui_ops && whiteboard_ui_ops->create)
+		whiteboard_ui_ops->create(wb);
 }
 
 /* Looks through the list of whiteboard sessions for one that is between
  * usernames 'me' and 'who'.  Returns a pointer to a matching whiteboard
  * session; if none match, it returns NULL.
  */
-GaimWhiteboard *gaim_whiteboard_get_session( GaimAccount *account, char *who )
+GaimWhiteboard *gaim_whiteboard_get_session(GaimAccount *account, const char *who)
 {
-	GaimWhiteboard	*wb	= NULL;
+	GaimWhiteboard *wb = NULL;
 
-	GList		*l	= wbList;
+	GList *l = wbList;
 
-	/* Look for a whiteboard session between the local user and the remote
-	 * user
+	/* Look for a whiteboard session between the local user and the remote user
 	 */
-	while( l )
+	while(l != NULL)
 	{
 		wb = l->data;
 
-		if( !strcmp( gaim_account_get_username( wb->account ),
-					 gaim_account_get_username( account ) ) &&
-			     !strcmp( wb->who, who ) )
-			return( wb );
+		if(wb->account == account && !strcmp(wb->who, who))
+			return wb;
 
 		l = l->next;
 	}
 
-	return( NULL );
+	return NULL;
+}
+
+void gaim_whiteboard_draw_list_destroy(GList *draw_list)
+		{
+	if (draw_list)
+		g_list_free(draw_list);
+}
+
+void gaim_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height)
+{
+	if(whiteboard_ui_ops && whiteboard_ui_ops->set_dimensions)
+		whiteboard_ui_ops->set_dimensions(wb, width, height);
 }
 
-GList *gaim_whiteboard_draw_list_destroy( GList *draw_list )
+void gaim_whiteboard_draw_point(GaimWhiteboard *wb, int x, int y, int color, int size)
 {
-	if( draw_list == NULL )
-		return( NULL );
-	else
-	{
-		/* Destroy the contents of this list */
-		int	*n = NULL;
-		GList	*l = draw_list;
-		while( l )
-		{
-			n = l->data;
-
-			if( n )
-				g_free( n );
-
-			l = l->next;
-		}
-
-		g_list_free( draw_list );
-		draw_list = NULL;
-	}
-
-	return( draw_list );
+	if(whiteboard_ui_ops && whiteboard_ui_ops->draw_point)
+		whiteboard_ui_ops->draw_point(wb, x, y, color, size);
 }
 
-void gaim_whiteboard_set_dimensions( GaimWhiteboard *wb, int width, int height )
+void gaim_whiteboard_draw_line(GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size)
 {
-	if( whiteboard_ui_ops && whiteboard_ui_ops->set_dimensions )
-		whiteboard_ui_ops->set_dimensions( wb, width, height );
-}
-
-void gaim_whiteboard_draw_point( GaimWhiteboard *wb, int x, int y, int color, int size )
-{
-	if( whiteboard_ui_ops && whiteboard_ui_ops->draw_point )
-		whiteboard_ui_ops->draw_point( wb, x, y, color, size );
+	if(whiteboard_ui_ops && whiteboard_ui_ops->draw_line)
+		whiteboard_ui_ops->draw_line(wb, x1, y1, x2, y2, color, size);
 }
 
-void gaim_whiteboard_draw_line( GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size )
+void gaim_whiteboard_clear(GaimWhiteboard *wb)
 {
-	if( whiteboard_ui_ops && whiteboard_ui_ops->draw_line )
-		whiteboard_ui_ops->draw_line( wb, x1, y1, x2, y2, color, size );
+	if(whiteboard_ui_ops && whiteboard_ui_ops->clear)
+		whiteboard_ui_ops->clear(wb);
 }
 
-void gaim_whiteboard_clear( GaimWhiteboard *wb )
-{
-	if( whiteboard_ui_ops && whiteboard_ui_ops->clear )
-		whiteboard_ui_ops->clear( wb );
-}
-
--- a/src/whiteboard.h	Mon Oct 31 01:58:26 2005 +0000
+++ b/src/whiteboard.h	Mon Oct 31 02:19:51 2005 +0000
@@ -37,16 +37,16 @@
  */
 typedef struct _GaimWhiteboard
 {
-	int			state;		/**< State of whiteboard session */
+	int state;                       /**< State of whiteboard session */
 
-	GaimAccount		*account;	/**< Account associated with this session */
-	char			*who;		/**< Name of the remote user */
+	GaimAccount *account;            /**< Account associated with this session */
+	char *who;                       /**< Name of the remote user */
 
-	void			*ui_data;	/**< Graphical user-interface data */
-	void			*proto_data;	/**< Protocol specific data */
-	GaimWhiteboardPrplOps	*prpl_ops;	/**< Protocol-plugin operations */
+	void *ui_data;                   /**< Graphical user-interface data */
+	void *proto_data;                /**< Protocol specific data */
+	GaimWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */
 
-	GList			*draw_list;	/**< List of drawing elements/deltas to send */
+	GList *draw_list;                /**< List of drawing elements/deltas to send */
 } GaimWhiteboard;
 
 /**
@@ -54,12 +54,15 @@
  */
 typedef struct _GaimWhiteboardUiOps
 {
-	void ( *create )( GaimWhiteboard *wb ); /**< create function */
-	void ( *destroy )( GaimWhiteboard *wb ); /**< destory function */
-	void ( *set_dimensions)( GaimWhiteboard *wb, int width, int height ); /**< set_dimensions function */
-	void ( *draw_point )( GaimWhiteboard *wb, int x, int y, int color, int size ); /**< draw_point function */
-	void ( *draw_line )( GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size ); /**< draw_line function */
-	void ( *clear )( GaimWhiteboard *wb ); /**< clear function */
+	void (*create)(GaimWhiteboard *wb);                                 /**< create function */
+	void (*destroy)(GaimWhiteboard *wb);                               /**< destory function */
+	void (*set_dimensions)(GaimWhiteboard *wb, int width, int height); /**< set_dimensions function */
+	void (*draw_point)(GaimWhiteboard *wb, int x, int y,
+					   int color, int size);                           /**< draw_point function */
+	void (*draw_line)(GaimWhiteboard *wb, int x1, int y1,
+					  int x2, int y2,
+					  int color, int size);                            /**< draw_line function */
+	void (*clear)(GaimWhiteboard *wb);                                 /**< clear function */
 } GaimWhiteboardUiOps;
 
 /**
@@ -67,12 +70,14 @@
  */
 struct _GaimWhiteboardPrplOps
 {
-	void ( *start )( GaimWhiteboard *wb ); /**< start function */
-	void ( *end )( GaimWhiteboard *wb ); /**< end function */
-	void ( *get_dimensions )( GaimWhiteboard *wb, int *width, int *height ); /**< get_dimensions function */
-	void ( *set_dimensions )( GaimWhiteboard *wb, int width, int height );  /**< set_dimensions function */
-	void ( *send_draw_list )( GaimWhiteboard *wb, GList *draw_list ); /**< send_draw_list function */
-	void ( *clear )( GaimWhiteboard *wb ); /**< clear function */
+	void (*start)(GaimWhiteboard *wb);                                   /**< start function */
+	void (*end)(GaimWhiteboard *wb);                                     /**< end function */
+	void (*get_dimensions)(GaimWhiteboard *wb, int *width, int *height); /**< get_dimensions function */
+	void (*set_dimensions)(GaimWhiteboard *wb, int width, int height);   /**< set_dimensions function */
+	void (*get_brush) (GaimWhiteboard *wb, int *size, int *color);       /**< get the brush size and color */
+	void (*set_brush) (GaimWhiteboard *wb, int size, int color);         /**< set the brush size and color */
+	void (*send_draw_list)(GaimWhiteboard *wb, GList *draw_list);        /**< send_draw_list function */
+	void (*clear)(GaimWhiteboard *wb);                                   /**< clear function */
 };
 
 #ifdef __cplusplus
@@ -89,7 +94,7 @@
  *
  * @param ops The UI Operations to set
  */
-void		gaim_whiteboard_set_ui_ops( GaimWhiteboardUiOps *ops );
+void gaim_whiteboard_set_ui_ops(GaimWhiteboardUiOps *ops);
 
 /**
  * Creates a whiteboard
@@ -100,21 +105,21 @@
  *
  * @return The new whiteboard
  */
-GaimWhiteboard	*gaim_whiteboard_create( GaimAccount *account, char *who, int state );
+GaimWhiteboard *gaim_whiteboard_create(GaimAccount *account, const char *who, int state);
 
 /**
  * Destroys a whiteboard
  *
  * @param wb The whiteboard.
  */
-void		gaim_whiteboard_destroy( GaimWhiteboard *wb );
+void gaim_whiteboard_destroy(GaimWhiteboard *wb);
 
 /**
  * Starts a whiteboard
  *
  * @param wb The whiteboard.
  */
-void		gaim_whiteboard_start( GaimWhiteboard *wb );
+void gaim_whiteboard_start(GaimWhiteboard *wb);
 
 /**
  * Finds a whiteboard from an account and user.
@@ -124,16 +129,14 @@
  *
  * @return The whiteboard if found, otherwise @c NULL.
  */
-GaimWhiteboard	*gaim_whiteboard_get_session( GaimAccount *account, char *who );
+GaimWhiteboard *gaim_whiteboard_get_session(GaimAccount *account, const char *who);
 
 /**
  * Destorys a drawing list for a whiteboard
  *
  * @param draw_list The drawing list.
- *
- * @return The start of the new drawing list (?)
  */
-GList		*gaim_whiteboard_draw_list_destroy( GList *draw_list );
+void gaim_whiteboard_draw_list_destroy(GList *draw_list);
 
 /**
  * Sets the dimensions for a whiteboard.
@@ -142,7 +145,7 @@
  * @param width  The width.
  * @param height The height.
  */
-void		gaim_whiteboard_set_dimensions( GaimWhiteboard *wb, int width, int height );
+void gaim_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height);
 
 /**
  * Draws a point on a whiteboard.
@@ -153,7 +156,7 @@
  * @param color The color to use.
  * @param size  The brush size.
  */
-void		gaim_whiteboard_draw_point( GaimWhiteboard *wb, int x, int y, int color, int size );
+void gaim_whiteboard_draw_point(GaimWhiteboard *wb, int x, int y, int color, int size);
 
 /**
  * Draws a line on a whiteboard
@@ -166,14 +169,14 @@
  * @param color The color to use.
  * @param size  The brush size.
  */
-void		gaim_whiteboard_draw_line( GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size );
+void gaim_whiteboard_draw_line(GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size);
 
 /**
  * Clears a whiteboard
  *
  * @param wb The whiteboard.
  */
-void		gaim_whiteboard_clear( GaimWhiteboard *wb );
+void gaim_whiteboard_clear(GaimWhiteboard *wb);
 
 /*@}*/