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