Fri, 06 Sep 2013 23:02:04 +0530
Some documentation updates with regard to 'protocol plugins' and 'protocols'
| 11475 | 1 | /* |
| 15884 | 2 | * purple |
| 11475 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 11475 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18265
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11475 | 21 | * |
| 22 | */ | |
| 23 | ||
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
24 | #include "internal.h" |
| 11475 | 25 | #include "whiteboard.h" |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
26 | #include "protocol.h" |
| 11475 | 27 | |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
28 | /** |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
29 | * A PurpleWhiteboard |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
30 | */ |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
31 | struct _PurpleWhiteboard |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
32 | { |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
33 | int state; /**< State of whiteboard session */ |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
34 | |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
35 | PurpleAccount *account; /**< Account associated with this session */ |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
36 | char *who; /**< Name of the remote user */ |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
37 | |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
38 | void *ui_data; /**< Graphical user-interface data */ |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
39 | void *proto_data; /**< Protocol specific data */ |
|
36691
92122af1f083
Some documentation updates with regard to 'protocol plugins' and 'protocols'
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
40 | PurpleWhiteboardOps *protocol_ops; /**< Protocol operations */ |
|
32708
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
41 | |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
42 | GList *draw_list; /**< List of drawing elements/deltas to send */ |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
43 | }; |
|
e275f5e7b257
Hide struct PurpleWhiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32285
diff
changeset
|
44 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
45 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
46 | * Globals |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
47 | *****************************************************************************/ |
| 15884 | 48 | static PurpleWhiteboardUiOps *whiteboard_ui_ops = NULL; |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
49 | /* static PurpleWhiteboardOps *whiteboard_protocol_ops = NULL; */ |
| 11475 | 50 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
51 | static GList *wbList = NULL; |
| 11475 | 52 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
53 | /*static gboolean auto_accept = TRUE; */ |
| 11475 | 54 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
55 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
56 | * API |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
57 | *****************************************************************************/ |
| 15884 | 58 | void purple_whiteboard_set_ui_ops(PurpleWhiteboardUiOps *ops) |
| 11475 | 59 | { |
| 60 | whiteboard_ui_ops = ops; | |
| 61 | } | |
| 62 | ||
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
63 | void purple_whiteboard_set_protocol_ops(PurpleWhiteboard *wb, PurpleWhiteboardOps *ops) |
| 11475 | 64 | { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
65 | wb->protocol_ops = ops; |
| 11475 | 66 | } |
| 67 | ||
| 15884 | 68 | PurpleWhiteboard *purple_whiteboard_create(PurpleAccount *account, const char *who, int state) |
| 11475 | 69 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
70 | PurpleProtocol *protocol; |
| 15884 | 71 | PurpleWhiteboard *wb = g_new0(PurpleWhiteboard, 1); |
|
11506
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11475
diff
changeset
|
72 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
73 | wb->account = account; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
74 | wb->state = state; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
75 | wb->who = g_strdup(who); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
76 | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36607
diff
changeset
|
77 | protocol = purple_connection_get_protocol(purple_account_get_connection(account)); |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
78 | purple_whiteboard_set_protocol_ops(wb, purple_protocol_get_whiteboard_ops(protocol)); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
79 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
80 | /* Start up protocol specifics */ |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
81 | if(wb->protocol_ops && wb->protocol_ops->start) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
82 | wb->protocol_ops->start(wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
83 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
84 | wbList = g_list_append(wbList, wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
85 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
86 | return wb; |
| 11475 | 87 | } |
| 88 | ||
| 15884 | 89 | void purple_whiteboard_destroy(PurpleWhiteboard *wb) |
| 11475 | 90 | { |
|
13419
b62e06c585f8
[gaim-migrate @ 15793]
Richard Laager <rlaager@pidgin.im>
parents:
12022
diff
changeset
|
91 | g_return_if_fail(wb != NULL); |
|
b62e06c585f8
[gaim-migrate @ 15793]
Richard Laager <rlaager@pidgin.im>
parents:
12022
diff
changeset
|
92 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
93 | if(wb->ui_data) |
| 11475 | 94 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
95 | /* Destroy frontend */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
96 | if(whiteboard_ui_ops && whiteboard_ui_ops->destroy) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
97 | whiteboard_ui_ops->destroy(wb); |
| 11475 | 98 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
99 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
100 | /* Do protocol specific session ending procedures */ |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
101 | if(wb->protocol_ops && wb->protocol_ops->end) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
102 | wb->protocol_ops->end(wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
103 | |
|
13419
b62e06c585f8
[gaim-migrate @ 15793]
Richard Laager <rlaager@pidgin.im>
parents:
12022
diff
changeset
|
104 | g_free(wb->who); |
|
b62e06c585f8
[gaim-migrate @ 15793]
Richard Laager <rlaager@pidgin.im>
parents:
12022
diff
changeset
|
105 | wbList = g_list_remove(wbList, wb); |
|
b62e06c585f8
[gaim-migrate @ 15793]
Richard Laager <rlaager@pidgin.im>
parents:
12022
diff
changeset
|
106 | g_free(wb); |
| 11475 | 107 | } |
| 108 | ||
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
109 | PurpleAccount *purple_whiteboard_get_account(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
110 | { |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
111 | g_return_val_if_fail(wb != NULL, NULL); |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
112 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
113 | return wb->account; |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
114 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
115 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
116 | const char *purple_whiteboard_get_who(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
117 | { |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
118 | g_return_val_if_fail(wb != NULL, NULL); |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
119 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
120 | return wb->who; |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
121 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
122 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
123 | void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
124 | { |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
125 | g_return_if_fail(wb != NULL); |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
126 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
127 | wb->state = state; |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
128 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
129 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
130 | int purple_whiteboard_get_state(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
131 | { |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
132 | g_return_val_if_fail(wb != NULL, -1); |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
133 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
134 | return wb->state; |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
135 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
136 | |
| 15884 | 137 | void purple_whiteboard_start(PurpleWhiteboard *wb) |
| 11475 | 138 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
139 | /* Create frontend for whiteboard */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
140 | if(whiteboard_ui_ops && whiteboard_ui_ops->create) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
141 | whiteboard_ui_ops->create(wb); |
| 11475 | 142 | } |
| 143 | ||
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
144 | /* Looks through the list of whiteboard sessions for one that is between |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
145 | * usernames 'me' and 'who'. Returns a pointer to a matching whiteboard |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
146 | * session; if none match, it returns NULL. |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
147 | */ |
| 15884 | 148 | PurpleWhiteboard *purple_whiteboard_get_session(const PurpleAccount *account, const char *who) |
| 11475 | 149 | { |
| 15884 | 150 | PurpleWhiteboard *wb; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
151 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
152 | GList *l = wbList; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
153 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
154 | /* Look for a whiteboard session between the local user and the remote user |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
155 | */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
156 | while(l != NULL) |
| 11475 | 157 | { |
| 158 | wb = l->data; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
159 | |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
22390
diff
changeset
|
160 | if(wb->account == account && purple_strequal(wb->who, who)) |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
161 | return wb; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
162 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
163 | l = l->next; |
| 11475 | 164 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11506
diff
changeset
|
165 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
166 | return NULL; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
167 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
168 | |
| 15884 | 169 | void purple_whiteboard_draw_list_destroy(GList *draw_list) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
170 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13419
diff
changeset
|
171 | g_list_free(draw_list); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
172 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
173 | |
| 15884 | 174 | gboolean purple_whiteboard_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
175 | { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
176 | PurpleWhiteboardOps *protocol_ops = wb->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
177 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
178 | if (protocol_ops && protocol_ops->get_dimensions) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
179 | { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
180 | protocol_ops->get_dimensions(wb, width, height); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
181 | return TRUE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
182 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
183 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
184 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
185 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
186 | |
| 15884 | 187 | void purple_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height) |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
188 | { |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
189 | if(whiteboard_ui_ops && whiteboard_ui_ops->set_dimensions) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
190 | whiteboard_ui_ops->set_dimensions(wb, width, height); |
| 11475 | 191 | } |
| 192 | ||
| 15884 | 193 | void purple_whiteboard_send_draw_list(PurpleWhiteboard *wb, GList *list) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
194 | { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
195 | PurpleWhiteboardOps *protocol_ops = wb->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
196 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
197 | if (protocol_ops && protocol_ops->send_draw_list) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
198 | protocol_ops->send_draw_list(wb, list); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
199 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
200 | |
| 15884 | 201 | void purple_whiteboard_draw_point(PurpleWhiteboard *wb, int x, int y, int color, int size) |
| 11475 | 202 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
203 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_point) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
204 | whiteboard_ui_ops->draw_point(wb, x, y, color, size); |
| 11475 | 205 | } |
| 206 | ||
| 15884 | 207 | void purple_whiteboard_draw_line(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size) |
| 11475 | 208 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
209 | if(whiteboard_ui_ops && whiteboard_ui_ops->draw_line) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
210 | whiteboard_ui_ops->draw_line(wb, x1, y1, x2, y2, color, size); |
| 11475 | 211 | } |
| 212 | ||
| 15884 | 213 | void purple_whiteboard_clear(PurpleWhiteboard *wb) |
| 11475 | 214 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
215 | if(whiteboard_ui_ops && whiteboard_ui_ops->clear) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11802
diff
changeset
|
216 | whiteboard_ui_ops->clear(wb); |
| 11475 | 217 | } |
| 218 | ||
| 15884 | 219 | void purple_whiteboard_send_clear(PurpleWhiteboard *wb) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
220 | { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
221 | PurpleWhiteboardOps *protocol_ops = wb->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
222 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
223 | if (protocol_ops && protocol_ops->clear) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
224 | protocol_ops->clear(wb); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
225 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
226 | |
| 15884 | 227 | void purple_whiteboard_send_brush(PurpleWhiteboard *wb, int size, int color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
228 | { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
229 | PurpleWhiteboardOps *protocol_ops = wb->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
230 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
231 | if (protocol_ops && protocol_ops->set_brush) |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
232 | protocol_ops->set_brush(wb, size, color); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
233 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
234 | |
| 15884 | 235 | gboolean purple_whiteboard_get_brush(const PurpleWhiteboard *wb, int *size, int *color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
236 | { |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
237 | PurpleWhiteboardOps *protocol_ops = wb->protocol_ops; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
238 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
239 | if (protocol_ops && protocol_ops->get_brush) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
240 | { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
241 | protocol_ops->get_brush(wb, size, color); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
242 | return TRUE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
243 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
244 | return FALSE; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
245 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
246 | |
| 15884 | 247 | void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
248 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
249 | if (whiteboard_ui_ops && whiteboard_ui_ops->set_brush) |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
250 | whiteboard_ui_ops->set_brush(wb, size, color); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
251 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
252 | |
|
32285
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
253 | GList *purple_whiteboard_get_draw_list(const PurpleWhiteboard *wb) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
254 | { |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
255 | g_return_val_if_fail(wb != NULL, NULL); |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
256 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
257 | return wb->draw_list; |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
258 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
259 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
260 | void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list) |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
261 | { |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
262 | g_return_if_fail(wb != NULL); |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
263 | |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
264 | wb->draw_list = draw_list; |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
265 | } |
|
b5ea2ea68c8c
Add additional accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
32282
diff
changeset
|
266 | |
|
32282
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
267 | void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
268 | { |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
269 | g_return_if_fail(wb != NULL); |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
270 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
271 | wb->proto_data = proto_data; |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
272 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
273 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
274 | gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
275 | { |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
276 | g_return_val_if_fail(wb != NULL, NULL); |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
277 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
278 | return wb->proto_data; |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
279 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
280 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
281 | void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
282 | { |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
283 | g_return_if_fail(wb != NULL); |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
284 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
285 | wb->ui_data = ui_data; |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
286 | } |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
287 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
288 | gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb) |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
289 | { |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
290 | g_return_val_if_fail(wb != NULL, NULL); |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
291 | |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
292 | return wb->ui_data; |
|
c3df9b7a5160
Added protocol_data and ui_data accessor functions for Whiteboard.
Andrew Victor <andrew.victor@mxit.com>
parents:
28981
diff
changeset
|
293 | } |