comparison libpurple/whiteboard.c @ 32819:2c6510167895 default tip

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24) to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:49 +0000
parents 46177ee4af40
children
comparison
equal deleted inserted replaced
32818:01ff09d4a463 32819:2c6510167895
22 */ 22 */
23 23
24 #include "internal.h" 24 #include "internal.h"
25 #include "whiteboard.h" 25 #include "whiteboard.h"
26 #include "prpl.h" 26 #include "prpl.h"
27
28 /**
29 * A PurpleWhiteboard
30 */
31 struct _PurpleWhiteboard
32 {
33 int state; /**< State of whiteboard session */
34
35 PurpleAccount *account; /**< Account associated with this session */
36 char *who; /**< Name of the remote user */
37
38 void *ui_data; /**< Graphical user-interface data */
39 void *proto_data; /**< Protocol specific data */
40 PurpleWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */
41
42 GList *draw_list; /**< List of drawing elements/deltas to send */
43 };
27 44
28 /****************************************************************************** 45 /******************************************************************************
29 * Globals 46 * Globals
30 *****************************************************************************/ 47 *****************************************************************************/
31 static PurpleWhiteboardUiOps *whiteboard_ui_ops = NULL; 48 static PurpleWhiteboardUiOps *whiteboard_ui_ops = NULL;
88 g_free(wb->who); 105 g_free(wb->who);
89 wbList = g_list_remove(wbList, wb); 106 wbList = g_list_remove(wbList, wb);
90 g_free(wb); 107 g_free(wb);
91 } 108 }
92 109
110 PurpleAccount *purple_whiteboard_get_account(const PurpleWhiteboard *wb)
111 {
112 g_return_val_if_fail(wb != NULL, NULL);
113
114 return wb->account;
115 }
116
117 const char *purple_whiteboard_get_who(const PurpleWhiteboard *wb)
118 {
119 g_return_val_if_fail(wb != NULL, NULL);
120
121 return wb->who;
122 }
123
124 void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state)
125 {
126 g_return_if_fail(wb != NULL);
127
128 wb->state = state;
129 }
130
131 int purple_whiteboard_get_state(const PurpleWhiteboard *wb)
132 {
133 g_return_val_if_fail(wb != NULL, -1);
134
135 return wb->state;
136 }
137
93 void purple_whiteboard_start(PurpleWhiteboard *wb) 138 void purple_whiteboard_start(PurpleWhiteboard *wb)
94 { 139 {
95 /* Create frontend for whiteboard */ 140 /* Create frontend for whiteboard */
96 if(whiteboard_ui_ops && whiteboard_ui_ops->create) 141 if(whiteboard_ui_ops && whiteboard_ui_ops->create)
97 whiteboard_ui_ops->create(wb); 142 whiteboard_ui_ops->create(wb);
204 { 249 {
205 if (whiteboard_ui_ops && whiteboard_ui_ops->set_brush) 250 if (whiteboard_ui_ops && whiteboard_ui_ops->set_brush)
206 whiteboard_ui_ops->set_brush(wb, size, color); 251 whiteboard_ui_ops->set_brush(wb, size, color);
207 } 252 }
208 253
254 GList *purple_whiteboard_get_draw_list(const PurpleWhiteboard *wb)
255 {
256 g_return_val_if_fail(wb != NULL, NULL);
257
258 return wb->draw_list;
259 }
260
261 void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list)
262 {
263 g_return_if_fail(wb != NULL);
264
265 wb->draw_list = draw_list;
266 }
267
268 void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data)
269 {
270 g_return_if_fail(wb != NULL);
271
272 wb->proto_data = proto_data;
273 }
274
275 gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb)
276 {
277 g_return_val_if_fail(wb != NULL, NULL);
278
279 return wb->proto_data;
280 }
281
282 void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data)
283 {
284 g_return_if_fail(wb != NULL);
285
286 wb->ui_data = ui_data;
287 }
288
289 gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb)
290 {
291 g_return_val_if_fail(wb != NULL, NULL);
292
293 return wb->ui_data;
294 }