Mercurial > pidgin.yaz
annotate src/protocols/silc/silc.c @ 12325:33026deed1ce
[gaim-migrate @ 14629]
Make silcgaim_blist_node_menu static.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 04 Dec 2005 21:01:20 +0000 |
parents | 01f689cd7b49 |
children | 3169cd6727ad |
rev | line source |
---|---|
8849 | 1 /* |
2 | |
3 silcgaim.c | |
4 | |
5 Author: Pekka Riikonen <priikone@silcnet.org> | |
6 | |
10825 | 7 Copyright (C) 2004 - 2005 Pekka Riikonen |
8849 | 8 |
9 This program is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation; version 2 of the License. | |
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 */ | |
19 | |
20 #include "silcincludes.h" | |
21 #include "silcclient.h" | |
22 #include "silcgaim.h" | |
9943 | 23 #include "version.h" |
12058 | 24 #include "wb.h" |
8849 | 25 |
26 extern SilcClientOperations ops; | |
27 static GaimPlugin *silc_plugin = NULL; | |
28 | |
29 static const char * | |
30 silcgaim_list_icon(GaimAccount *a, GaimBuddy *b) | |
31 { | |
32 return (const char *)"silc"; | |
33 } | |
34 | |
35 static void | |
9968 | 36 silcgaim_list_emblems(GaimBuddy *b, const char **se, const char **sw, |
37 const char **nw, const char **ne) | |
8849 | 38 { |
39 } | |
40 | |
41 static GList * | |
9968 | 42 silcgaim_away_states(GaimAccount *account) |
8849 | 43 { |
9968 | 44 GaimStatusType *type; |
45 GList *types = NULL; | |
8849 | 46 |
12130
5d9a74c47108
[gaim-migrate @ 14430]
Richard Laager <rlaager@wiktel.com>
parents:
12058
diff
changeset
|
47 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, SILCGAIM_STATUS_ID_OFFLINE, _("Offline"), FALSE, TRUE, FALSE); |
9968 | 48 types = g_list_append(types, type); |
10801 | 49 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, SILCGAIM_STATUS_ID_AVAILABLE, _("Available"), FALSE, TRUE, FALSE); |
9968 | 50 types = g_list_append(types, type); |
10050 | 51 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, SILCGAIM_STATUS_ID_HYPER, _("Hyper Active"), FALSE, TRUE, FALSE); |
9968 | 52 types = g_list_append(types, type); |
10050 | 53 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, SILCGAIM_STATUS_ID_AWAY, _("Away"), FALSE, TRUE, FALSE); |
9968 | 54 types = g_list_append(types, type); |
10050 | 55 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, SILCGAIM_STATUS_ID_BUSY, _("Busy"), FALSE, TRUE, FALSE); |
9968 | 56 types = g_list_append(types, type); |
10050 | 57 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, SILCGAIM_STATUS_ID_INDISPOSED, _("Indisposed"), FALSE, TRUE, FALSE); |
9968 | 58 types = g_list_append(types, type); |
10050 | 59 type = gaim_status_type_new_full(GAIM_STATUS_AWAY, SILCGAIM_STATUS_ID_PAGE, _("Wake Me Up"), FALSE, TRUE, FALSE); |
9968 | 60 types = g_list_append(types, type); |
8849 | 61 |
9968 | 62 return types; |
8849 | 63 } |
64 | |
65 static void | |
9968 | 66 silcgaim_set_status(GaimAccount *account, GaimStatus *status) |
8849 | 67 { |
9968 | 68 GaimConnection *gc = gaim_account_get_connection(account); |
10801 | 69 SilcGaim sg = NULL; |
8849 | 70 SilcUInt32 mode; |
71 SilcBuffer idp; | |
72 unsigned char mb[4]; | |
9968 | 73 const char *state; |
8849 | 74 |
10801 | 75 if (gc != NULL) |
76 sg = gc->proto_data; | |
77 | |
78 if (status == NULL) | |
79 return; | |
80 | |
81 state = gaim_status_get_id(status); | |
10225 | 82 |
10801 | 83 if (state == NULL) |
84 return; | |
10225 | 85 |
10801 | 86 if ((sg == NULL) || (sg->conn == NULL)) |
8849 | 87 return; |
88 | |
89 mode = sg->conn->local_entry->mode; | |
90 mode &= ~(SILC_UMODE_GONE | | |
91 SILC_UMODE_HYPER | | |
92 SILC_UMODE_BUSY | | |
93 SILC_UMODE_INDISPOSED | | |
94 SILC_UMODE_PAGE); | |
95 | |
9968 | 96 if (!strcmp(state, "hyper")) |
8849 | 97 mode |= SILC_UMODE_HYPER; |
9968 | 98 else if (!strcmp(state, "away")) |
8849 | 99 mode |= SILC_UMODE_GONE; |
9968 | 100 else if (!strcmp(state, "busy")) |
8849 | 101 mode |= SILC_UMODE_BUSY; |
9968 | 102 else if (!strcmp(state, "indisposed")) |
8849 | 103 mode |= SILC_UMODE_INDISPOSED; |
9968 | 104 else if (!strcmp(state, "page")) |
8849 | 105 mode |= SILC_UMODE_PAGE; |
106 | |
107 /* Send UMODE */ | |
108 idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); | |
109 SILC_PUT32_MSB(mode, mb); | |
110 silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE, | |
111 ++sg->conn->cmd_ident, 2, | |
112 1, idp->data, idp->len, | |
113 2, mb, sizeof(mb)); | |
114 silc_buffer_free(idp); | |
115 } | |
116 | |
117 | |
118 /*************************** Connection Routines *****************************/ | |
119 | |
120 static void | |
121 silcgaim_keepalive(GaimConnection *gc) | |
122 { | |
123 SilcGaim sg = gc->proto_data; | |
124 silc_client_send_packet(sg->client, sg->conn, SILC_PACKET_HEARTBEAT, | |
125 NULL, 0); | |
126 } | |
127 | |
128 static int | |
129 silcgaim_scheduler(gpointer *context) | |
130 { | |
131 SilcGaim sg = (SilcGaim)context; | |
132 silc_client_run_one(sg->client); | |
133 return 1; | |
134 } | |
135 | |
136 static void | |
137 silcgaim_nickname_parse(const char *nickname, | |
138 char **ret_nickname) | |
139 { | |
140 silc_parse_userfqdn(nickname, ret_nickname, NULL); | |
141 } | |
142 | |
143 static void | |
144 silcgaim_login_connected(gpointer data, gint source, GaimInputCondition cond) | |
145 { | |
146 GaimConnection *gc = data; | |
147 SilcGaim sg = gc->proto_data; | |
9732 | 148 SilcClient client; |
8849 | 149 SilcClientConnection conn; |
150 GaimAccount *account = sg->account; | |
151 SilcClientConnectionParams params; | |
152 const char *dfile; | |
153 | |
154 if (source < 0) { | |
155 gaim_connection_error(gc, _("Connection failed")); | |
156 return; | |
157 } | |
9732 | 158 |
159 if (sg == NULL) | |
160 return; | |
161 | |
162 client = sg->client; | |
163 | |
8849 | 164 if (!g_list_find(gaim_connections_get_all(), gc)) { |
165 close(source); | |
166 g_source_remove(sg->scheduler); | |
167 silc_client_stop(sg->client); | |
168 silc_client_free(sg->client); | |
169 silc_free(sg); | |
170 return; | |
171 } | |
172 | |
173 /* Get session detachment data, if available */ | |
174 memset(¶ms, 0, sizeof(params)); | |
175 dfile = silcgaim_session_file(gaim_account_get_username(sg->account)); | |
11318 | 176 params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); |
8849 | 177 if (params.detach_data) |
178 params.detach_data[params.detach_data_len] = 0; | |
179 | |
180 /* Add connection to SILC client library */ | |
181 conn = silc_client_add_connection( | |
182 sg->client, ¶ms, | |
183 (char *)gaim_account_get_string(account, "server", | |
184 "silc.silcnet.org"), | |
185 gaim_account_get_int(account, "port", 706), sg); | |
186 if (!conn) { | |
187 gaim_connection_error(gc, _("Cannot initialize SILC Client connection")); | |
188 gc->proto_data = NULL; | |
189 return; | |
190 } | |
191 sg->conn = conn; | |
192 | |
193 /* Progress */ | |
194 if (params.detach_data) { | |
195 gaim_connection_update_progress(gc, _("Resuming session"), 2, 5); | |
196 sg->resuming = TRUE; | |
197 } else { | |
198 gaim_connection_update_progress(gc, _("Performing key exchange"), 2, 5); | |
199 } | |
200 | |
201 /* Perform SILC Key Exchange. The "silc_connected" will be called | |
202 eventually. */ | |
203 silc_client_start_key_exchange(sg->client, sg->conn, source); | |
204 | |
205 /* Set default attributes */ | |
206 if (!gaim_account_get_bool(account, "reject-attrs", FALSE)) { | |
207 SilcUInt32 mask; | |
208 const char *tmp; | |
209 #ifdef HAVE_SYS_UTSNAME_H | |
210 struct utsname u; | |
211 #endif | |
212 | |
213 mask = SILC_ATTRIBUTE_MOOD_NORMAL; | |
214 silc_client_attribute_add(client, conn, | |
215 SILC_ATTRIBUTE_STATUS_MOOD, | |
216 SILC_32_TO_PTR(mask), | |
217 sizeof(SilcUInt32)); | |
218 mask = SILC_ATTRIBUTE_CONTACT_CHAT; | |
219 silc_client_attribute_add(client, conn, | |
220 SILC_ATTRIBUTE_PREFERRED_CONTACT, | |
221 SILC_32_TO_PTR(mask), | |
222 sizeof(SilcUInt32)); | |
223 #ifdef HAVE_SYS_UTSNAME_H | |
224 if (!uname(&u)) { | |
225 SilcAttributeObjDevice dev; | |
226 memset(&dev, 0, sizeof(dev)); | |
227 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; | |
228 dev.version = u.release; | |
229 dev.model = u.sysname; | |
230 silc_client_attribute_add(client, conn, | |
231 SILC_ATTRIBUTE_DEVICE_INFO, | |
232 (void *)&dev, sizeof(dev)); | |
233 } | |
234 #endif | |
235 #ifdef _WIN32 | |
236 tmp = _tzname[0]; | |
237 #else | |
238 tmp = tzname[0]; | |
239 #endif | |
240 silc_client_attribute_add(client, conn, | |
241 SILC_ATTRIBUTE_TIMEZONE, | |
242 (void *)tmp, strlen(tmp)); | |
243 } | |
244 | |
245 silc_free(params.detach_data); | |
246 } | |
247 | |
248 static void | |
11837 | 249 silcgaim_login(GaimAccount *account) |
8849 | 250 { |
251 SilcGaim sg; | |
252 SilcClient client; | |
253 SilcClientParams params; | |
254 GaimConnection *gc; | |
10825 | 255 char pkd[256], prd[256]; |
12217 | 256 const char *cipher, *hmac; |
257 int i; | |
8849 | 258 |
259 gc = account->gc; | |
260 if (!gc) | |
261 return; | |
262 gc->proto_data = NULL; | |
263 | |
264 memset(¶ms, 0, sizeof(params)); | |
265 strcat(params.nickname_format, "%n@%h%a"); | |
266 params.nickname_parse = silcgaim_nickname_parse; | |
267 params.ignore_requested_attributes = | |
268 gaim_account_get_bool(account, "reject-attrs", FALSE); | |
269 | |
270 /* Allocate SILC client */ | |
271 client = silc_client_alloc(&ops, ¶ms, gc, NULL); | |
272 if (!client) { | |
273 gaim_connection_error(gc, _("Out of memory")); | |
274 return; | |
275 } | |
276 | |
277 /* Get username, real name and local hostname for SILC library */ | |
278 if (gaim_account_get_username(account)) { | |
10825 | 279 const char *u = gaim_account_get_username(account); |
280 char **up = g_strsplit(u, "@", 2); | |
281 client->username = strdup(up[0]); | |
282 g_strfreev(up); | |
8849 | 283 } else { |
284 client->username = silc_get_username(); | |
285 gaim_account_set_username(account, client->username); | |
286 } | |
287 if (gaim_account_get_user_info(account)) { | |
288 client->realname = strdup(gaim_account_get_user_info(account)); | |
289 } else { | |
290 client->realname = silc_get_real_name(); | |
291 gaim_account_set_user_info(account, client->realname); | |
292 } | |
293 client->hostname = silc_net_localhost(); | |
294 | |
295 gaim_connection_set_display_name(gc, client->username); | |
296 | |
12217 | 297 /* Register requested cipher and HMAC */ |
298 cipher = gaim_account_get_string(account, "cipher", SILC_DEFAULT_CIPHER); | |
299 for (i = 0; silc_default_ciphers[i].name; i++) | |
300 if (!strcmp(silc_default_ciphers[i].name, cipher)) { | |
301 silc_cipher_register(&(silc_default_ciphers[i])); | |
302 break; | |
303 } | |
304 hmac = gaim_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); | |
305 for (i = 0; silc_default_hmacs[i].name; i++) | |
306 if (!strcmp(silc_default_hmacs[i].name, hmac)) { | |
307 silc_hmac_register(&(silc_default_hmacs[i])); | |
308 break; | |
309 } | |
310 | |
8849 | 311 /* Init SILC client */ |
312 if (!silc_client_init(client)) { | |
10909 | 313 gc->wants_to_die = TRUE; |
8849 | 314 gaim_connection_error(gc, ("Cannot initialize SILC protocol")); |
315 return; | |
316 } | |
317 | |
318 /* Check the ~/.silc dir and create it, and new key pair if necessary. */ | |
319 if (!silcgaim_check_silc_dir(gc)) { | |
10909 | 320 gc->wants_to_die = TRUE; |
8849 | 321 gaim_connection_error(gc, ("Cannot find/access ~/.silc directory")); |
322 return; | |
323 } | |
324 | |
325 /* Progress */ | |
326 gaim_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5); | |
327 | |
328 /* Load SILC key pair */ | |
10909 | 329 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcgaim_silcdir()); |
330 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcgaim_silcdir()); | |
331 if (!silc_load_key_pair((char *)gaim_account_get_string(account, "public-key", pkd), | |
10825 | 332 (char *)gaim_account_get_string(account, "private-key", prd), |
10751 | 333 (gc->password == NULL) ? "" : gc->password, &client->pkcs, |
9272 | 334 &client->public_key, &client->private_key)) { |
12167 | 335 g_snprintf(pkd, sizeof(pkd), ("Could not load SILC key pair: %s"), strerror(errno)); |
336 gaim_connection_error(gc, pkd); | |
8849 | 337 return; |
338 } | |
339 | |
340 sg = silc_calloc(1, sizeof(*sg)); | |
341 if (!sg) | |
342 return; | |
343 memset(sg, 0, sizeof(*sg)); | |
344 sg->client = client; | |
345 sg->gc = gc; | |
346 sg->account = account; | |
347 gc->proto_data = sg; | |
348 | |
349 /* Connect to the SILC server */ | |
350 if (gaim_proxy_connect(account, | |
351 gaim_account_get_string(account, "server", | |
352 "silc.silcnet.org"), | |
353 gaim_account_get_int(account, "port", 706), | |
354 silcgaim_login_connected, gc)) { | |
355 gaim_connection_error(gc, ("Unable to create connection")); | |
356 return; | |
357 } | |
358 | |
359 /* Schedule SILC using Glib's event loop */ | |
9353 | 360 #ifndef _WIN32 |
8849 | 361 sg->scheduler = g_timeout_add(5, (GSourceFunc)silcgaim_scheduler, sg); |
9353 | 362 #else |
363 sg->scheduler = g_timeout_add(300, (GSourceFunc)silcgaim_scheduler, sg); | |
364 #endif | |
8849 | 365 } |
366 | |
367 static int | |
368 silcgaim_close_final(gpointer *context) | |
369 { | |
370 SilcGaim sg = (SilcGaim)context; | |
371 silc_client_stop(sg->client); | |
372 silc_client_free(sg->client); | |
12217 | 373 #ifdef HAVE_SILCMIME_H |
374 if (sg->mimeass) | |
375 silc_mime_assembler_free(sg->mimeass); | |
376 #endif | |
8849 | 377 silc_free(sg); |
378 return 0; | |
379 } | |
380 | |
381 static void | |
382 silcgaim_close(GaimConnection *gc) | |
383 { | |
384 SilcGaim sg = gc->proto_data; | |
385 | |
10547 | 386 g_return_if_fail(sg != NULL); |
8849 | 387 |
388 /* Send QUIT */ | |
389 silc_client_command_call(sg->client, sg->conn, NULL, | |
9353 | 390 "QUIT", "Download Gaim: " GAIM_WEBSITE, NULL); |
8849 | 391 |
392 if (sg->conn) | |
393 silc_client_close_connection(sg->client, sg->conn); | |
394 | |
395 g_source_remove(sg->scheduler); | |
396 g_timeout_add(1, (GSourceFunc)silcgaim_close_final, sg); | |
397 } | |
398 | |
399 | |
400 /****************************** Protocol Actions *****************************/ | |
401 | |
402 static void | |
403 silcgaim_attrs_cancel(GaimConnection *gc, GaimRequestFields *fields) | |
404 { | |
405 /* Nothing */ | |
406 } | |
407 | |
408 static void | |
409 silcgaim_attrs_cb(GaimConnection *gc, GaimRequestFields *fields) | |
410 { | |
411 SilcGaim sg = gc->proto_data; | |
412 SilcClient client = sg->client; | |
413 SilcClientConnection conn = sg->conn; | |
414 GaimRequestField *f; | |
415 char *tmp; | |
416 SilcUInt32 tmp_len, mask; | |
417 SilcAttributeObjService service; | |
418 SilcAttributeObjDevice dev; | |
419 SilcVCardStruct vcard; | |
420 const char *val; | |
421 | |
422 sg = gc->proto_data; | |
423 if (!sg) | |
424 return; | |
425 | |
426 memset(&service, 0, sizeof(service)); | |
427 memset(&dev, 0, sizeof(dev)); | |
428 memset(&vcard, 0, sizeof(vcard)); | |
429 | |
430 silc_client_attribute_del(client, conn, | |
431 SILC_ATTRIBUTE_USER_INFO, NULL); | |
432 silc_client_attribute_del(client, conn, | |
433 SILC_ATTRIBUTE_SERVICE, NULL); | |
434 silc_client_attribute_del(client, conn, | |
435 SILC_ATTRIBUTE_STATUS_MOOD, NULL); | |
436 silc_client_attribute_del(client, conn, | |
437 SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); | |
438 silc_client_attribute_del(client, conn, | |
439 SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); | |
440 silc_client_attribute_del(client, conn, | |
441 SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); | |
442 silc_client_attribute_del(client, conn, | |
443 SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); | |
444 silc_client_attribute_del(client, conn, | |
445 SILC_ATTRIBUTE_TIMEZONE, NULL); | |
446 silc_client_attribute_del(client, conn, | |
447 SILC_ATTRIBUTE_GEOLOCATION, NULL); | |
448 silc_client_attribute_del(client, conn, | |
449 SILC_ATTRIBUTE_DEVICE_INFO, NULL); | |
450 | |
451 /* Set mood */ | |
452 mask = 0; | |
453 f = gaim_request_fields_get_field(fields, "mood_normal"); | |
454 if (f && gaim_request_field_bool_get_value(f)) | |
455 mask |= SILC_ATTRIBUTE_MOOD_NORMAL; | |
456 f = gaim_request_fields_get_field(fields, "mood_happy"); | |
457 if (f && gaim_request_field_bool_get_value(f)) | |
458 mask |= SILC_ATTRIBUTE_MOOD_HAPPY; | |
459 f = gaim_request_fields_get_field(fields, "mood_sad"); | |
460 if (f && gaim_request_field_bool_get_value(f)) | |
461 mask |= SILC_ATTRIBUTE_MOOD_SAD; | |
462 f = gaim_request_fields_get_field(fields, "mood_angry"); | |
463 if (f && gaim_request_field_bool_get_value(f)) | |
464 mask |= SILC_ATTRIBUTE_MOOD_ANGRY; | |
465 f = gaim_request_fields_get_field(fields, "mood_jealous"); | |
466 if (f && gaim_request_field_bool_get_value(f)) | |
467 mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; | |
468 f = gaim_request_fields_get_field(fields, "mood_ashamed"); | |
469 if (f && gaim_request_field_bool_get_value(f)) | |
470 mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; | |
471 f = gaim_request_fields_get_field(fields, "mood_invincible"); | |
472 if (f && gaim_request_field_bool_get_value(f)) | |
473 mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; | |
474 f = gaim_request_fields_get_field(fields, "mood_inlove"); | |
475 if (f && gaim_request_field_bool_get_value(f)) | |
476 mask |= SILC_ATTRIBUTE_MOOD_INLOVE; | |
477 f = gaim_request_fields_get_field(fields, "mood_sleepy"); | |
478 if (f && gaim_request_field_bool_get_value(f)) | |
479 mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; | |
480 f = gaim_request_fields_get_field(fields, "mood_bored"); | |
481 if (f && gaim_request_field_bool_get_value(f)) | |
482 mask |= SILC_ATTRIBUTE_MOOD_BORED; | |
483 f = gaim_request_fields_get_field(fields, "mood_excited"); | |
484 if (f && gaim_request_field_bool_get_value(f)) | |
485 mask |= SILC_ATTRIBUTE_MOOD_EXCITED; | |
486 f = gaim_request_fields_get_field(fields, "mood_anxious"); | |
487 if (f && gaim_request_field_bool_get_value(f)) | |
488 mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; | |
489 silc_client_attribute_add(client, conn, | |
490 SILC_ATTRIBUTE_STATUS_MOOD, | |
491 SILC_32_TO_PTR(mask), | |
492 sizeof(SilcUInt32)); | |
493 | |
494 /* Set preferred contact */ | |
495 mask = 0; | |
496 f = gaim_request_fields_get_field(fields, "contact_chat"); | |
497 if (f && gaim_request_field_bool_get_value(f)) | |
498 mask |= SILC_ATTRIBUTE_CONTACT_CHAT; | |
499 f = gaim_request_fields_get_field(fields, "contact_email"); | |
500 if (f && gaim_request_field_bool_get_value(f)) | |
501 mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; | |
502 f = gaim_request_fields_get_field(fields, "contact_call"); | |
503 if (f && gaim_request_field_bool_get_value(f)) | |
504 mask |= SILC_ATTRIBUTE_CONTACT_CALL; | |
505 f = gaim_request_fields_get_field(fields, "contact_sms"); | |
506 if (f && gaim_request_field_bool_get_value(f)) | |
507 mask |= SILC_ATTRIBUTE_CONTACT_SMS; | |
508 f = gaim_request_fields_get_field(fields, "contact_mms"); | |
509 if (f && gaim_request_field_bool_get_value(f)) | |
510 mask |= SILC_ATTRIBUTE_CONTACT_MMS; | |
511 f = gaim_request_fields_get_field(fields, "contact_video"); | |
512 if (f && gaim_request_field_bool_get_value(f)) | |
513 mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; | |
514 if (mask) | |
515 silc_client_attribute_add(client, conn, | |
516 SILC_ATTRIBUTE_PREFERRED_CONTACT, | |
517 SILC_32_TO_PTR(mask), | |
518 sizeof(SilcUInt32)); | |
519 | |
520 /* Set status text */ | |
521 val = NULL; | |
522 f = gaim_request_fields_get_field(fields, "status_text"); | |
523 if (f) | |
524 val = gaim_request_field_string_get_value(f); | |
525 if (val && *val) | |
526 silc_client_attribute_add(client, conn, | |
527 SILC_ATTRIBUTE_STATUS_FREETEXT, | |
528 (void *)val, strlen(val)); | |
529 | |
530 /* Set vcard */ | |
531 val = NULL; | |
532 f = gaim_request_fields_get_field(fields, "vcard"); | |
533 if (f) | |
534 val = gaim_request_field_string_get_value(f); | |
535 if (val && *val) { | |
12167 | 536 gaim_account_set_string(sg->account, "vcard", val); |
8849 | 537 tmp = silc_file_readfile(val, &tmp_len); |
538 if (tmp) { | |
539 tmp[tmp_len] = 0; | |
11318 | 540 if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) |
8849 | 541 silc_client_attribute_add(client, conn, |
542 SILC_ATTRIBUTE_USER_INFO, | |
543 (void *)&vcard, | |
544 sizeof(vcard)); | |
545 } | |
546 silc_vcard_free(&vcard); | |
547 silc_free(tmp); | |
12167 | 548 } else { |
549 gaim_account_set_string(sg->account, "vcard", ""); | |
8849 | 550 } |
551 | |
552 #ifdef HAVE_SYS_UTSNAME_H | |
553 /* Set device info */ | |
554 f = gaim_request_fields_get_field(fields, "device"); | |
555 if (f && gaim_request_field_bool_get_value(f)) { | |
556 struct utsname u; | |
557 if (!uname(&u)) { | |
558 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; | |
559 dev.version = u.release; | |
560 dev.model = u.sysname; | |
561 silc_client_attribute_add(client, conn, | |
562 SILC_ATTRIBUTE_DEVICE_INFO, | |
563 (void *)&dev, sizeof(dev)); | |
564 } | |
565 } | |
566 #endif | |
567 | |
568 /* Set timezone */ | |
569 val = NULL; | |
570 f = gaim_request_fields_get_field(fields, "timezone"); | |
571 if (f) | |
572 val = gaim_request_field_string_get_value(f); | |
573 if (val && *val) | |
574 silc_client_attribute_add(client, conn, | |
575 SILC_ATTRIBUTE_TIMEZONE, | |
576 (void *)val, strlen(val)); | |
577 } | |
578 | |
579 static void | |
9015 | 580 silcgaim_attrs(GaimPluginAction *action) |
8849 | 581 { |
9015 | 582 GaimConnection *gc = (GaimConnection *) action->context; |
8849 | 583 SilcGaim sg = gc->proto_data; |
584 SilcClient client = sg->client; | |
585 SilcClientConnection conn = sg->conn; | |
586 GaimRequestFields *fields; | |
587 GaimRequestFieldGroup *g; | |
588 GaimRequestField *f; | |
589 SilcHashTable attrs; | |
590 SilcAttributePayload attr; | |
591 gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, | |
592 mangry = FALSE, mjealous = FALSE, mashamed = FALSE, | |
593 minvincible = FALSE, minlove = FALSE, msleepy = FALSE, | |
594 mbored = FALSE, mexcited = FALSE, manxious = FALSE; | |
595 gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, | |
596 cmms = FALSE, cchat = TRUE, cvideo = FALSE; | |
597 gboolean device = TRUE; | |
598 char status[1024]; | |
599 | |
600 sg = gc->proto_data; | |
601 if (!sg) | |
602 return; | |
603 | |
604 memset(status, 0, sizeof(status)); | |
605 | |
606 attrs = silc_client_attributes_get(client, conn); | |
607 if (attrs) { | |
608 if (silc_hash_table_find(attrs, | |
609 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), | |
610 NULL, (void *)&attr)) { | |
611 SilcUInt32 mood = 0; | |
612 silc_attribute_get_object(attr, &mood, sizeof(mood)); | |
613 mnormal = !mood; | |
614 mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); | |
615 msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); | |
616 mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); | |
617 mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); | |
618 mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); | |
619 minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); | |
620 minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); | |
621 msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); | |
622 mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); | |
623 mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); | |
624 manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); | |
625 } | |
626 | |
627 if (silc_hash_table_find(attrs, | |
628 SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), | |
629 NULL, (void *)&attr)) { | |
630 SilcUInt32 contact = 0; | |
631 silc_attribute_get_object(attr, &contact, sizeof(contact)); | |
632 cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); | |
633 ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); | |
634 csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); | |
635 cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); | |
636 cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); | |
637 cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); | |
638 } | |
639 | |
640 if (silc_hash_table_find(attrs, | |
641 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), | |
642 NULL, (void *)&attr)) | |
643 silc_attribute_get_object(attr, &status, sizeof(status)); | |
644 | |
645 if (!silc_hash_table_find(attrs, | |
646 SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), | |
647 NULL, (void *)&attr)) | |
648 device = FALSE; | |
649 } | |
650 | |
651 fields = gaim_request_fields_new(); | |
652 | |
653 g = gaim_request_field_group_new(NULL); | |
654 f = gaim_request_field_label_new("l3", _("Your Current Mood")); | |
655 gaim_request_field_group_add_field(g, f); | |
656 f = gaim_request_field_bool_new("mood_normal", _("Normal"), mnormal); | |
657 gaim_request_field_group_add_field(g, f); | |
658 f = gaim_request_field_bool_new("mood_happy", _("Happy"), mhappy); | |
659 gaim_request_field_group_add_field(g, f); | |
660 f = gaim_request_field_bool_new("mood_sad", _("Sad"), msad); | |
661 gaim_request_field_group_add_field(g, f); | |
662 f = gaim_request_field_bool_new("mood_angry", _("Angry"), mangry); | |
663 gaim_request_field_group_add_field(g, f); | |
664 f = gaim_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); | |
665 gaim_request_field_group_add_field(g, f); | |
666 f = gaim_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); | |
667 gaim_request_field_group_add_field(g, f); | |
668 f = gaim_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); | |
669 gaim_request_field_group_add_field(g, f); | |
670 f = gaim_request_field_bool_new("mood_inlove", _("In Love"), minlove); | |
671 gaim_request_field_group_add_field(g, f); | |
672 f = gaim_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); | |
673 gaim_request_field_group_add_field(g, f); | |
674 f = gaim_request_field_bool_new("mood_bored", _("Bored"), mbored); | |
675 gaim_request_field_group_add_field(g, f); | |
676 f = gaim_request_field_bool_new("mood_excited", _("Excited"), mexcited); | |
677 gaim_request_field_group_add_field(g, f); | |
678 f = gaim_request_field_bool_new("mood_anxious", _("Anxious"), manxious); | |
679 gaim_request_field_group_add_field(g, f); | |
680 | |
681 f = gaim_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); | |
682 gaim_request_field_group_add_field(g, f); | |
683 f = gaim_request_field_bool_new("contact_chat", _("Chat"), cchat); | |
684 gaim_request_field_group_add_field(g, f); | |
685 f = gaim_request_field_bool_new("contact_email", _("Email"), cemail); | |
686 gaim_request_field_group_add_field(g, f); | |
687 f = gaim_request_field_bool_new("contact_call", _("Phone"), ccall); | |
688 gaim_request_field_group_add_field(g, f); | |
689 f = gaim_request_field_bool_new("contact_sms", _("SMS"), csms); | |
690 gaim_request_field_group_add_field(g, f); | |
691 f = gaim_request_field_bool_new("contact_mms", _("MMS"), cmms); | |
692 gaim_request_field_group_add_field(g, f); | |
693 f = gaim_request_field_bool_new("contact_video", _("Video Conferencing"), cvideo); | |
694 gaim_request_field_group_add_field(g, f); | |
695 gaim_request_fields_add_group(fields, g); | |
696 | |
697 g = gaim_request_field_group_new(NULL); | |
698 f = gaim_request_field_string_new("status_text", _("Your Current Status"), | |
699 status[0] ? status : NULL, TRUE); | |
700 gaim_request_field_group_add_field(g, f); | |
701 gaim_request_fields_add_group(fields, g); | |
702 | |
703 g = gaim_request_field_group_new(NULL); | |
704 #if 0 | |
705 f = gaim_request_field_label_new("l2", _("Online Services")); | |
706 gaim_request_field_group_add_field(g, f); | |
707 f = gaim_request_field_bool_new("services", | |
708 _("Let others see what services you are using"), | |
709 TRUE); | |
710 gaim_request_field_group_add_field(g, f); | |
711 #endif | |
712 #ifdef HAVE_SYS_UTSNAME_H | |
713 f = gaim_request_field_bool_new("device", | |
714 _("Let others see what computer you are using"), | |
715 device); | |
716 gaim_request_field_group_add_field(g, f); | |
717 #endif | |
718 gaim_request_fields_add_group(fields, g); | |
719 | |
720 g = gaim_request_field_group_new(NULL); | |
721 f = gaim_request_field_string_new("vcard", _("Your VCard File"), | |
12167 | 722 gaim_account_get_string(sg->account, "vcard", ""), |
8849 | 723 FALSE); |
724 gaim_request_field_group_add_field(g, f); | |
725 #ifdef _WIN32 | |
726 f = gaim_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE); | |
727 #else | |
728 f = gaim_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE); | |
729 #endif | |
730 gaim_request_field_group_add_field(g, f); | |
731 gaim_request_fields_add_group(fields, g); | |
732 | |
11201 | 733 gaim_request_fields(gc, _("User Online Status Attributes"), |
8849 | 734 _("User Online Status Attributes"), |
735 _("You can let other users see your online status information " | |
736 "and your personal information. Please fill the information " | |
737 "you would like other users to see about yourself."), | |
738 fields, | |
8906 | 739 _("OK"), G_CALLBACK(silcgaim_attrs_cb), |
740 _("Cancel"), G_CALLBACK(silcgaim_attrs_cancel), gc); | |
8849 | 741 } |
742 | |
743 static void | |
9015 | 744 silcgaim_detach(GaimPluginAction *action) |
8849 | 745 { |
9015 | 746 GaimConnection *gc = (GaimConnection *) action->context; |
8849 | 747 SilcGaim sg; |
748 | |
749 if (!gc) | |
750 return; | |
751 sg = gc->proto_data; | |
752 if (!sg) | |
753 return; | |
754 | |
755 /* Call DETACH */ | |
756 silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
757 sg->detaching = TRUE; | |
758 } | |
759 | |
760 static void | |
9015 | 761 silcgaim_view_motd(GaimPluginAction *action) |
8849 | 762 { |
9015 | 763 GaimConnection *gc = (GaimConnection *) action->context; |
8849 | 764 SilcGaim sg; |
9488 | 765 char *tmp; |
8849 | 766 |
767 if (!gc) | |
768 return; | |
769 sg = gc->proto_data; | |
770 if (!sg) | |
771 return; | |
772 | |
773 if (!sg->motd) { | |
774 gaim_notify_error( | |
775 gc, _("Message of the Day"), _("No Message of the Day available"), | |
776 _("There is no Message of the Day associated with this connection")); | |
777 return; | |
778 } | |
779 | |
10732
c4cb90065e1d
[gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents:
10547
diff
changeset
|
780 tmp = g_markup_escape_text(sg->motd, -1); |
9488 | 781 gaim_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
782 tmp, NULL, NULL); | |
783 g_free(tmp); | |
8849 | 784 } |
785 | |
9272 | 786 static void |
12167 | 787 silcgaim_create_keypair_cancel(GaimConnection *gc, GaimRequestFields *fields) |
788 { | |
789 /* Nothing */ | |
790 } | |
791 | |
792 static void | |
793 silcgaim_create_keypair_cb(GaimConnection *gc, GaimRequestFields *fields) | |
794 { | |
795 SilcGaim sg = gc->proto_data; | |
796 GaimRequestField *f; | |
797 const char *val, *pkfile = NULL, *prfile = NULL; | |
798 const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; | |
799 const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; | |
800 char *identifier; | |
801 int keylen = SILCGAIM_DEF_PKCS_LEN; | |
802 SilcPublicKey public_key; | |
803 | |
804 sg = gc->proto_data; | |
805 if (!sg) | |
806 return; | |
807 | |
808 val = NULL; | |
809 f = gaim_request_fields_get_field(fields, "pass1"); | |
810 if (f) | |
811 val = gaim_request_field_string_get_value(f); | |
812 if (val && *val) | |
813 pass1 = val; | |
814 else | |
815 pass1 = ""; | |
816 val = NULL; | |
817 f = gaim_request_fields_get_field(fields, "pass2"); | |
818 if (f) | |
819 val = gaim_request_field_string_get_value(f); | |
820 if (val && *val) | |
821 pass2 = val; | |
822 else | |
823 pass2 = ""; | |
824 | |
825 if (strcmp(pass1, pass2)) { | |
826 gaim_notify_error( | |
827 gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); | |
828 return; | |
829 } | |
830 | |
831 val = NULL; | |
832 f = gaim_request_fields_get_field(fields, "key"); | |
833 if (f) | |
834 val = gaim_request_field_string_get_value(f); | |
835 if (val && *val) | |
836 keylen = atoi(val); | |
837 f = gaim_request_fields_get_field(fields, "pkfile"); | |
838 if (f) | |
839 pkfile = gaim_request_field_string_get_value(f); | |
840 f = gaim_request_fields_get_field(fields, "prfile"); | |
841 if (f) | |
842 prfile = gaim_request_field_string_get_value(f); | |
843 | |
844 f = gaim_request_fields_get_field(fields, "un"); | |
845 if (f) | |
846 un = gaim_request_field_string_get_value(f); | |
847 f = gaim_request_fields_get_field(fields, "hn"); | |
848 if (f) | |
849 hn = gaim_request_field_string_get_value(f); | |
850 f = gaim_request_fields_get_field(fields, "rn"); | |
851 if (f) | |
852 rn = gaim_request_field_string_get_value(f); | |
853 f = gaim_request_fields_get_field(fields, "e"); | |
854 if (f) | |
855 e = gaim_request_field_string_get_value(f); | |
856 f = gaim_request_fields_get_field(fields, "o"); | |
857 if (f) | |
858 o = gaim_request_field_string_get_value(f); | |
859 f = gaim_request_fields_get_field(fields, "c"); | |
860 if (f) | |
861 c = gaim_request_field_string_get_value(f); | |
862 | |
863 identifier = silc_pkcs_encode_identifier((char *)un, (char *)hn, | |
864 (char *)rn, (char *)e, (char *)o, (char *)c); | |
865 | |
866 /* Create the key pair */ | |
867 if (!silc_create_key_pair(SILCGAIM_DEF_PKCS, keylen, pkfile, prfile, | |
868 identifier, pass1, NULL, &public_key, NULL, | |
869 FALSE)) { | |
870 gaim_notify_error( | |
871 gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); | |
872 return; | |
873 } | |
874 | |
875 silcgaim_show_public_key(sg, NULL, public_key, NULL, NULL); | |
876 | |
877 silc_pkcs_public_key_free(public_key); | |
878 silc_free(identifier); | |
879 } | |
880 | |
881 static void | |
882 silcgaim_create_keypair(GaimPluginAction *action) | |
883 { | |
884 GaimConnection *gc = (GaimConnection *) action->context; | |
885 SilcGaim sg = gc->proto_data; | |
886 GaimRequestFields *fields; | |
887 GaimRequestFieldGroup *g; | |
888 GaimRequestField *f; | |
889 const char *username, *realname; | |
890 char *hostname, **u; | |
891 char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; | |
892 | |
893 username = gaim_account_get_username(sg->account); | |
894 u = g_strsplit(username, "@", 2); | |
895 username = u[0]; | |
896 realname = gaim_account_get_user_info(sg->account); | |
897 hostname = silc_net_localhost(); | |
898 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); | |
899 | |
900 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcgaim_silcdir()); | |
901 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcgaim_silcdir()); | |
902 g_snprintf(pkd, sizeof(pkd) - 1, "%s", | |
903 gaim_account_get_string(gc->account, "public-key", pkd2)); | |
904 g_snprintf(prd, sizeof(prd) - 1, "%s", | |
905 gaim_account_get_string(gc->account, "private-key", prd2)); | |
906 | |
907 fields = gaim_request_fields_new(); | |
908 | |
909 g = gaim_request_field_group_new(NULL); | |
910 f = gaim_request_field_string_new("key", _("Key Length"), "2048", FALSE); | |
911 gaim_request_field_group_add_field(g, f); | |
912 f = gaim_request_field_string_new("pkfile", _("Public Key File"), pkd, FALSE); | |
913 gaim_request_field_group_add_field(g, f); | |
914 f = gaim_request_field_string_new("prfile", _("Private Key File"), prd, FALSE); | |
915 gaim_request_field_group_add_field(g, f); | |
916 gaim_request_fields_add_group(fields, g); | |
917 | |
918 g = gaim_request_field_group_new(NULL); | |
919 f = gaim_request_field_string_new("un", _("Username"), username ? username : "", FALSE); | |
920 gaim_request_field_group_add_field(g, f); | |
921 f = gaim_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); | |
922 gaim_request_field_group_add_field(g, f); | |
923 f = gaim_request_field_string_new("rn", _("Real Name"), realname ? realname : "", FALSE); | |
924 gaim_request_field_group_add_field(g, f); | |
925 f = gaim_request_field_string_new("e", _("Email"), tmp, FALSE); | |
926 gaim_request_field_group_add_field(g, f); | |
927 f = gaim_request_field_string_new("o", _("Organization"), "", FALSE); | |
928 gaim_request_field_group_add_field(g, f); | |
929 f = gaim_request_field_string_new("c", _("Country"), "", FALSE); | |
930 gaim_request_field_group_add_field(g, f); | |
931 gaim_request_fields_add_group(fields, g); | |
932 | |
933 g = gaim_request_field_group_new(NULL); | |
934 f = gaim_request_field_string_new("pass1", _("Passphrase"), "", FALSE); | |
935 gaim_request_field_string_set_masked(f, TRUE); | |
936 gaim_request_field_group_add_field(g, f); | |
937 f = gaim_request_field_string_new("pass2", _("Re-type Passphrase"), "", FALSE); | |
938 gaim_request_field_string_set_masked(f, TRUE); | |
939 gaim_request_field_group_add_field(g, f); | |
940 gaim_request_fields_add_group(fields, g); | |
941 | |
942 gaim_request_fields(gc, _("Create New SILC Key Pair"), | |
943 _("Create New SILC Key Pair"), NULL, fields, | |
944 _("Generate Key Pair"), G_CALLBACK(silcgaim_create_keypair_cb), | |
945 _("Cancel"), G_CALLBACK(silcgaim_create_keypair_cancel), gc); | |
946 | |
947 g_strfreev(u); | |
948 silc_free(hostname); | |
949 } | |
950 | |
951 static void | |
9272 | 952 silcgaim_change_pass(GaimPluginAction *action) |
953 { | |
954 GaimConnection *gc = (GaimConnection *) action->context; | |
955 gaim_account_request_change_password(gaim_connection_get_account(gc)); | |
956 } | |
957 | |
958 static void | |
959 silcgaim_change_passwd(GaimConnection *gc, const char *old, const char *new) | |
960 { | |
10825 | 961 char prd[256]; |
962 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcgaim_silcdir()); | |
963 silc_change_private_key_passphrase(gaim_account_get_string(gc->account, | |
964 "private-key", | |
965 prd), old, new); | |
9272 | 966 } |
967 | |
968 static void | |
969 silcgaim_show_set_info(GaimPluginAction *action) | |
970 { | |
971 GaimConnection *gc = (GaimConnection *) action->context; | |
972 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); | |
973 } | |
974 | |
975 static void | |
976 silcgaim_set_info(GaimConnection *gc, const char *text) | |
977 { | |
978 } | |
979 | |
8849 | 980 static GList * |
9015 | 981 silcgaim_actions(GaimPlugin *plugin, gpointer context) |
8849 | 982 { |
9024 | 983 GaimConnection *gc = context; |
8849 | 984 GList *list = NULL; |
9015 | 985 GaimPluginAction *act; |
8849 | 986 |
987 if (!gaim_account_get_bool(gc->account, "reject-attrs", FALSE)) { | |
9015 | 988 act = gaim_plugin_action_new(_("Online Status"), |
989 silcgaim_attrs); | |
990 list = g_list_append(list, act); | |
8849 | 991 } |
992 | |
9015 | 993 act = gaim_plugin_action_new(_("Detach From Server"), |
994 silcgaim_detach); | |
995 list = g_list_append(list, act); | |
8849 | 996 |
9015 | 997 act = gaim_plugin_action_new(_("View Message of the Day"), |
998 silcgaim_view_motd); | |
999 list = g_list_append(list, act); | |
8849 | 1000 |
12167 | 1001 act = gaim_plugin_action_new(_("Create SILC Key Pair..."), |
1002 silcgaim_create_keypair); | |
1003 list = g_list_append(list, act); | |
1004 | |
9272 | 1005 act = gaim_plugin_action_new(_("Change Password..."), |
1006 silcgaim_change_pass); | |
1007 list = g_list_append(list, act); | |
1008 | |
1009 act = gaim_plugin_action_new(_("Set User Info..."), | |
1010 silcgaim_show_set_info); | |
1011 list = g_list_append(list, act); | |
1012 | |
8849 | 1013 return list; |
1014 } | |
1015 | |
1016 | |
1017 /******************************* IM Routines *********************************/ | |
1018 | |
1019 typedef struct { | |
1020 char *nick; | |
11318 | 1021 char *message; |
8849 | 1022 SilcUInt32 message_len; |
1023 SilcMessageFlags flags; | |
12303 | 1024 GaimMessageFlags gflags; |
8849 | 1025 } *SilcGaimIM; |
1026 | |
1027 static void | |
1028 silcgaim_send_im_resolved(SilcClient client, | |
1029 SilcClientConnection conn, | |
1030 SilcClientEntry *clients, | |
1031 SilcUInt32 clients_count, | |
1032 void *context) | |
1033 { | |
1034 GaimConnection *gc = client->application; | |
1035 SilcGaim sg = gc->proto_data; | |
1036 SilcGaimIM im = context; | |
1037 GaimConversation *convo; | |
1038 char tmp[256], *nickname = NULL; | |
1039 SilcClientEntry client_entry; | |
12217 | 1040 #ifdef HAVE_SILCMIME_H |
1041 SilcDList list; | |
1042 #endif | |
8849 | 1043 |
11338 | 1044 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, im->nick, |
10246 | 1045 sg->account); |
8849 | 1046 if (!convo) |
1047 return; | |
1048 | |
1049 if (!clients) | |
1050 goto err; | |
1051 | |
1052 if (clients_count > 1) { | |
1053 silc_parse_userfqdn(im->nick, &nickname, NULL); | |
1054 | |
1055 /* Find the correct one. The im->nick might be a formatted nick | |
1056 so this will find the correct one. */ | |
1057 clients = silc_client_get_clients_local(client, conn, | |
1058 nickname, im->nick, | |
1059 &clients_count); | |
1060 if (!clients) | |
1061 goto err; | |
1062 client_entry = clients[0]; | |
1063 silc_free(clients); | |
1064 } else { | |
1065 client_entry = clients[0]; | |
1066 } | |
1067 | |
12217 | 1068 #ifdef HAVE_SILCMIME_H |
1069 /* Check for images */ | |
12303 | 1070 if (im->gflags & GAIM_MESSAGE_IMAGES) { |
1071 list = silcgaim_image_message(im->message, (SilcUInt32 *)&im->flags); | |
1072 if (list) { | |
1073 /* Send one or more MIME message. If more than one, they | |
1074 are MIME fragments due to over large message */ | |
1075 SilcBuffer buf; | |
12217 | 1076 |
12303 | 1077 silc_dlist_start(list); |
1078 while ((buf = silc_dlist_get(list)) != SILC_LIST_END) | |
1079 silc_client_send_private_message(client, conn, | |
1080 client_entry, im->flags, | |
1081 buf->data, buf->len, | |
1082 TRUE); | |
1083 silc_mime_partial_free(list); | |
1084 gaim_conv_im_write(GAIM_CONV_IM(convo), conn->local_entry->nickname, | |
1085 im->message, 0, time(NULL)); | |
1086 goto out; | |
1087 } | |
1088 } | |
12217 | 1089 #endif |
1090 | |
12303 | 1091 /* Send the message */ |
1092 silc_client_send_private_message(client, conn, client_entry, im->flags, | |
1093 (unsigned char *)im->message, im->message_len, TRUE); | |
8849 | 1094 gaim_conv_im_write(GAIM_CONV_IM(convo), conn->local_entry->nickname, |
1095 im->message, 0, time(NULL)); | |
1096 goto out; | |
1097 | |
1098 err: | |
1099 g_snprintf(tmp, sizeof(tmp), | |
1100 _("User <I>%s</I> is not present in the network"), im->nick); | |
1101 gaim_conversation_write(convo, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
1102 | |
1103 out: | |
1104 g_free(im->nick); | |
1105 g_free(im->message); | |
1106 silc_free(im); | |
1107 silc_free(nickname); | |
1108 } | |
1109 | |
1110 static int | |
12216 | 1111 silcgaim_send_im(GaimConnection *gc, const char *who, const char *message, |
1112 GaimMessageFlags flags) | |
8849 | 1113 { |
1114 SilcGaim sg = gc->proto_data; | |
1115 SilcClient client = sg->client; | |
1116 SilcClientConnection conn = sg->conn; | |
1117 SilcClientEntry *clients; | |
1118 SilcUInt32 clients_count, mflags; | |
12216 | 1119 char *nickname, *msg, *tmp; |
12217 | 1120 int ret = 0; |
12167 | 1121 gboolean sign = gaim_account_get_bool(sg->account, "sign-verify", FALSE); |
12217 | 1122 #ifdef HAVE_SILCMIME_H |
1123 SilcDList list; | |
1124 #endif | |
8849 | 1125 |
12216 | 1126 if (!who || !message) |
8849 | 1127 return 0; |
1128 | |
9353 | 1129 mflags = SILC_MESSAGE_FLAG_UTF8; |
1130 | |
12216 | 1131 tmp = msg = gaim_unescape_html(message); |
1132 | |
9353 | 1133 if (!g_ascii_strncasecmp(msg, "/me ", 4)) { |
1134 msg += 4; | |
12216 | 1135 if (!*msg) { |
1136 g_free(tmp); | |
9353 | 1137 return 0; |
12216 | 1138 } |
9353 | 1139 mflags |= SILC_MESSAGE_FLAG_ACTION; |
1140 } else if (strlen(msg) > 1 && msg[0] == '/') { | |
8849 | 1141 if (!silc_client_command_call(client, conn, msg + 1)) |
1142 gaim_notify_error(gc, ("Call Command"), _("Cannot call command"), | |
9359 | 1143 _("Unknown command")); |
12216 | 1144 g_free(tmp); |
8849 | 1145 return 0; |
1146 } | |
1147 | |
9353 | 1148 |
12216 | 1149 if (!silc_parse_userfqdn(who, &nickname, NULL)) { |
1150 g_free(tmp); | |
8849 | 1151 return 0; |
12216 | 1152 } |
8849 | 1153 |
1154 if (sign) | |
1155 mflags |= SILC_MESSAGE_FLAG_SIGNED; | |
1156 | |
1157 /* Find client entry */ | |
1158 clients = silc_client_get_clients_local(client, conn, nickname, who, | |
1159 &clients_count); | |
1160 if (!clients) { | |
1161 /* Resolve unknown user */ | |
1162 SilcGaimIM im = silc_calloc(1, sizeof(*im)); | |
12216 | 1163 if (!im) { |
1164 g_free(tmp); | |
8849 | 1165 return 0; |
12216 | 1166 } |
8849 | 1167 im->nick = g_strdup(who); |
12217 | 1168 im->message = g_strdup(message); |
8849 | 1169 im->message_len = strlen(im->message); |
1170 im->flags = mflags; | |
12303 | 1171 im->gflags = flags; |
8849 | 1172 silc_client_get_clients(client, conn, nickname, NULL, |
1173 silcgaim_send_im_resolved, im); | |
1174 silc_free(nickname); | |
12216 | 1175 g_free(tmp); |
8849 | 1176 return 0; |
1177 } | |
1178 | |
12217 | 1179 #ifdef HAVE_SILCMIME_H |
1180 /* Check for images */ | |
12303 | 1181 if (flags & GAIM_MESSAGE_IMAGES) { |
1182 list = silcgaim_image_message(message, &mflags); | |
1183 if (list) { | |
1184 /* Send one or more MIME message. If more than one, they | |
1185 are MIME fragments due to over large message */ | |
1186 SilcBuffer buf; | |
12217 | 1187 |
12303 | 1188 silc_dlist_start(list); |
1189 while ((buf = silc_dlist_get(list)) != SILC_LIST_END) | |
1190 ret = | |
1191 silc_client_send_private_message(client, conn, | |
1192 clients[0], mflags, | |
1193 buf->data, buf->len, | |
1194 TRUE); | |
1195 silc_mime_partial_free(list); | |
1196 g_free(tmp); | |
1197 silc_free(nickname); | |
1198 silc_free(clients); | |
1199 return ret; | |
1200 } | |
1201 } | |
12217 | 1202 #endif |
12303 | 1203 |
1204 /* Send private message directly */ | |
1205 ret = silc_client_send_private_message(client, conn, clients[0], | |
1206 mflags, | |
1207 (unsigned char *)msg, | |
1208 strlen(msg), TRUE); | |
8849 | 1209 |
12216 | 1210 g_free(tmp); |
8849 | 1211 silc_free(nickname); |
1212 silc_free(clients); | |
1213 return ret; | |
1214 } | |
1215 | |
1216 | |
12325
33026deed1ce
[gaim-migrate @ 14629]
Richard Laager <rlaager@wiktel.com>
parents:
12303
diff
changeset
|
1217 static GList *silcgaim_blist_node_menu(GaimBlistNode *node) { |
9030 | 1218 /* split this single menu building function back into the two |
1219 original: one for buddies and one for chats */ | |
1220 | |
1221 if(GAIM_BLIST_NODE_IS_CHAT(node)) { | |
9038 | 1222 return silcgaim_chat_menu((GaimChat *) node); |
9030 | 1223 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
1224 return silcgaim_buddy_menu((GaimBuddy *) node); | |
1225 } else { | |
9038 | 1226 g_return_val_if_reached(NULL); |
9353 | 1227 } |
9030 | 1228 } |
1229 | |
9272 | 1230 /********************************* Commands **********************************/ |
1231 | |
1232 static GaimCmdRet silcgaim_cmd_chat_part(GaimConversation *conv, | |
9597 | 1233 const char *cmd, char **args, char **error, void *data) |
9272 | 1234 { |
1235 GaimConnection *gc; | |
9353 | 1236 GaimConversation *convo; |
9272 | 1237 int id = 0; |
1238 | |
1239 gc = gaim_conversation_get_gc(conv); | |
9353 | 1240 |
1241 if (gc == NULL) | |
1242 return GAIM_CMD_RET_FAILED; | |
9272 | 1243 |
9353 | 1244 if(args && args[0]) { |
11338 | 1245 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], |
10246 | 1246 gc->account); |
9353 | 1247 } else |
1248 convo = conv; | |
1249 | |
1250 id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)); | |
1251 | |
1252 if (id == 0) | |
9272 | 1253 return GAIM_CMD_RET_FAILED; |
1254 | |
1255 silcgaim_chat_leave(gc, id); | |
1256 | |
1257 return GAIM_CMD_RET_OK; | |
1258 | |
1259 } | |
1260 | |
1261 static GaimCmdRet silcgaim_cmd_chat_topic(GaimConversation *conv, | |
9597 | 1262 const char *cmd, char **args, char **error, void *data) |
9272 | 1263 { |
1264 GaimConnection *gc; | |
1265 int id = 0; | |
9762 | 1266 char *buf, *tmp, *tmp2; |
9488 | 1267 const char *topic; |
9272 | 1268 |
1269 gc = gaim_conversation_get_gc(conv); | |
1270 id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)); | |
1271 | |
1272 if (gc == NULL || id == 0) | |
1273 return GAIM_CMD_RET_FAILED; | |
1274 | |
9488 | 1275 if (!args || !args[0]) { |
1276 topic = gaim_conv_chat_get_topic (GAIM_CONV_CHAT(conv)); | |
1277 if (topic) { | |
10732
c4cb90065e1d
[gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents:
10547
diff
changeset
|
1278 tmp = g_markup_escape_text(topic, -1); |
9762 | 1279 tmp2 = gaim_markup_linkify(tmp); |
1280 buf = g_strdup_printf(_("current topic is: %s"), tmp2); | |
9488 | 1281 g_free(tmp); |
9762 | 1282 g_free(tmp2); |
9488 | 1283 } else |
1284 buf = g_strdup(_("No topic is set")); | |
1285 gaim_conv_chat_write(GAIM_CONV_CHAT(conv), gc->account->username, buf, | |
1286 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | |
1287 g_free(buf); | |
1288 | |
1289 } | |
1290 | |
1291 if (args && args[0] && (strlen(args[0]) > 255)) { | |
1292 *error = g_strdup(_("Topic too long")); | |
1293 return GAIM_CMD_RET_FAILED; | |
1294 } | |
1295 | |
9272 | 1296 silcgaim_chat_set_topic(gc, id, args ? args[0] : NULL); |
1297 | |
1298 return GAIM_CMD_RET_OK; | |
1299 } | |
1300 | |
1301 static GaimCmdRet silcgaim_cmd_chat_join(GaimConversation *conv, | |
9597 | 1302 const char *cmd, char **args, char **error, void *data) |
9272 | 1303 { |
1304 GHashTable *comp; | |
1305 | |
1306 if(!args || !args[0]) | |
1307 return GAIM_CMD_RET_FAILED; | |
1308 | |
1309 comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); | |
1310 | |
1311 g_hash_table_replace(comp, "channel", args[0]); | |
1312 if(args[1]) | |
1313 g_hash_table_replace(comp, "passphrase", args[1]); | |
1314 | |
1315 silcgaim_chat_join(gaim_conversation_get_gc(conv), comp); | |
1316 | |
1317 g_hash_table_destroy(comp); | |
1318 return GAIM_CMD_RET_OK; | |
1319 } | |
1320 | |
1321 static GaimCmdRet silcgaim_cmd_chat_list(GaimConversation *conv, | |
9597 | 1322 const char *cmd, char **args, char **error, void *data) |
9272 | 1323 { |
1324 GaimConnection *gc; | |
1325 gc = gaim_conversation_get_gc(conv); | |
1326 gaim_roomlist_show_with_account(gaim_connection_get_account(gc)); | |
1327 return GAIM_CMD_RET_OK; | |
1328 } | |
1329 | |
1330 static GaimCmdRet silcgaim_cmd_whois(GaimConversation *conv, | |
9597 | 1331 const char *cmd, char **args, char **error, void *data) |
9272 | 1332 { |
1333 GaimConnection *gc; | |
1334 | |
1335 gc = gaim_conversation_get_gc(conv); | |
1336 | |
1337 if (gc == NULL) | |
1338 return GAIM_CMD_RET_FAILED; | |
1339 | |
1340 silcgaim_get_info(gc, args[0]); | |
1341 | |
1342 return GAIM_CMD_RET_OK; | |
1343 } | |
1344 | |
1345 static GaimCmdRet silcgaim_cmd_msg(GaimConversation *conv, | |
9597 | 1346 const char *cmd, char **args, char **error, void *data) |
9272 | 1347 { |
1348 int ret; | |
1349 GaimConnection *gc; | |
1350 | |
1351 gc = gaim_conversation_get_gc(conv); | |
1352 | |
1353 if (gc == NULL) | |
1354 return GAIM_CMD_RET_FAILED; | |
1355 | |
1356 ret = silcgaim_send_im(gc, args[0], args[1], GAIM_MESSAGE_SEND); | |
1357 | |
1358 if (ret) | |
1359 return GAIM_CMD_RET_OK; | |
1360 else | |
1361 return GAIM_CMD_RET_FAILED; | |
1362 } | |
1363 | |
1364 static GaimCmdRet silcgaim_cmd_query(GaimConversation *conv, | |
9597 | 1365 const char *cmd, char **args, char **error, void *data) |
9272 | 1366 { |
1367 int ret = 1; | |
1368 GaimConversation *convo; | |
1369 GaimConnection *gc; | |
1370 GaimAccount *account; | |
1371 | |
9488 | 1372 if (!args || !args[0]) { |
1373 *error = g_strdup(_("You must specify a nick")); | |
9272 | 1374 return GAIM_CMD_RET_FAILED; |
9488 | 1375 } |
9272 | 1376 |
1377 gc = gaim_conversation_get_gc(conv); | |
1378 | |
1379 if (gc == NULL) | |
1380 return GAIM_CMD_RET_FAILED; | |
1381 | |
1382 account = gaim_connection_get_account(gc); | |
1383 | |
11338 | 1384 convo = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, args[0]); |
9272 | 1385 |
1386 if (args[1]) { | |
1387 ret = silcgaim_send_im(gc, args[0], args[1], GAIM_MESSAGE_SEND); | |
1388 gaim_conv_im_write(GAIM_CONV_IM(convo), gaim_connection_get_display_name(gc), | |
1389 args[1], GAIM_MESSAGE_SEND, time(NULL)); | |
1390 } | |
1391 | |
1392 if (ret) | |
1393 return GAIM_CMD_RET_OK; | |
1394 else | |
1395 return GAIM_CMD_RET_FAILED; | |
1396 } | |
1397 | |
1398 static GaimCmdRet silcgaim_cmd_motd(GaimConversation *conv, | |
9597 | 1399 const char *cmd, char **args, char **error, void *data) |
9272 | 1400 { |
1401 GaimConnection *gc; | |
1402 SilcGaim sg; | |
9488 | 1403 char *tmp; |
9272 | 1404 |
1405 gc = gaim_conversation_get_gc(conv); | |
1406 | |
1407 if (gc == NULL) | |
1408 return GAIM_CMD_RET_FAILED; | |
1409 | |
1410 sg = gc->proto_data; | |
1411 | |
1412 if (sg == NULL) | |
1413 return GAIM_CMD_RET_FAILED; | |
1414 | |
1415 if (!sg->motd) { | |
9488 | 1416 *error = g_strdup(_("There is no Message of the Day associated with this connection")); |
9272 | 1417 return GAIM_CMD_RET_FAILED; |
1418 } | |
1419 | |
10732
c4cb90065e1d
[gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents:
10547
diff
changeset
|
1420 tmp = g_markup_escape_text(sg->motd, -1); |
9488 | 1421 gaim_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
1422 tmp, NULL, NULL); | |
1423 g_free(tmp); | |
9272 | 1424 |
1425 return GAIM_CMD_RET_OK; | |
1426 } | |
1427 | |
1428 static GaimCmdRet silcgaim_cmd_detach(GaimConversation *conv, | |
9597 | 1429 const char *cmd, char **args, char **error, void *data) |
9272 | 1430 { |
1431 GaimConnection *gc; | |
1432 SilcGaim sg; | |
1433 | |
1434 gc = gaim_conversation_get_gc(conv); | |
1435 | |
1436 if (gc == NULL) | |
1437 return GAIM_CMD_RET_FAILED; | |
1438 | |
1439 sg = gc->proto_data; | |
1440 | |
1441 if (sg == NULL) | |
1442 return GAIM_CMD_RET_FAILED; | |
1443 | |
1444 silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
1445 sg->detaching = TRUE; | |
1446 | |
1447 return GAIM_CMD_RET_OK; | |
1448 } | |
1449 | |
9488 | 1450 static GaimCmdRet silcgaim_cmd_cmode(GaimConversation *conv, |
9597 | 1451 const char *cmd, char **args, char **error, void *data) |
9488 | 1452 { |
1453 GaimConnection *gc; | |
1454 SilcGaim sg; | |
1455 SilcChannelEntry channel; | |
1456 char *silccmd, *silcargs, *msg, tmp[256]; | |
1457 const char *chname; | |
1458 | |
1459 gc = gaim_conversation_get_gc(conv); | |
1460 | |
1461 if (gc == NULL || !args || gc->proto_data == NULL) | |
1462 return GAIM_CMD_RET_FAILED; | |
1463 | |
1464 sg = gc->proto_data; | |
1465 | |
1466 if (args[0]) | |
1467 chname = args[0]; | |
1468 else | |
1469 chname = gaim_conversation_get_name(conv); | |
1470 | |
1471 if (!args[1]) { | |
1472 channel = silc_client_get_channel(sg->client, sg->conn, | |
1473 (char *)chname); | |
1474 if (!channel) { | |
1475 *error = g_strdup_printf(_("channel %s not found"), chname); | |
1476 return GAIM_CMD_RET_FAILED; | |
1477 } | |
1478 if (channel->mode) { | |
1479 silcgaim_get_chmode_string(channel->mode, tmp, sizeof(tmp)); | |
1480 msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); | |
1481 } else { | |
1482 msg = g_strdup_printf(_("no channel modes are set on %s"), chname); | |
1483 } | |
1484 gaim_conv_chat_write(GAIM_CONV_CHAT(conv), "", | |
1485 msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | |
1486 g_free(msg); | |
1487 return GAIM_CMD_RET_OK; | |
1488 } | |
1489 | |
1490 silcargs = g_strjoinv(" ", args); | |
1491 silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); | |
1492 g_free(silcargs); | |
1493 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { | |
1494 g_free(silccmd); | |
1495 *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); | |
1496 return GAIM_CMD_RET_FAILED; | |
1497 } | |
1498 g_free(silccmd); | |
1499 | |
1500 return GAIM_CMD_RET_OK; | |
1501 } | |
1502 | |
9353 | 1503 static GaimCmdRet silcgaim_cmd_generic(GaimConversation *conv, |
9597 | 1504 const char *cmd, char **args, char **error, void *data) |
9272 | 1505 { |
1506 GaimConnection *gc; | |
1507 SilcGaim sg; | |
9353 | 1508 char *silccmd, *silcargs; |
9272 | 1509 |
1510 gc = gaim_conversation_get_gc(conv); | |
1511 | |
1512 if (gc == NULL) | |
1513 return GAIM_CMD_RET_FAILED; | |
1514 | |
1515 sg = gc->proto_data; | |
1516 | |
1517 if (sg == NULL) | |
1518 return GAIM_CMD_RET_FAILED; | |
1519 | |
9353 | 1520 silcargs = g_strjoinv(" ", args); |
1521 silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); | |
1522 g_free(silcargs); | |
1523 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { | |
1524 g_free(silccmd); | |
9488 | 1525 *error = g_strdup_printf(_("Unknown command: %s, (may be a Gaim bug)"), cmd); |
9353 | 1526 return GAIM_CMD_RET_FAILED; |
1527 } | |
1528 g_free(silccmd); | |
9272 | 1529 |
1530 return GAIM_CMD_RET_OK; | |
1531 } | |
1532 | |
9359 | 1533 static GaimCmdRet silcgaim_cmd_quit(GaimConversation *conv, |
9597 | 1534 const char *cmd, char **args, char **error, void *data) |
9359 | 1535 { |
1536 GaimConnection *gc; | |
1537 SilcGaim sg; | |
1538 | |
1539 gc = gaim_conversation_get_gc(conv); | |
1540 | |
1541 if (gc == NULL) | |
1542 return GAIM_CMD_RET_FAILED; | |
1543 | |
1544 sg = gc->proto_data; | |
1545 | |
1546 if (sg == NULL) | |
1547 return GAIM_CMD_RET_FAILED; | |
1548 | |
1549 silc_client_command_call(sg->client, sg->conn, NULL, | |
1550 "QUIT", (args && args[0]) ? args[0] : "Download Gaim: " GAIM_WEBSITE, NULL); | |
1551 | |
1552 return GAIM_CMD_RET_OK; | |
1553 } | |
1554 | |
1555 static GaimCmdRet silcgaim_cmd_call(GaimConversation *conv, | |
9597 | 1556 const char *cmd, char **args, char **error, void *data) |
9359 | 1557 { |
1558 GaimConnection *gc; | |
1559 SilcGaim sg; | |
1560 | |
1561 gc = gaim_conversation_get_gc(conv); | |
1562 | |
1563 if (gc == NULL) | |
1564 return GAIM_CMD_RET_FAILED; | |
1565 | |
1566 sg = gc->proto_data; | |
1567 | |
1568 if (sg == NULL) | |
1569 return GAIM_CMD_RET_FAILED; | |
1570 | |
9488 | 1571 if (!silc_client_command_call(sg->client, sg->conn, args[0])) { |
1572 *error = g_strdup_printf(_("Unknown command: %s"), args[0]); | |
9359 | 1573 return GAIM_CMD_RET_FAILED; |
9488 | 1574 } |
9359 | 1575 |
1576 return GAIM_CMD_RET_OK; | |
1577 } | |
1578 | |
9030 | 1579 |
8849 | 1580 /************************** Plugin Initialization ****************************/ |
1581 | |
9272 | 1582 static void |
1583 silcgaim_register_commands(void) | |
1584 { | |
9353 | 1585 gaim_cmd_register("part", "w", GAIM_CMD_P_PRPL, |
1586 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | | |
1587 GAIM_CMD_FLAG_PRPL_ONLY | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, | |
9597 | 1588 "prpl-silc", silcgaim_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); |
9353 | 1589 gaim_cmd_register("leave", "w", GAIM_CMD_P_PRPL, |
1590 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | | |
1591 GAIM_CMD_FLAG_PRPL_ONLY | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, | |
9597 | 1592 "prpl-silc", silcgaim_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); |
9272 | 1593 gaim_cmd_register("topic", "s", GAIM_CMD_P_PRPL, |
1594 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1595 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
9597 | 1596 silcgaim_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); |
9272 | 1597 gaim_cmd_register("join", "ws", GAIM_CMD_P_PRPL, |
1598 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | | |
1599 GAIM_CMD_FLAG_PRPL_ONLY | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, | |
1600 "prpl-silc", silcgaim_cmd_chat_join, | |
9597 | 1601 _("join <channel> [<password>]: Join a chat on this network"), NULL); |
9272 | 1602 gaim_cmd_register("list", "", GAIM_CMD_P_PRPL, |
1603 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1604 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
9597 | 1605 silcgaim_cmd_chat_list, _("list: List channels on this network"), NULL); |
9272 | 1606 gaim_cmd_register("whois", "w", GAIM_CMD_P_PRPL, |
1607 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1608 "prpl-silc", | |
9597 | 1609 silcgaim_cmd_whois, _("whois <nick>: View nick's information"), NULL); |
9272 | 1610 gaim_cmd_register("msg", "ws", GAIM_CMD_P_PRPL, |
1611 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1612 "prpl-silc", silcgaim_cmd_msg, | |
9597 | 1613 _("msg <nick> <message>: Send a private message to a user"), NULL); |
9272 | 1614 gaim_cmd_register("query", "ws", GAIM_CMD_P_PRPL, |
1615 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1616 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_query, | |
9597 | 1617 _("query <nick> [<message>]: Send a private message to a user"), NULL); |
9272 | 1618 gaim_cmd_register("motd", "", GAIM_CMD_P_PRPL, |
1619 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1620 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_motd, | |
9597 | 1621 _("motd: View the server's Message Of The Day"), NULL); |
9272 | 1622 gaim_cmd_register("detach", "", GAIM_CMD_P_PRPL, |
9353 | 1623 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, |
1624 "prpl-silc", silcgaim_cmd_detach, | |
9597 | 1625 _("detach: Detach this session"), NULL); |
9359 | 1626 gaim_cmd_register("quit", "s", GAIM_CMD_P_PRPL, |
1627 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1628 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_quit, | |
9597 | 1629 _("quit [message]: Disconnect from the server, with an optional message"), NULL); |
9359 | 1630 gaim_cmd_register("call", "s", GAIM_CMD_P_PRPL, |
1631 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1632 "prpl-silc", silcgaim_cmd_call, | |
9597 | 1633 _("call <command>: Call any silc client command"), NULL); |
1634 /* These below just get passed through for the silc client library to deal | |
1635 * with */ | |
9359 | 1636 gaim_cmd_register("kill", "ws", GAIM_CMD_P_PRPL, |
1637 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1638 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1639 _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); |
9359 | 1640 gaim_cmd_register("nick", "w", GAIM_CMD_P_PRPL, |
1641 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1642 "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1643 _("nick <newnick>: Change your nickname"), NULL); |
9488 | 1644 gaim_cmd_register("whowas", "ww", GAIM_CMD_P_PRPL, |
9359 | 1645 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | |
1646 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1647 _("whowas <nick>: View nick's information"), NULL); |
9488 | 1648 gaim_cmd_register("cmode", "wws", GAIM_CMD_P_PRPL, |
1649 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1650 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_cmode, | |
9597 | 1651 _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); |
9359 | 1652 gaim_cmd_register("cumode", "wws", GAIM_CMD_P_PRPL, |
1653 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1654 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1655 _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); |
9272 | 1656 gaim_cmd_register("umode", "w", GAIM_CMD_P_PRPL, |
1657 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
9353 | 1658 "prpl-silc", silcgaim_cmd_generic, |
9597 | 1659 _("umode <usermodes>: Set your modes in the network"), NULL); |
9359 | 1660 gaim_cmd_register("oper", "s", GAIM_CMD_P_PRPL, |
1661 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1662 "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1663 _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); |
9359 | 1664 gaim_cmd_register("invite", "ws", GAIM_CMD_P_PRPL, |
1665 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1666 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1667 _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); |
9359 | 1668 gaim_cmd_register("kick", "wws", GAIM_CMD_P_PRPL, |
1669 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1670 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1671 _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); |
9488 | 1672 gaim_cmd_register("info", "w", GAIM_CMD_P_PRPL, |
9359 | 1673 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | |
1674 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1675 _("info [server]: View server administrative details"), NULL); |
9359 | 1676 gaim_cmd_register("ban", "ww", GAIM_CMD_P_PRPL, |
1677 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1678 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1679 _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); |
9488 | 1680 gaim_cmd_register("getkey", "w", GAIM_CMD_P_PRPL, |
1681 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1682 "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1683 _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); |
9488 | 1684 gaim_cmd_register("stats", "", GAIM_CMD_P_PRPL, |
1685 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1686 "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1687 _("stats: View server and network statistics"), NULL); |
9359 | 1688 gaim_cmd_register("ping", "", GAIM_CMD_P_PRPL, |
1689 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1690 "prpl-silc", silcgaim_cmd_generic, | |
9597 | 1691 _("ping: Send PING to the connected server"), NULL); |
9488 | 1692 #if 0 /* Gaim doesn't handle these yet */ |
1693 gaim_cmd_register("users", "w", GAIM_CMD_P_PRPL, | |
1694 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
1695 "prpl-silc", silcgaim_cmd_users, | |
1696 _("users <channel>: List users in channel")); | |
1697 gaim_cmd_register("names", "ww", GAIM_CMD_P_PRPL, | |
1698 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
1699 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_names, | |
1700 _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); | |
9359 | 1701 #endif |
9272 | 1702 } |
1703 | |
12058 | 1704 static GaimWhiteboardPrplOps silcgaim_wb_ops = |
1705 { | |
1706 silcgaim_wb_start, | |
1707 silcgaim_wb_end, | |
1708 silcgaim_wb_get_dimensions, | |
1709 silcgaim_wb_set_dimensions, | |
1710 silcgaim_wb_get_brush, | |
1711 silcgaim_wb_set_brush, | |
1712 silcgaim_wb_send, | |
1713 silcgaim_wb_clear, | |
1714 }; | |
1715 | |
8849 | 1716 static GaimPluginProtocolInfo prpl_info = |
1717 { | |
12217 | 1718 #ifdef HAVE_SILCMIME_H |
1719 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | | |
1720 OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE, | |
1721 #else | |
8849 | 1722 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | |
1723 OPT_PROTO_PASSWORD_OPTIONAL, | |
12217 | 1724 #endif |
9488 | 1725 NULL, /* user_splits */ |
1726 NULL, /* protocol_options */ | |
1727 NO_BUDDY_ICONS, /* icon_spec */ | |
1728 silcgaim_list_icon, /* list_icon */ | |
1729 silcgaim_list_emblems, /* list_emblems */ | |
1730 silcgaim_status_text, /* status_text */ | |
1731 silcgaim_tooltip_text, /* tooltip_text */ | |
1732 silcgaim_away_states, /* away_states */ | |
1733 silcgaim_blist_node_menu, /* blist_node_menu */ | |
1734 silcgaim_chat_info, /* chat_info */ | |
9754 | 1735 silcgaim_chat_info_defaults,/* chat_info_defaults */ |
9488 | 1736 silcgaim_login, /* login */ |
1737 silcgaim_close, /* close */ | |
1738 silcgaim_send_im, /* send_im */ | |
1739 silcgaim_set_info, /* set_info */ | |
1740 NULL, /* send_typing */ | |
1741 silcgaim_get_info, /* get_info */ | |
9968 | 1742 silcgaim_set_status, /* set_status */ |
9488 | 1743 silcgaim_idle_set, /* set_idle */ |
1744 silcgaim_change_passwd, /* change_passwd */ | |
1745 silcgaim_add_buddy, /* add_buddy */ | |
10869 | 1746 NULL, /* add_buddies */ |
9488 | 1747 silcgaim_remove_buddy, /* remove_buddy */ |
1748 NULL, /* remove_buddies */ | |
1749 NULL, /* add_permit */ | |
1750 NULL, /* add_deny */ | |
1751 NULL, /* rem_permit */ | |
1752 NULL, /* rem_deny */ | |
1753 NULL, /* set_permit_deny */ | |
1754 silcgaim_chat_join, /* join_chat */ | |
1755 NULL, /* reject_chat */ | |
9917 | 1756 silcgaim_get_chat_name, /* get_chat_name */ |
9488 | 1757 silcgaim_chat_invite, /* chat_invite */ |
1758 silcgaim_chat_leave, /* chat_leave */ | |
1759 NULL, /* chat_whisper */ | |
1760 silcgaim_chat_send, /* chat_send */ | |
1761 silcgaim_keepalive, /* keepalive */ | |
1762 NULL, /* register_user */ | |
1763 NULL, /* get_cb_info */ | |
1764 NULL, /* get_cb_away */ | |
1765 NULL, /* alias_buddy */ | |
1766 NULL, /* group_buddy */ | |
1767 NULL, /* rename_group */ | |
1768 NULL, /* buddy_free */ | |
1769 NULL, /* convo_closed */ | |
1770 NULL, /* normalize */ | |
1771 NULL, /* set_buddy_icon */ | |
1772 NULL, /* remove_group */ | |
1773 NULL, /* get_cb_real_name */ | |
1774 silcgaim_chat_set_topic, /* set_chat_topic */ | |
1775 NULL, /* find_blist_chat */ | |
1776 silcgaim_roomlist_get_list, /* roomlist_get_list */ | |
1777 silcgaim_roomlist_cancel, /* roomlist_cancel */ | |
1778 NULL, /* roomlist_expand_category */ | |
1779 NULL, /* can_receive_file */ | |
12058 | 1780 silcgaim_ftp_send_file, /* send_file */ |
12143
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
12130
diff
changeset
|
1781 silcgaim_ftp_new_xfer, /* new_xfer */ |
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
12130
diff
changeset
|
1782 &silcgaim_wb_ops, /* whiteboard operations */ |
8849 | 1783 }; |
1784 | |
1785 static GaimPluginInfo info = | |
1786 { | |
9943 | 1787 GAIM_PLUGIN_MAGIC, |
1788 GAIM_MAJOR_VERSION, | |
1789 GAIM_MINOR_VERSION, | |
8849 | 1790 GAIM_PLUGIN_PROTOCOL, /**< type */ |
1791 NULL, /**< ui_requirement */ | |
1792 0, /**< flags */ | |
1793 NULL, /**< dependencies */ | |
1794 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
1795 | |
1796 "prpl-silc", /**< id */ | |
1797 "SILC", /**< name */ | |
1798 "1.0", /**< version */ | |
1799 /** summary */ | |
1800 N_("SILC Protocol Plugin"), | |
1801 /** description */ | |
1802 N_("Secure Internet Live Conferencing (SILC) Protocol"), | |
8891 | 1803 "Pekka Riikonen", /**< author */ |
1804 "http://silcnet.org/", /**< homepage */ | |
8849 | 1805 |
1806 NULL, /**< load */ | |
1807 NULL, /**< unload */ | |
1808 NULL, /**< destroy */ | |
1809 | |
1810 NULL, /**< ui_info */ | |
1811 &prpl_info, /**< extra_info */ | |
12167 | 1812 NULL, /**< prefs_info */ |
9015 | 1813 silcgaim_actions |
8849 | 1814 }; |
1815 | |
1816 static void | |
1817 init_plugin(GaimPlugin *plugin) | |
1818 { | |
1819 GaimAccountOption *option; | |
10825 | 1820 GaimAccountUserSplit *split; |
8849 | 1821 char tmp[256]; |
12217 | 1822 int i; |
1823 GaimKeyValuePair *kvp; | |
1824 GList *list = NULL; | |
8849 | 1825 |
1826 silc_plugin = plugin; | |
1827 | |
10825 | 1828 split = gaim_account_user_split_new(_("Network"), "silcnet.org", '@'); |
1829 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); | |
1830 | |
8849 | 1831 /* Account options */ |
1832 option = gaim_account_option_string_new(_("Connect server"), | |
1833 "server", | |
1834 "silc.silcnet.org"); | |
1835 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1836 option = gaim_account_option_int_new(_("Port"), "port", 706); | |
1837 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
10825 | 1838 g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcgaim_silcdir()); |
1839 option = gaim_account_option_string_new(_("Public Key file"), | |
1840 "public-key", tmp); | |
1841 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1842 g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcgaim_silcdir()); | |
1843 option = gaim_account_option_string_new(_("Private Key file"), | |
1844 "private-key", tmp); | |
1845 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
12217 | 1846 |
1847 for (i = 0; silc_default_ciphers[i].name; i++) { | |
1848 kvp = silc_calloc(1, sizeof(*kvp)); | |
1849 kvp->key = strdup(silc_default_ciphers[i].name); | |
1850 kvp->value = strdup(silc_default_ciphers[i].name); | |
1851 list = g_list_append(list, kvp); | |
1852 } | |
1853 option = gaim_account_option_list_new(_("Cipher"), "cipher", list); | |
1854 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1855 | |
1856 list = NULL; | |
1857 for (i = 0; silc_default_hmacs[i].name; i++) { | |
1858 kvp = silc_calloc(1, sizeof(*kvp)); | |
1859 kvp->key = strdup(silc_default_hmacs[i].name); | |
1860 kvp->value = strdup(silc_default_hmacs[i].name); | |
1861 list = g_list_append(list, kvp); | |
1862 } | |
1863 option = gaim_account_option_list_new(_("HMAC"), "hmac", list); | |
1864 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1865 | |
8849 | 1866 option = gaim_account_option_bool_new(_("Public key authentication"), |
1867 "pubkey-auth", FALSE); | |
1868 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1869 option = gaim_account_option_bool_new(_("Reject watching by other users"), | |
1870 "reject-watch", FALSE); | |
1871 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1872 option = gaim_account_option_bool_new(_("Block invites"), | |
1873 "block-invites", FALSE); | |
1874 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1875 option = gaim_account_option_bool_new(_("Block IMs without Key Exchange"), | |
1876 "block-ims", FALSE); | |
1877 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1878 option = gaim_account_option_bool_new(_("Reject online status attribute requests"), | |
1879 "reject-attrs", FALSE); | |
1880 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
12167 | 1881 option = gaim_account_option_bool_new(_("Block messages to whiteboard"), |
1882 "block-wb", FALSE); | |
1883 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1884 option = gaim_account_option_bool_new(_("Automatically open whiteboard"), | |
1885 "open-wb", FALSE); | |
1886 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1887 option = gaim_account_option_bool_new(_("Digitally sign and verify all messages"), | |
1888 "sign-verify", FALSE); | |
1889 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
8849 | 1890 |
12167 | 1891 gaim_prefs_remove("/plugins/prpl/silc"); |
9272 | 1892 |
1893 silcgaim_register_commands(); | |
9353 | 1894 |
1895 #ifdef _WIN32 | |
1896 silc_net_win32_init(); | |
1897 #endif | |
8849 | 1898 } |
1899 | |
1900 GAIM_INIT_PLUGIN(silc, init_plugin, info); |