comparison src/protocols/silc/ops.c @ 12058:d5daff460913

[gaim-migrate @ 14353] SILC whiteboard support from Pekka Riikonen. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Sat, 12 Nov 2005 23:04:44 +0000
parents c9b815aeddc1
children 5851a9219bc7
comparison
equal deleted inserted replaced
12057:68c18dd8a316 12058:d5daff460913
18 */ 18 */
19 19
20 #include "silcincludes.h" 20 #include "silcincludes.h"
21 #include "silcclient.h" 21 #include "silcclient.h"
22 #include "silcgaim.h" 22 #include "silcgaim.h"
23 #include "wb.h"
23 24
24 /* Message sent to the application by library. `conn' associates the 25 /* Message sent to the application by library. `conn' associates the
25 message to a specific connection. `conn', however, may be NULL. 26 message to a specific connection. `conn', however, may be NULL.
26 The `type' indicates the type of the message sent by the library. 27 The `type' indicates the type of the message sent by the library.
27 The application can for example filter the message according the 28 The application can for example filter the message according the
78 gaim_prefs_get_bool("/plugins/prpl/silc/verify_chat")) { 79 gaim_prefs_get_bool("/plugins/prpl/silc/verify_chat")) {
79 /* XXX */ 80 /* XXX */
80 } 81 }
81 82
82 if (flags & SILC_MESSAGE_FLAG_DATA) { 83 if (flags & SILC_MESSAGE_FLAG_DATA) {
83 /* XXX */ 84 char type[128], enc[128];
85 unsigned char *data;
86 SilcUInt32 data_len;
87
88 memset(type, 0, sizeof(type));
89 memset(enc, 0, sizeof(enc));
90
91 if (!silc_mime_parse(message, message_len, NULL, 0,
92 type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data,
93 &data_len))
94 return;
95
96 if (!strcmp(type, "application/x-wb") &&
97 !strcmp(enc, "binary"))
98 silcgaim_wb_receive_ch(client, conn, sender, channel,
99 payload, flags, data, data_len);
100
84 return; 101 return;
85 } 102 }
86 103
87 if (flags & SILC_MESSAGE_FLAG_ACTION) { 104 if (flags & SILC_MESSAGE_FLAG_ACTION) {
88 msg = g_strdup_printf("/me %s", 105 msg = g_strdup_printf("/me %s",
157 gaim_prefs_get_bool("/plugins/prpl/silc/verify_im")) { 174 gaim_prefs_get_bool("/plugins/prpl/silc/verify_im")) {
158 /* XXX */ 175 /* XXX */
159 } 176 }
160 177
161 if (flags & SILC_MESSAGE_FLAG_DATA) { 178 if (flags & SILC_MESSAGE_FLAG_DATA) {
162 /* XXX */ 179 char type[128], enc[128];
180 unsigned char *data;
181 SilcUInt32 data_len;
182
183 memset(type, 0, sizeof(type));
184 memset(enc, 0, sizeof(enc));
185
186 if (!silc_mime_parse(message, message_len, NULL, 0,
187 type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data,
188 &data_len))
189 return;
190
191 if (!strcmp(type, "application/x-wb") &&
192 !strcmp(enc, "binary"))
193 silcgaim_wb_receive(client, conn, sender, payload,
194 flags, data, data_len);
195
163 return; 196 return;
164 } 197 }
165 198
166 if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { 199 if (flags & SILC_MESSAGE_FLAG_ACTION && convo) {
167 msg = g_strdup_printf("/me %s", 200 msg = g_strdup_printf("/me %s",