Mercurial > pidgin
changeset 32001:9f869eb728ff
Update silc prpl to use purple_whiteboard_get_protocol_data() and purple_whiteboard_set_protocol_data().
author | andrew.victor@mxit.com |
---|---|
date | Tue, 30 Aug 2011 20:55:12 +0000 |
parents | cea77667da7d |
children | d5ddf2d1ee04 |
files | libpurple/protocols/silc/wb.c |
diffstat | 1 files changed, 20 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/silc/wb.c Tue Aug 30 20:43:52 2011 +0000 +++ b/libpurple/protocols/silc/wb.c Tue Aug 30 20:55:12 2011 +0000 @@ -116,7 +116,7 @@ if (!wb) return NULL; - if (!wb->proto_data) { + if (!purple_whiteboard_get_protocol_data(wb)) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; @@ -126,7 +126,7 @@ wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; + purple_whiteboard_set_protocol_data(wb, wbs); /* Start the whiteboard */ purple_whiteboard_start(wb); @@ -147,7 +147,7 @@ if (!wb) return NULL; - if (!wb->proto_data) { + if (!purple_whiteboard_get_protocol_data(wb)) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; @@ -157,7 +157,7 @@ wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; + purple_whiteboard_set_protocol_data(wb, wbs); /* Start the whiteboard */ purple_whiteboard_start(wb); @@ -168,9 +168,10 @@ } static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, +silcpurple_wb_parse(PurpleWhiteboard *wb, unsigned char *message, SilcUInt32 message_len) { + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcUInt8 command; SilcUInt16 width, height, brush_size; SilcUInt32 brush_color, x, y, dx, dy; @@ -246,7 +247,7 @@ else wb = silcpurple_wb_init_ch(req->sg, req->channel); - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); + silcpurple_wb_parse(wb, req->message, req->message_len); out: silc_free(req->message); @@ -275,7 +276,7 @@ else wb = silcpurple_wb_init_ch(sg, channel); - silcpurple_wb_parse(wb->proto_data, wb, + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); return; @@ -320,7 +321,6 @@ SilcPurple sg; PurpleConnection *gc; PurpleWhiteboard *wb; - SilcPurpleWb wbs; gc = client->application; sg = purple_connection_get_protocol_data(gc); @@ -333,8 +333,7 @@ return; } - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); } /* Process incoming whiteboard message on channel */ @@ -349,7 +348,6 @@ SilcPurple sg; PurpleConnection *gc; PurpleWhiteboard *wb; - SilcPurpleWb wbs; gc = client->application; sg = purple_connection_get_protocol_data(gc); @@ -362,15 +360,14 @@ return; } - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); } /* Send whiteboard message */ void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcBuffer packet; GList *list; int len; @@ -435,20 +432,22 @@ void silcpurple_wb_end(PurpleWhiteboard *wb) { - silc_free(wb->proto_data); - wb->proto_data = NULL; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); + + silc_free(wbs); + purple_whiteboard_set_protocol_data(wb, NULL); } void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); *width = wbs->width; *height = wbs->height; } void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : width; wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : @@ -460,14 +459,14 @@ void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); *size = wbs->brush_size; *color = wbs->brush_color; } void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); wbs->brush_size = size; wbs->brush_color = color; @@ -477,7 +476,7 @@ void silcpurple_wb_clear(PurpleWhiteboard *wb) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcBuffer packet; int len; PurpleConnection *gc;