Thu, 07 Apr 2005 14:55:02 +0000
[gaim-migrate @ 12431]
" The following log snippets should explain it: " --rlaager
(20:24:00) rlaager: Regarding the signal handling
conversation the other day... I've written a patch to stop
calling signal handlers and return as soon as we find one
signal handler that returns TRUE to indicate that it's
handled the signal. Is this the right approach?
(20:24:22) Ethan Blanton (Paco-Paco): the trouble is that it's
documented to behave exactly the way it does
(20:24:31) Ethan Blanton (Paco-Paco): so changing it is
notbackwards compatible
(20:24:31) rlaager: I'm talking for HEAD.
(20:24:41) Ethan Blanton (Paco-Paco): oh, I think that's a
good approach, yes
(20:24:53) rlaager: The way I've described is how I
*expected* it to work, having not read the documentation.
(20:25:09) Ethan Blanton (Paco-Paco): I'm convinced
(20:27:04) Stu Tomlinson (nosnilmot): rlaager: this, I
assume, breaks the generic-ness of signals, by assuming
that any that return values return booleans?
(20:27:26) Ethan Blanton (Paco-Paco): please break it
(20:27:33) Ethan Blanton (Paco-Paco): we already have
out-parameters
(20:27:42) rlaager: nosnilmot: from what I can see, the
return type is handled as a (void *)... so I'm checking that
ret_value != NULL
(20:27:57) rlaager: nosnilmot: that's the correct way to do it,
right?
...
(20:29:01) Ethan Blanton (Paco-Paco): allowing a
meaningful return value is an over-engineering
(20:30:07) rlaager: even after this patch, you should be able
to return meaningful return values
(20:30:15) rlaager: it'll just short-circuit on the first handler
that does
committer: Luke Schierer <lschiere@pidgin.im>
| 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 | |
|
10401
51ae616ff395
[gaim-migrate @ 11638]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10341
diff
changeset
|
246 | silcgaim_login(GaimAccount *account, GaimStatus *status) |
| 8849 | 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"), | |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10732
diff
changeset
|
306 | (gc->password == NULL) ? "" : gc->password, &client->pkcs, |
| 9272 | 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 | { | |
| 352 | SilcGaim sg = gc->proto_data; | |
| 353 | ||
|
10547
61f5540fc15a
[gaim-migrate @ 11917]
Mark Doliner <markdoliner@pidgin.im>
parents:
10516
diff
changeset
|
354 | g_return_if_fail(sg != NULL); |
| 8849 | 355 | |
| 356 | /* Send QUIT */ | |
| 357 | silc_client_command_call(sg->client, sg->conn, NULL, | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
358 | "QUIT", "Download Gaim: " GAIM_WEBSITE, NULL); |
| 8849 | 359 | |
| 360 | if (sg->conn) | |
| 361 | silc_client_close_connection(sg->client, sg->conn); | |
| 362 | ||
| 363 | g_source_remove(sg->scheduler); | |
| 364 | g_timeout_add(1, (GSourceFunc)silcgaim_close_final, sg); | |
| 365 | } | |
| 366 | ||
| 367 | ||
| 368 | /****************************** Protocol Actions *****************************/ | |
| 369 | ||
| 370 | static void | |
| 371 | silcgaim_attrs_cancel(GaimConnection *gc, GaimRequestFields *fields) | |
| 372 | { | |
| 373 | /* Nothing */ | |
| 374 | } | |
| 375 | ||
| 376 | static void | |
| 377 | silcgaim_attrs_cb(GaimConnection *gc, GaimRequestFields *fields) | |
| 378 | { | |
| 379 | SilcGaim sg = gc->proto_data; | |
| 380 | SilcClient client = sg->client; | |
| 381 | SilcClientConnection conn = sg->conn; | |
| 382 | GaimRequestField *f; | |
| 383 | char *tmp; | |
| 384 | SilcUInt32 tmp_len, mask; | |
| 385 | SilcAttributeObjService service; | |
| 386 | SilcAttributeObjDevice dev; | |
| 387 | SilcVCardStruct vcard; | |
| 388 | const char *val; | |
| 389 | ||
| 390 | sg = gc->proto_data; | |
| 391 | if (!sg) | |
| 392 | return; | |
| 393 | ||
| 394 | memset(&service, 0, sizeof(service)); | |
| 395 | memset(&dev, 0, sizeof(dev)); | |
| 396 | memset(&vcard, 0, sizeof(vcard)); | |
| 397 | ||
| 398 | silc_client_attribute_del(client, conn, | |
| 399 | SILC_ATTRIBUTE_USER_INFO, NULL); | |
| 400 | silc_client_attribute_del(client, conn, | |
| 401 | SILC_ATTRIBUTE_SERVICE, NULL); | |
| 402 | silc_client_attribute_del(client, conn, | |
| 403 | SILC_ATTRIBUTE_STATUS_MOOD, NULL); | |
| 404 | silc_client_attribute_del(client, conn, | |
| 405 | SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); | |
| 406 | silc_client_attribute_del(client, conn, | |
| 407 | SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); | |
| 408 | silc_client_attribute_del(client, conn, | |
| 409 | SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); | |
| 410 | silc_client_attribute_del(client, conn, | |
| 411 | SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); | |
| 412 | silc_client_attribute_del(client, conn, | |
| 413 | SILC_ATTRIBUTE_TIMEZONE, NULL); | |
| 414 | silc_client_attribute_del(client, conn, | |
| 415 | SILC_ATTRIBUTE_GEOLOCATION, NULL); | |
| 416 | silc_client_attribute_del(client, conn, | |
| 417 | SILC_ATTRIBUTE_DEVICE_INFO, NULL); | |
| 418 | ||
| 419 | /* Set mood */ | |
| 420 | mask = 0; | |
| 421 | f = gaim_request_fields_get_field(fields, "mood_normal"); | |
| 422 | if (f && gaim_request_field_bool_get_value(f)) | |
| 423 | mask |= SILC_ATTRIBUTE_MOOD_NORMAL; | |
| 424 | f = gaim_request_fields_get_field(fields, "mood_happy"); | |
| 425 | if (f && gaim_request_field_bool_get_value(f)) | |
| 426 | mask |= SILC_ATTRIBUTE_MOOD_HAPPY; | |
| 427 | f = gaim_request_fields_get_field(fields, "mood_sad"); | |
| 428 | if (f && gaim_request_field_bool_get_value(f)) | |
| 429 | mask |= SILC_ATTRIBUTE_MOOD_SAD; | |
| 430 | f = gaim_request_fields_get_field(fields, "mood_angry"); | |
| 431 | if (f && gaim_request_field_bool_get_value(f)) | |
| 432 | mask |= SILC_ATTRIBUTE_MOOD_ANGRY; | |
| 433 | f = gaim_request_fields_get_field(fields, "mood_jealous"); | |
| 434 | if (f && gaim_request_field_bool_get_value(f)) | |
| 435 | mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; | |
| 436 | f = gaim_request_fields_get_field(fields, "mood_ashamed"); | |
| 437 | if (f && gaim_request_field_bool_get_value(f)) | |
| 438 | mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; | |
| 439 | f = gaim_request_fields_get_field(fields, "mood_invincible"); | |
| 440 | if (f && gaim_request_field_bool_get_value(f)) | |
| 441 | mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; | |
| 442 | f = gaim_request_fields_get_field(fields, "mood_inlove"); | |
| 443 | if (f && gaim_request_field_bool_get_value(f)) | |
| 444 | mask |= SILC_ATTRIBUTE_MOOD_INLOVE; | |
| 445 | f = gaim_request_fields_get_field(fields, "mood_sleepy"); | |
| 446 | if (f && gaim_request_field_bool_get_value(f)) | |
| 447 | mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; | |
| 448 | f = gaim_request_fields_get_field(fields, "mood_bored"); | |
| 449 | if (f && gaim_request_field_bool_get_value(f)) | |
| 450 | mask |= SILC_ATTRIBUTE_MOOD_BORED; | |
| 451 | f = gaim_request_fields_get_field(fields, "mood_excited"); | |
| 452 | if (f && gaim_request_field_bool_get_value(f)) | |
| 453 | mask |= SILC_ATTRIBUTE_MOOD_EXCITED; | |
| 454 | f = gaim_request_fields_get_field(fields, "mood_anxious"); | |
| 455 | if (f && gaim_request_field_bool_get_value(f)) | |
| 456 | mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; | |
| 457 | silc_client_attribute_add(client, conn, | |
| 458 | SILC_ATTRIBUTE_STATUS_MOOD, | |
| 459 | SILC_32_TO_PTR(mask), | |
| 460 | sizeof(SilcUInt32)); | |
| 461 | ||
| 462 | /* Set preferred contact */ | |
| 463 | mask = 0; | |
| 464 | f = gaim_request_fields_get_field(fields, "contact_chat"); | |
| 465 | if (f && gaim_request_field_bool_get_value(f)) | |
| 466 | mask |= SILC_ATTRIBUTE_CONTACT_CHAT; | |
| 467 | f = gaim_request_fields_get_field(fields, "contact_email"); | |
| 468 | if (f && gaim_request_field_bool_get_value(f)) | |
| 469 | mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; | |
| 470 | f = gaim_request_fields_get_field(fields, "contact_call"); | |
| 471 | if (f && gaim_request_field_bool_get_value(f)) | |
| 472 | mask |= SILC_ATTRIBUTE_CONTACT_CALL; | |
| 473 | f = gaim_request_fields_get_field(fields, "contact_sms"); | |
| 474 | if (f && gaim_request_field_bool_get_value(f)) | |
| 475 | mask |= SILC_ATTRIBUTE_CONTACT_SMS; | |
| 476 | f = gaim_request_fields_get_field(fields, "contact_mms"); | |
| 477 | if (f && gaim_request_field_bool_get_value(f)) | |
| 478 | mask |= SILC_ATTRIBUTE_CONTACT_MMS; | |
| 479 | f = gaim_request_fields_get_field(fields, "contact_video"); | |
| 480 | if (f && gaim_request_field_bool_get_value(f)) | |
| 481 | mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; | |
| 482 | if (mask) | |
| 483 | silc_client_attribute_add(client, conn, | |
| 484 | SILC_ATTRIBUTE_PREFERRED_CONTACT, | |
| 485 | SILC_32_TO_PTR(mask), | |
| 486 | sizeof(SilcUInt32)); | |
| 487 | ||
| 488 | /* Set status text */ | |
| 489 | val = NULL; | |
| 490 | f = gaim_request_fields_get_field(fields, "status_text"); | |
| 491 | if (f) | |
| 492 | val = gaim_request_field_string_get_value(f); | |
| 493 | if (val && *val) | |
| 494 | silc_client_attribute_add(client, conn, | |
| 495 | SILC_ATTRIBUTE_STATUS_FREETEXT, | |
| 496 | (void *)val, strlen(val)); | |
| 497 | ||
| 498 | /* Set vcard */ | |
| 499 | val = NULL; | |
| 500 | f = gaim_request_fields_get_field(fields, "vcard"); | |
| 501 | if (f) | |
| 502 | val = gaim_request_field_string_get_value(f); | |
| 503 | if (val && *val) { | |
| 504 | gaim_prefs_set_string("/plugins/prpl/silc/vcard", val); | |
| 505 | tmp = silc_file_readfile(val, &tmp_len); | |
| 506 | if (tmp) { | |
| 507 | tmp[tmp_len] = 0; | |
| 508 | if (silc_vcard_decode(tmp, tmp_len, &vcard)) | |
| 509 | silc_client_attribute_add(client, conn, | |
| 510 | SILC_ATTRIBUTE_USER_INFO, | |
| 511 | (void *)&vcard, | |
| 512 | sizeof(vcard)); | |
| 513 | } | |
| 514 | silc_vcard_free(&vcard); | |
| 515 | silc_free(tmp); | |
| 516 | } | |
| 517 | ||
| 518 | #ifdef HAVE_SYS_UTSNAME_H | |
| 519 | /* Set device info */ | |
| 520 | f = gaim_request_fields_get_field(fields, "device"); | |
| 521 | if (f && gaim_request_field_bool_get_value(f)) { | |
| 522 | struct utsname u; | |
| 523 | if (!uname(&u)) { | |
| 524 | dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; | |
| 525 | dev.version = u.release; | |
| 526 | dev.model = u.sysname; | |
| 527 | silc_client_attribute_add(client, conn, | |
| 528 | SILC_ATTRIBUTE_DEVICE_INFO, | |
| 529 | (void *)&dev, sizeof(dev)); | |
| 530 | } | |
| 531 | } | |
| 532 | #endif | |
| 533 | ||
| 534 | /* Set timezone */ | |
| 535 | val = NULL; | |
| 536 | f = gaim_request_fields_get_field(fields, "timezone"); | |
| 537 | if (f) | |
| 538 | val = gaim_request_field_string_get_value(f); | |
| 539 | if (val && *val) | |
| 540 | silc_client_attribute_add(client, conn, | |
| 541 | SILC_ATTRIBUTE_TIMEZONE, | |
| 542 | (void *)val, strlen(val)); | |
| 543 | } | |
| 544 | ||
| 545 | static void | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
546 | silcgaim_attrs(GaimPluginAction *action) |
| 8849 | 547 | { |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
548 | GaimConnection *gc = (GaimConnection *) action->context; |
| 8849 | 549 | SilcGaim sg = gc->proto_data; |
| 550 | SilcClient client = sg->client; | |
| 551 | SilcClientConnection conn = sg->conn; | |
| 552 | GaimRequestFields *fields; | |
| 553 | GaimRequestFieldGroup *g; | |
| 554 | GaimRequestField *f; | |
| 555 | SilcHashTable attrs; | |
| 556 | SilcAttributePayload attr; | |
| 557 | gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, | |
| 558 | mangry = FALSE, mjealous = FALSE, mashamed = FALSE, | |
| 559 | minvincible = FALSE, minlove = FALSE, msleepy = FALSE, | |
| 560 | mbored = FALSE, mexcited = FALSE, manxious = FALSE; | |
| 561 | gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, | |
| 562 | cmms = FALSE, cchat = TRUE, cvideo = FALSE; | |
| 563 | gboolean device = TRUE; | |
| 564 | char status[1024]; | |
| 565 | ||
| 566 | sg = gc->proto_data; | |
| 567 | if (!sg) | |
| 568 | return; | |
| 569 | ||
| 570 | memset(status, 0, sizeof(status)); | |
| 571 | ||
| 572 | attrs = silc_client_attributes_get(client, conn); | |
| 573 | if (attrs) { | |
| 574 | if (silc_hash_table_find(attrs, | |
| 575 | SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), | |
| 576 | NULL, (void *)&attr)) { | |
| 577 | SilcUInt32 mood = 0; | |
| 578 | silc_attribute_get_object(attr, &mood, sizeof(mood)); | |
| 579 | mnormal = !mood; | |
| 580 | mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); | |
| 581 | msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); | |
| 582 | mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); | |
| 583 | mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); | |
| 584 | mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); | |
| 585 | minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); | |
| 586 | minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); | |
| 587 | msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); | |
| 588 | mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); | |
| 589 | mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); | |
| 590 | manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); | |
| 591 | } | |
| 592 | ||
| 593 | if (silc_hash_table_find(attrs, | |
| 594 | SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), | |
| 595 | NULL, (void *)&attr)) { | |
| 596 | SilcUInt32 contact = 0; | |
| 597 | silc_attribute_get_object(attr, &contact, sizeof(contact)); | |
| 598 | cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); | |
| 599 | ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); | |
| 600 | csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); | |
| 601 | cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); | |
| 602 | cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); | |
| 603 | cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); | |
| 604 | } | |
| 605 | ||
| 606 | if (silc_hash_table_find(attrs, | |
| 607 | SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), | |
| 608 | NULL, (void *)&attr)) | |
| 609 | silc_attribute_get_object(attr, &status, sizeof(status)); | |
| 610 | ||
| 611 | if (!silc_hash_table_find(attrs, | |
| 612 | SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), | |
| 613 | NULL, (void *)&attr)) | |
| 614 | device = FALSE; | |
| 615 | } | |
| 616 | ||
| 617 | fields = gaim_request_fields_new(); | |
| 618 | ||
| 619 | g = gaim_request_field_group_new(NULL); | |
| 620 | f = gaim_request_field_label_new("l3", _("Your Current Mood")); | |
| 621 | gaim_request_field_group_add_field(g, f); | |
| 622 | f = gaim_request_field_bool_new("mood_normal", _("Normal"), mnormal); | |
| 623 | gaim_request_field_group_add_field(g, f); | |
| 624 | f = gaim_request_field_bool_new("mood_happy", _("Happy"), mhappy); | |
| 625 | gaim_request_field_group_add_field(g, f); | |
| 626 | f = gaim_request_field_bool_new("mood_sad", _("Sad"), msad); | |
| 627 | gaim_request_field_group_add_field(g, f); | |
| 628 | f = gaim_request_field_bool_new("mood_angry", _("Angry"), mangry); | |
| 629 | gaim_request_field_group_add_field(g, f); | |
| 630 | f = gaim_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); | |
| 631 | gaim_request_field_group_add_field(g, f); | |
| 632 | f = gaim_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); | |
| 633 | gaim_request_field_group_add_field(g, f); | |
| 634 | f = gaim_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); | |
| 635 | gaim_request_field_group_add_field(g, f); | |
| 636 | f = gaim_request_field_bool_new("mood_inlove", _("In Love"), minlove); | |
| 637 | gaim_request_field_group_add_field(g, f); | |
| 638 | f = gaim_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); | |
| 639 | gaim_request_field_group_add_field(g, f); | |
| 640 | f = gaim_request_field_bool_new("mood_bored", _("Bored"), mbored); | |
| 641 | gaim_request_field_group_add_field(g, f); | |
| 642 | f = gaim_request_field_bool_new("mood_excited", _("Excited"), mexcited); | |
| 643 | gaim_request_field_group_add_field(g, f); | |
| 644 | f = gaim_request_field_bool_new("mood_anxious", _("Anxious"), manxious); | |
| 645 | gaim_request_field_group_add_field(g, f); | |
| 646 | ||
| 647 | f = gaim_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); | |
| 648 | gaim_request_field_group_add_field(g, f); | |
| 649 | f = gaim_request_field_bool_new("contact_chat", _("Chat"), cchat); | |
| 650 | gaim_request_field_group_add_field(g, f); | |
| 651 | f = gaim_request_field_bool_new("contact_email", _("Email"), cemail); | |
| 652 | gaim_request_field_group_add_field(g, f); | |
| 653 | f = gaim_request_field_bool_new("contact_call", _("Phone"), ccall); | |
| 654 | gaim_request_field_group_add_field(g, f); | |
| 655 | f = gaim_request_field_bool_new("contact_sms", _("SMS"), csms); | |
| 656 | gaim_request_field_group_add_field(g, f); | |
| 657 | f = gaim_request_field_bool_new("contact_mms", _("MMS"), cmms); | |
| 658 | gaim_request_field_group_add_field(g, f); | |
| 659 | f = gaim_request_field_bool_new("contact_video", _("Video Conferencing"), cvideo); | |
| 660 | gaim_request_field_group_add_field(g, f); | |
| 661 | gaim_request_fields_add_group(fields, g); | |
| 662 | ||
| 663 | g = gaim_request_field_group_new(NULL); | |
| 664 | f = gaim_request_field_string_new("status_text", _("Your Current Status"), | |
| 665 | status[0] ? status : NULL, TRUE); | |
| 666 | gaim_request_field_group_add_field(g, f); | |
| 667 | gaim_request_fields_add_group(fields, g); | |
| 668 | ||
| 669 | g = gaim_request_field_group_new(NULL); | |
| 670 | #if 0 | |
| 671 | f = gaim_request_field_label_new("l2", _("Online Services")); | |
| 672 | gaim_request_field_group_add_field(g, f); | |
| 673 | f = gaim_request_field_bool_new("services", | |
| 674 | _("Let others see what services you are using"), | |
| 675 | TRUE); | |
| 676 | gaim_request_field_group_add_field(g, f); | |
| 677 | #endif | |
| 678 | #ifdef HAVE_SYS_UTSNAME_H | |
| 679 | f = gaim_request_field_bool_new("device", | |
| 680 | _("Let others see what computer you are using"), | |
| 681 | device); | |
| 682 | gaim_request_field_group_add_field(g, f); | |
| 683 | #endif | |
| 684 | gaim_request_fields_add_group(fields, g); | |
| 685 | ||
| 686 | g = gaim_request_field_group_new(NULL); | |
| 687 | f = gaim_request_field_string_new("vcard", _("Your VCard File"), | |
| 688 | gaim_prefs_get_string("/plugins/prpl/silc/vcard"), | |
| 689 | FALSE); | |
| 690 | gaim_request_field_group_add_field(g, f); | |
| 691 | #ifdef _WIN32 | |
| 692 | f = gaim_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE); | |
| 693 | #else | |
| 694 | f = gaim_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE); | |
| 695 | #endif | |
| 696 | gaim_request_field_group_add_field(g, f); | |
| 697 | gaim_request_fields_add_group(fields, g); | |
| 698 | ||
| 699 | ||
| 700 | gaim_request_fields(NULL, _("User Online Status Attributes"), | |
| 701 | _("User Online Status Attributes"), | |
| 702 | _("You can let other users see your online status information " | |
| 703 | "and your personal information. Please fill the information " | |
| 704 | "you would like other users to see about yourself."), | |
| 705 | fields, | |
| 8906 | 706 | _("OK"), G_CALLBACK(silcgaim_attrs_cb), |
| 707 | _("Cancel"), G_CALLBACK(silcgaim_attrs_cancel), gc); | |
| 8849 | 708 | } |
| 709 | ||
| 710 | static void | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
711 | silcgaim_detach(GaimPluginAction *action) |
| 8849 | 712 | { |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
713 | GaimConnection *gc = (GaimConnection *) action->context; |
| 8849 | 714 | SilcGaim sg; |
| 715 | ||
| 716 | if (!gc) | |
| 717 | return; | |
| 718 | sg = gc->proto_data; | |
| 719 | if (!sg) | |
| 720 | return; | |
| 721 | ||
| 722 | /* Call DETACH */ | |
| 723 | silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
| 724 | sg->detaching = TRUE; | |
| 725 | } | |
| 726 | ||
| 727 | static void | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
728 | silcgaim_view_motd(GaimPluginAction *action) |
| 8849 | 729 | { |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
730 | GaimConnection *gc = (GaimConnection *) action->context; |
| 8849 | 731 | SilcGaim sg; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
732 | char *tmp; |
| 8849 | 733 | |
| 734 | if (!gc) | |
| 735 | return; | |
| 736 | sg = gc->proto_data; | |
| 737 | if (!sg) | |
| 738 | return; | |
| 739 | ||
| 740 | if (!sg->motd) { | |
| 741 | gaim_notify_error( | |
| 742 | gc, _("Message of the Day"), _("No Message of the Day available"), | |
| 743 | _("There is no Message of the Day associated with this connection")); | |
| 744 | return; | |
| 745 | } | |
| 746 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
747 | tmp = g_markup_escape_text(sg->motd, -1); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
748 | gaim_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
749 | tmp, NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
750 | g_free(tmp); |
| 8849 | 751 | } |
| 752 | ||
| 9272 | 753 | static void |
| 754 | silcgaim_change_pass(GaimPluginAction *action) | |
| 755 | { | |
| 756 | GaimConnection *gc = (GaimConnection *) action->context; | |
| 757 | gaim_account_request_change_password(gaim_connection_get_account(gc)); | |
| 758 | } | |
| 759 | ||
| 760 | static void | |
| 761 | silcgaim_change_passwd(GaimConnection *gc, const char *old, const char *new) | |
| 762 | { | |
| 763 | silc_change_private_key_passphrase(gaim_prefs_get_string("/plugins/prpl/silc/privkey"), old, new); | |
| 764 | } | |
| 765 | ||
| 766 | static void | |
| 767 | silcgaim_show_set_info(GaimPluginAction *action) | |
| 768 | { | |
| 769 | GaimConnection *gc = (GaimConnection *) action->context; | |
| 770 | gaim_account_request_change_user_info(gaim_connection_get_account(gc)); | |
| 771 | } | |
| 772 | ||
| 773 | static void | |
| 774 | silcgaim_set_info(GaimConnection *gc, const char *text) | |
| 775 | { | |
| 776 | } | |
| 777 | ||
| 8849 | 778 | static GList * |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
779 | silcgaim_actions(GaimPlugin *plugin, gpointer context) |
| 8849 | 780 | { |
| 9024 | 781 | GaimConnection *gc = context; |
| 8849 | 782 | GList *list = NULL; |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
783 | GaimPluginAction *act; |
| 8849 | 784 | |
| 785 | 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
|
786 | act = gaim_plugin_action_new(_("Online Status"), |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
787 | silcgaim_attrs); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
788 | list = g_list_append(list, act); |
| 8849 | 789 | } |
| 790 | ||
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
791 | act = gaim_plugin_action_new(_("Detach From Server"), |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
792 | silcgaim_detach); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
793 | list = g_list_append(list, act); |
| 8849 | 794 | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
795 | act = gaim_plugin_action_new(_("View Message of the Day"), |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
796 | silcgaim_view_motd); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
797 | list = g_list_append(list, act); |
| 8849 | 798 | |
| 9272 | 799 | act = gaim_plugin_action_new(_("Change Password..."), |
| 800 | silcgaim_change_pass); | |
| 801 | list = g_list_append(list, act); | |
| 802 | ||
| 803 | act = gaim_plugin_action_new(_("Set User Info..."), | |
| 804 | silcgaim_show_set_info); | |
| 805 | list = g_list_append(list, act); | |
| 806 | ||
| 8849 | 807 | return list; |
| 808 | } | |
| 809 | ||
| 810 | ||
| 811 | /******************************* IM Routines *********************************/ | |
| 812 | ||
| 813 | typedef struct { | |
| 814 | char *nick; | |
| 815 | unsigned char *message; | |
| 816 | SilcUInt32 message_len; | |
| 817 | SilcMessageFlags flags; | |
| 818 | } *SilcGaimIM; | |
| 819 | ||
| 820 | static void | |
| 821 | silcgaim_send_im_resolved(SilcClient client, | |
| 822 | SilcClientConnection conn, | |
| 823 | SilcClientEntry *clients, | |
| 824 | SilcUInt32 clients_count, | |
| 825 | void *context) | |
| 826 | { | |
| 827 | GaimConnection *gc = client->application; | |
| 828 | SilcGaim sg = gc->proto_data; | |
| 829 | SilcGaimIM im = context; | |
| 830 | GaimConversation *convo; | |
| 831 | char tmp[256], *nickname = NULL; | |
| 832 | SilcClientEntry client_entry; | |
| 833 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10225
diff
changeset
|
834 | convo = gaim_find_conversation_with_account(GAIM_CONV_IM, im->nick, |
|
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10225
diff
changeset
|
835 | sg->account); |
| 8849 | 836 | if (!convo) |
| 837 | return; | |
| 838 | ||
| 839 | if (!clients) | |
| 840 | goto err; | |
| 841 | ||
| 842 | if (clients_count > 1) { | |
| 843 | silc_parse_userfqdn(im->nick, &nickname, NULL); | |
| 844 | ||
| 845 | /* Find the correct one. The im->nick might be a formatted nick | |
| 846 | so this will find the correct one. */ | |
| 847 | clients = silc_client_get_clients_local(client, conn, | |
| 848 | nickname, im->nick, | |
| 849 | &clients_count); | |
| 850 | if (!clients) | |
| 851 | goto err; | |
| 852 | client_entry = clients[0]; | |
| 853 | silc_free(clients); | |
| 854 | } else { | |
| 855 | client_entry = clients[0]; | |
| 856 | } | |
| 857 | ||
| 858 | /* Send the message */ | |
| 859 | silc_client_send_private_message(client, conn, client_entry, im->flags, | |
| 860 | im->message, im->message_len, TRUE); | |
| 861 | gaim_conv_im_write(GAIM_CONV_IM(convo), conn->local_entry->nickname, | |
| 862 | im->message, 0, time(NULL)); | |
| 863 | ||
| 864 | goto out; | |
| 865 | ||
| 866 | err: | |
| 867 | g_snprintf(tmp, sizeof(tmp), | |
| 868 | _("User <I>%s</I> is not present in the network"), im->nick); | |
| 869 | gaim_conversation_write(convo, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
| 870 | ||
| 871 | out: | |
| 872 | g_free(im->nick); | |
| 873 | g_free(im->message); | |
| 874 | silc_free(im); | |
| 875 | silc_free(nickname); | |
| 876 | } | |
| 877 | ||
| 878 | static int | |
| 879 | silcgaim_send_im(GaimConnection *gc, const char *who, const char *msg, | |
| 880 | GaimConvImFlags flags) | |
| 881 | { | |
| 882 | SilcGaim sg = gc->proto_data; | |
| 883 | SilcClient client = sg->client; | |
| 884 | SilcClientConnection conn = sg->conn; | |
| 885 | SilcClientEntry *clients; | |
| 886 | SilcUInt32 clients_count, mflags; | |
| 887 | char *nickname; | |
| 888 | int ret; | |
| 889 | gboolean sign = gaim_prefs_get_bool("/plugins/prpl/silc/sign_im"); | |
| 890 | ||
| 891 | if (!who || !msg) | |
| 892 | return 0; | |
| 893 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
894 | mflags = SILC_MESSAGE_FLAG_UTF8; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
895 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
896 | if (!g_ascii_strncasecmp(msg, "/me ", 4)) { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
897 | msg += 4; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
898 | if (!msg) |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
899 | return 0; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
900 | mflags |= SILC_MESSAGE_FLAG_ACTION; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
901 | } else if (strlen(msg) > 1 && msg[0] == '/') { |
| 8849 | 902 | if (!silc_client_command_call(client, conn, msg + 1)) |
| 903 | gaim_notify_error(gc, ("Call Command"), _("Cannot call command"), | |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
904 | _("Unknown command")); |
| 8849 | 905 | return 0; |
| 906 | } | |
| 907 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
908 | |
| 8849 | 909 | if (!silc_parse_userfqdn(who, &nickname, NULL)) |
| 910 | return 0; | |
| 911 | ||
| 912 | if (sign) | |
| 913 | mflags |= SILC_MESSAGE_FLAG_SIGNED; | |
| 914 | ||
| 915 | /* Find client entry */ | |
| 916 | clients = silc_client_get_clients_local(client, conn, nickname, who, | |
| 917 | &clients_count); | |
| 918 | if (!clients) { | |
| 919 | /* Resolve unknown user */ | |
| 920 | SilcGaimIM im = silc_calloc(1, sizeof(*im)); | |
| 921 | if (!im) | |
| 922 | return 0; | |
| 923 | im->nick = g_strdup(who); | |
| 924 | im->message = g_strdup(msg); | |
| 925 | im->message_len = strlen(im->message); | |
| 926 | im->flags = mflags; | |
| 927 | silc_client_get_clients(client, conn, nickname, NULL, | |
| 928 | silcgaim_send_im_resolved, im); | |
| 929 | silc_free(nickname); | |
| 930 | return 0; | |
| 931 | } | |
| 932 | ||
| 933 | /* Send private message directly */ | |
| 934 | ret = silc_client_send_private_message(client, conn, clients[0], | |
| 935 | mflags, (char *)msg, | |
| 936 | strlen(msg), TRUE); | |
| 937 | ||
| 938 | silc_free(nickname); | |
| 939 | silc_free(clients); | |
| 940 | return ret; | |
| 941 | } | |
| 942 | ||
| 943 | ||
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
944 | GList *silcgaim_blist_node_menu(GaimBlistNode *node) { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
945 | /* split this single menu building function back into the two |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
946 | original: one for buddies and one for chats */ |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
947 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
948 | if(GAIM_BLIST_NODE_IS_CHAT(node)) { |
| 9038 | 949 | return silcgaim_chat_menu((GaimChat *) node); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
950 | } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
951 | return silcgaim_buddy_menu((GaimBuddy *) node); |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
952 | } else { |
| 9038 | 953 | g_return_val_if_reached(NULL); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
954 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
955 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
956 | |
| 9272 | 957 | /********************************* Commands **********************************/ |
| 958 | ||
| 959 | static GaimCmdRet silcgaim_cmd_chat_part(GaimConversation *conv, | |
| 9597 | 960 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 961 | { |
| 962 | GaimConnection *gc; | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
963 | GaimConversation *convo; |
| 9272 | 964 | int id = 0; |
| 965 | ||
| 966 | gc = gaim_conversation_get_gc(conv); | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
967 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
968 | if (gc == NULL) |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
969 | return GAIM_CMD_RET_FAILED; |
| 9272 | 970 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
971 | if(args && args[0]) { |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10225
diff
changeset
|
972 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], |
|
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10225
diff
changeset
|
973 | gc->account); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
974 | } else |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
975 | convo = conv; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
976 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
977 | id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
978 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
979 | if (id == 0) |
| 9272 | 980 | return GAIM_CMD_RET_FAILED; |
| 981 | ||
| 982 | silcgaim_chat_leave(gc, id); | |
| 983 | ||
| 984 | return GAIM_CMD_RET_OK; | |
| 985 | ||
| 986 | } | |
| 987 | ||
| 988 | static GaimCmdRet silcgaim_cmd_chat_topic(GaimConversation *conv, | |
| 9597 | 989 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 990 | { |
| 991 | GaimConnection *gc; | |
| 992 | int id = 0; | |
| 9762 | 993 | char *buf, *tmp, *tmp2; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
994 | const char *topic; |
| 9272 | 995 | |
| 996 | gc = gaim_conversation_get_gc(conv); | |
| 997 | id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)); | |
| 998 | ||
| 999 | if (gc == NULL || id == 0) | |
| 1000 | return GAIM_CMD_RET_FAILED; | |
| 1001 | ||
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1002 | if (!args || !args[0]) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1003 | topic = gaim_conv_chat_get_topic (GAIM_CONV_CHAT(conv)); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1004 | if (topic) { |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
1005 | tmp = g_markup_escape_text(topic, -1); |
| 9762 | 1006 | tmp2 = gaim_markup_linkify(tmp); |
| 1007 | buf = g_strdup_printf(_("current topic is: %s"), tmp2); | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1008 | g_free(tmp); |
| 9762 | 1009 | g_free(tmp2); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1010 | } else |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1011 | buf = g_strdup(_("No topic is set")); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1012 | 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
|
1013 | GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1014 | g_free(buf); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1015 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1016 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1017 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1018 | if (args && args[0] && (strlen(args[0]) > 255)) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1019 | *error = g_strdup(_("Topic too long")); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1020 | return GAIM_CMD_RET_FAILED; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1021 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1022 | |
| 9272 | 1023 | silcgaim_chat_set_topic(gc, id, args ? args[0] : NULL); |
| 1024 | ||
| 1025 | return GAIM_CMD_RET_OK; | |
| 1026 | } | |
| 1027 | ||
| 1028 | static GaimCmdRet silcgaim_cmd_chat_join(GaimConversation *conv, | |
| 9597 | 1029 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1030 | { |
| 1031 | GHashTable *comp; | |
| 1032 | ||
| 1033 | if(!args || !args[0]) | |
| 1034 | return GAIM_CMD_RET_FAILED; | |
| 1035 | ||
| 1036 | comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); | |
| 1037 | ||
| 1038 | g_hash_table_replace(comp, "channel", args[0]); | |
| 1039 | if(args[1]) | |
| 1040 | g_hash_table_replace(comp, "passphrase", args[1]); | |
| 1041 | ||
| 1042 | silcgaim_chat_join(gaim_conversation_get_gc(conv), comp); | |
| 1043 | ||
| 1044 | g_hash_table_destroy(comp); | |
| 1045 | return GAIM_CMD_RET_OK; | |
| 1046 | } | |
| 1047 | ||
| 1048 | static GaimCmdRet silcgaim_cmd_chat_list(GaimConversation *conv, | |
| 9597 | 1049 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1050 | { |
| 1051 | GaimConnection *gc; | |
| 1052 | gc = gaim_conversation_get_gc(conv); | |
| 1053 | gaim_roomlist_show_with_account(gaim_connection_get_account(gc)); | |
| 1054 | return GAIM_CMD_RET_OK; | |
| 1055 | } | |
| 1056 | ||
| 1057 | static GaimCmdRet silcgaim_cmd_whois(GaimConversation *conv, | |
| 9597 | 1058 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1059 | { |
| 1060 | GaimConnection *gc; | |
| 1061 | ||
| 1062 | gc = gaim_conversation_get_gc(conv); | |
| 1063 | ||
| 1064 | if (gc == NULL) | |
| 1065 | return GAIM_CMD_RET_FAILED; | |
| 1066 | ||
| 1067 | silcgaim_get_info(gc, args[0]); | |
| 1068 | ||
| 1069 | return GAIM_CMD_RET_OK; | |
| 1070 | } | |
| 1071 | ||
| 1072 | static GaimCmdRet silcgaim_cmd_msg(GaimConversation *conv, | |
| 9597 | 1073 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1074 | { |
| 1075 | int ret; | |
| 1076 | GaimConnection *gc; | |
| 1077 | ||
| 1078 | gc = gaim_conversation_get_gc(conv); | |
| 1079 | ||
| 1080 | if (gc == NULL) | |
| 1081 | return GAIM_CMD_RET_FAILED; | |
| 1082 | ||
| 1083 | ret = silcgaim_send_im(gc, args[0], args[1], GAIM_MESSAGE_SEND); | |
| 1084 | ||
| 1085 | if (ret) | |
| 1086 | return GAIM_CMD_RET_OK; | |
| 1087 | else | |
| 1088 | return GAIM_CMD_RET_FAILED; | |
| 1089 | } | |
| 1090 | ||
| 1091 | static GaimCmdRet silcgaim_cmd_query(GaimConversation *conv, | |
| 9597 | 1092 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1093 | { |
| 1094 | int ret = 1; | |
| 1095 | GaimConversation *convo; | |
| 1096 | GaimConnection *gc; | |
| 1097 | GaimAccount *account; | |
| 1098 | ||
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1099 | if (!args || !args[0]) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1100 | *error = g_strdup(_("You must specify a nick")); |
| 9272 | 1101 | return GAIM_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1102 | } |
| 9272 | 1103 | |
| 1104 | gc = gaim_conversation_get_gc(conv); | |
| 1105 | ||
| 1106 | if (gc == NULL) | |
| 1107 | return GAIM_CMD_RET_FAILED; | |
| 1108 | ||
| 1109 | account = gaim_connection_get_account(gc); | |
| 1110 | ||
| 1111 | convo = gaim_conversation_new(GAIM_CONV_IM, account, args[0]); | |
| 1112 | ||
| 1113 | if (args[1]) { | |
| 1114 | ret = silcgaim_send_im(gc, args[0], args[1], GAIM_MESSAGE_SEND); | |
| 1115 | gaim_conv_im_write(GAIM_CONV_IM(convo), gaim_connection_get_display_name(gc), | |
| 1116 | args[1], GAIM_MESSAGE_SEND, time(NULL)); | |
| 1117 | } | |
| 1118 | ||
| 1119 | if (ret) | |
| 1120 | return GAIM_CMD_RET_OK; | |
| 1121 | else | |
| 1122 | return GAIM_CMD_RET_FAILED; | |
| 1123 | } | |
| 1124 | ||
| 1125 | static GaimCmdRet silcgaim_cmd_motd(GaimConversation *conv, | |
| 9597 | 1126 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1127 | { |
| 1128 | GaimConnection *gc; | |
| 1129 | SilcGaim sg; | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1130 | char *tmp; |
| 9272 | 1131 | |
| 1132 | gc = gaim_conversation_get_gc(conv); | |
| 1133 | ||
| 1134 | if (gc == NULL) | |
| 1135 | return GAIM_CMD_RET_FAILED; | |
| 1136 | ||
| 1137 | sg = gc->proto_data; | |
| 1138 | ||
| 1139 | if (sg == NULL) | |
| 1140 | return GAIM_CMD_RET_FAILED; | |
| 1141 | ||
| 1142 | if (!sg->motd) { | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1143 | *error = g_strdup(_("There is no Message of the Day associated with this connection")); |
| 9272 | 1144 | return GAIM_CMD_RET_FAILED; |
| 1145 | } | |
| 1146 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
1147 | tmp = g_markup_escape_text(sg->motd, -1); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1148 | gaim_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1149 | tmp, NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1150 | g_free(tmp); |
| 9272 | 1151 | |
| 1152 | return GAIM_CMD_RET_OK; | |
| 1153 | } | |
| 1154 | ||
| 1155 | static GaimCmdRet silcgaim_cmd_detach(GaimConversation *conv, | |
| 9597 | 1156 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1157 | { |
| 1158 | GaimConnection *gc; | |
| 1159 | SilcGaim sg; | |
| 1160 | ||
| 1161 | gc = gaim_conversation_get_gc(conv); | |
| 1162 | ||
| 1163 | if (gc == NULL) | |
| 1164 | return GAIM_CMD_RET_FAILED; | |
| 1165 | ||
| 1166 | sg = gc->proto_data; | |
| 1167 | ||
| 1168 | if (sg == NULL) | |
| 1169 | return GAIM_CMD_RET_FAILED; | |
| 1170 | ||
| 1171 | silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
| 1172 | sg->detaching = TRUE; | |
| 1173 | ||
| 1174 | return GAIM_CMD_RET_OK; | |
| 1175 | } | |
| 1176 | ||
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1177 | static GaimCmdRet silcgaim_cmd_cmode(GaimConversation *conv, |
| 9597 | 1178 | const char *cmd, char **args, char **error, void *data) |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1179 | { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1180 | GaimConnection *gc; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1181 | SilcGaim sg; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1182 | SilcChannelEntry channel; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1183 | char *silccmd, *silcargs, *msg, tmp[256]; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1184 | const char *chname; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1185 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1186 | gc = gaim_conversation_get_gc(conv); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1187 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1188 | if (gc == NULL || !args || gc->proto_data == NULL) |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1189 | return GAIM_CMD_RET_FAILED; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1190 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1191 | sg = gc->proto_data; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1192 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1193 | if (args[0]) |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1194 | chname = args[0]; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1195 | else |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1196 | chname = gaim_conversation_get_name(conv); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1197 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1198 | if (!args[1]) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1199 | channel = silc_client_get_channel(sg->client, sg->conn, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1200 | (char *)chname); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1201 | if (!channel) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1202 | *error = g_strdup_printf(_("channel %s not found"), chname); |
|
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 | if (channel->mode) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1206 | silcgaim_get_chmode_string(channel->mode, tmp, sizeof(tmp)); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1207 | msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1208 | } else { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1209 | 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
|
1210 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1211 | gaim_conv_chat_write(GAIM_CONV_CHAT(conv), "", |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1212 | msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1213 | g_free(msg); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1214 | return GAIM_CMD_RET_OK; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1215 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1216 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1217 | silcargs = g_strjoinv(" ", args); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1218 | silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1219 | g_free(silcargs); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1220 | if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1221 | g_free(silccmd); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1222 | *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
|
1223 | return GAIM_CMD_RET_FAILED; |
|
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 | g_free(silccmd); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1226 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1227 | return GAIM_CMD_RET_OK; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1228 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1229 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1230 | static GaimCmdRet silcgaim_cmd_generic(GaimConversation *conv, |
| 9597 | 1231 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1232 | { |
| 1233 | GaimConnection *gc; | |
| 1234 | SilcGaim sg; | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1235 | char *silccmd, *silcargs; |
| 9272 | 1236 | |
| 1237 | gc = gaim_conversation_get_gc(conv); | |
| 1238 | ||
| 1239 | if (gc == NULL) | |
| 1240 | return GAIM_CMD_RET_FAILED; | |
| 1241 | ||
| 1242 | sg = gc->proto_data; | |
| 1243 | ||
| 1244 | if (sg == NULL) | |
| 1245 | return GAIM_CMD_RET_FAILED; | |
| 1246 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1247 | silcargs = g_strjoinv(" ", args); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1248 | silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1249 | g_free(silcargs); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1250 | if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1251 | g_free(silccmd); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1252 | *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
|
1253 | return GAIM_CMD_RET_FAILED; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1254 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1255 | g_free(silccmd); |
| 9272 | 1256 | |
| 1257 | return GAIM_CMD_RET_OK; | |
| 1258 | } | |
| 1259 | ||
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1260 | static GaimCmdRet silcgaim_cmd_quit(GaimConversation *conv, |
| 9597 | 1261 | const char *cmd, char **args, char **error, void *data) |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1262 | { |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1263 | GaimConnection *gc; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1264 | SilcGaim sg; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1265 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1266 | gc = gaim_conversation_get_gc(conv); |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1267 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1268 | if (gc == NULL) |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1269 | return GAIM_CMD_RET_FAILED; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1270 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1271 | sg = gc->proto_data; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1272 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1273 | if (sg == NULL) |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1274 | return GAIM_CMD_RET_FAILED; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1275 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1276 | silc_client_command_call(sg->client, sg->conn, NULL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1277 | "QUIT", (args && args[0]) ? args[0] : "Download Gaim: " GAIM_WEBSITE, NULL); |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1278 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1279 | return GAIM_CMD_RET_OK; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1280 | } |
|
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 | static GaimCmdRet silcgaim_cmd_call(GaimConversation *conv, |
| 9597 | 1283 | const char *cmd, char **args, char **error, void *data) |
|
9359
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 | GaimConnection *gc; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1286 | SilcGaim sg; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1287 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1288 | gc = gaim_conversation_get_gc(conv); |
|
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 | if (gc == NULL) |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1291 | return GAIM_CMD_RET_FAILED; |
|
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 | sg = gc->proto_data; |
|
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 | if (sg == NULL) |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1296 | return GAIM_CMD_RET_FAILED; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1297 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1298 | if (!silc_client_command_call(sg->client, sg->conn, args[0])) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1299 | *error = g_strdup_printf(_("Unknown command: %s"), args[0]); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1300 | return GAIM_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1301 | } |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1302 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1303 | return GAIM_CMD_RET_OK; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1304 | } |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1305 | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1306 | |
| 8849 | 1307 | /************************** Plugin Initialization ****************************/ |
| 1308 | ||
| 9272 | 1309 | static void |
| 1310 | silcgaim_register_commands(void) | |
| 1311 | { | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1312 | gaim_cmd_register("part", "w", GAIM_CMD_P_PRPL, |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1313 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1314 | GAIM_CMD_FLAG_PRPL_ONLY | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, |
| 9597 | 1315 | "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
|
1316 | gaim_cmd_register("leave", "w", GAIM_CMD_P_PRPL, |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1317 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1318 | GAIM_CMD_FLAG_PRPL_ONLY | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, |
| 9597 | 1319 | "prpl-silc", silcgaim_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); |
| 9272 | 1320 | gaim_cmd_register("topic", "s", GAIM_CMD_P_PRPL, |
| 1321 | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
| 1322 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
| 9597 | 1323 | silcgaim_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); |
| 9272 | 1324 | gaim_cmd_register("join", "ws", GAIM_CMD_P_PRPL, |
| 1325 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | | |
| 1326 | GAIM_CMD_FLAG_PRPL_ONLY | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, | |
| 1327 | "prpl-silc", silcgaim_cmd_chat_join, | |
| 9597 | 1328 | _("join <channel> [<password>]: Join a chat on this network"), NULL); |
| 9272 | 1329 | gaim_cmd_register("list", "", GAIM_CMD_P_PRPL, |
| 1330 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
| 1331 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
| 9597 | 1332 | silcgaim_cmd_chat_list, _("list: List channels on this network"), NULL); |
| 9272 | 1333 | gaim_cmd_register("whois", "w", GAIM_CMD_P_PRPL, |
| 1334 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
| 1335 | "prpl-silc", | |
| 9597 | 1336 | silcgaim_cmd_whois, _("whois <nick>: View nick's information"), NULL); |
| 9272 | 1337 | gaim_cmd_register("msg", "ws", GAIM_CMD_P_PRPL, |
| 1338 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, | |
| 1339 | "prpl-silc", silcgaim_cmd_msg, | |
| 9597 | 1340 | _("msg <nick> <message>: Send a private message to a user"), NULL); |
| 9272 | 1341 | gaim_cmd_register("query", "ws", GAIM_CMD_P_PRPL, |
| 1342 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
| 1343 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_query, | |
| 9597 | 1344 | _("query <nick> [<message>]: Send a private message to a user"), NULL); |
| 9272 | 1345 | gaim_cmd_register("motd", "", GAIM_CMD_P_PRPL, |
| 1346 | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | | |
| 1347 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_motd, | |
| 9597 | 1348 | _("motd: View the server's Message Of The Day"), NULL); |
| 9272 | 1349 | gaim_cmd_register("detach", "", GAIM_CMD_P_PRPL, |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1350 | 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
|
1351 | "prpl-silc", silcgaim_cmd_detach, |
| 9597 | 1352 | _("detach: Detach this session"), NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1353 | gaim_cmd_register("quit", "s", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1354 | 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
|
1355 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_quit, |
| 9597 | 1356 | _("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
|
1357 | gaim_cmd_register("call", "s", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1358 | 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
|
1359 | "prpl-silc", silcgaim_cmd_call, |
| 9597 | 1360 | _("call <command>: Call any silc client command"), NULL); |
| 1361 | /* These below just get passed through for the silc client library to deal | |
| 1362 | * with */ | |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1363 | gaim_cmd_register("kill", "ws", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1364 | 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
|
1365 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1366 | _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1367 | gaim_cmd_register("nick", "w", 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 | "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1370 | _("nick <newnick>: Change your nickname"), NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1371 | gaim_cmd_register("whowas", "ww", GAIM_CMD_P_PRPL, |
|
9359
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 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1374 | _("whowas <nick>: View nick's information"), NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1375 | gaim_cmd_register("cmode", "wws", GAIM_CMD_P_PRPL, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1376 | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1377 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_cmode, |
| 9597 | 1378 | _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1379 | gaim_cmd_register("cumode", "wws", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1380 | 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
|
1381 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1382 | _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); |
| 9272 | 1383 | gaim_cmd_register("umode", "w", GAIM_CMD_P_PRPL, |
| 1384 | 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
|
1385 | "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1386 | _("umode <usermodes>: Set your modes in the network"), NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1387 | gaim_cmd_register("oper", "s", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1388 | 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
|
1389 | "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1390 | _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1391 | gaim_cmd_register("invite", "ws", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1392 | 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
|
1393 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1394 | _("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
|
1395 | gaim_cmd_register("kick", "wws", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1396 | 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
|
1397 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1398 | _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1399 | gaim_cmd_register("info", "w", GAIM_CMD_P_PRPL, |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1400 | 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
|
1401 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1402 | _("info [server]: View server administrative details"), NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1403 | gaim_cmd_register("ban", "ww", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1404 | 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
|
1405 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1406 | _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1407 | gaim_cmd_register("getkey", "w", GAIM_CMD_P_PRPL, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1408 | 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
|
1409 | "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1410 | _("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
|
1411 | gaim_cmd_register("stats", "", GAIM_CMD_P_PRPL, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1412 | 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
|
1413 | "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1414 | _("stats: View server and network statistics"), NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1415 | gaim_cmd_register("ping", "", GAIM_CMD_P_PRPL, |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1416 | 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
|
1417 | "prpl-silc", silcgaim_cmd_generic, |
| 9597 | 1418 | _("ping: Send PING to the connected server"), NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1419 | #if 0 /* Gaim doesn't handle these yet */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1420 | gaim_cmd_register("users", "w", GAIM_CMD_P_PRPL, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1421 | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1422 | "prpl-silc", silcgaim_cmd_users, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1423 | _("users <channel>: List users in channel")); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1424 | gaim_cmd_register("names", "ww", GAIM_CMD_P_PRPL, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1425 | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1426 | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_names, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1427 | _("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
|
1428 | #endif |
| 9272 | 1429 | } |
| 1430 | ||
| 8849 | 1431 | static GaimPluginPrefFrame * |
| 1432 | silcgaim_pref_frame(GaimPlugin *plugin) | |
| 1433 | { | |
| 1434 | GaimPluginPrefFrame *frame; | |
| 1435 | GaimPluginPref *ppref; | |
| 1436 | ||
| 1437 | frame = gaim_plugin_pref_frame_new(); | |
| 1438 | ||
| 1439 | ppref = gaim_plugin_pref_new_with_label(_("Instant Messages")); | |
| 1440 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1441 | ||
| 1442 | ppref = gaim_plugin_pref_new_with_name_and_label( | |
| 1443 | "/plugins/prpl/silc/sign_im", | |
| 1444 | _("Digitally sign all IM messages")); | |
| 1445 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1446 | ||
| 1447 | ppref = gaim_plugin_pref_new_with_name_and_label( | |
| 1448 | "/plugins/prpl/silc/verify_im", | |
| 1449 | _("Verify all IM message signatures")); | |
| 1450 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1451 | ||
| 1452 | ppref = gaim_plugin_pref_new_with_label(_("Channel Messages")); | |
| 1453 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1454 | ||
| 1455 | ppref = gaim_plugin_pref_new_with_name_and_label( | |
| 1456 | "/plugins/prpl/silc/sign_chat", | |
| 1457 | _("Digitally sign all channel messages")); | |
| 1458 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1459 | ||
| 1460 | ppref = gaim_plugin_pref_new_with_name_and_label( | |
| 1461 | "/plugins/prpl/silc/verify_chat", | |
| 1462 | _("Verify all channel message signatures")); | |
| 1463 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1464 | ||
| 1465 | ppref = gaim_plugin_pref_new_with_label(_("Default SILC Key Pair")); | |
| 1466 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1467 | ||
| 1468 | ppref = gaim_plugin_pref_new_with_name_and_label( | |
| 1469 | "/plugins/prpl/silc/pubkey", | |
| 1470 | _("SILC Public Key")); | |
| 1471 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1472 | ||
| 1473 | ppref = gaim_plugin_pref_new_with_name_and_label( | |
| 1474 | "/plugins/prpl/silc/privkey", | |
| 1475 | _("SILC Private Key")); | |
| 1476 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 1477 | ||
| 1478 | return frame; | |
| 1479 | } | |
| 1480 | ||
| 1481 | static GaimPluginUiInfo prefs_info = | |
| 1482 | { | |
| 1483 | silcgaim_pref_frame, | |
| 1484 | }; | |
| 1485 | ||
| 1486 | static GaimPluginProtocolInfo prpl_info = | |
| 1487 | { | |
| 1488 | OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | | |
| 1489 | OPT_PROTO_PASSWORD_OPTIONAL, | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1490 | NULL, /* user_splits */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1491 | NULL, /* protocol_options */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1492 | NO_BUDDY_ICONS, /* icon_spec */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1493 | silcgaim_list_icon, /* list_icon */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1494 | silcgaim_list_emblems, /* list_emblems */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1495 | silcgaim_status_text, /* status_text */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1496 | silcgaim_tooltip_text, /* tooltip_text */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1497 | silcgaim_away_states, /* away_states */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1498 | silcgaim_blist_node_menu, /* blist_node_menu */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1499 | silcgaim_chat_info, /* chat_info */ |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9732
diff
changeset
|
1500 | silcgaim_chat_info_defaults,/* chat_info_defaults */ |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1501 | silcgaim_login, /* login */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1502 | silcgaim_close, /* close */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1503 | silcgaim_send_im, /* send_im */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1504 | silcgaim_set_info, /* set_info */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1505 | NULL, /* send_typing */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1506 | silcgaim_get_info, /* get_info */ |
| 9968 | 1507 | silcgaim_set_status, /* set_status */ |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1508 | silcgaim_idle_set, /* set_idle */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1509 | silcgaim_change_passwd, /* change_passwd */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1510 | silcgaim_add_buddy, /* add_buddy */ |
|
10341
92c66f97b73f
[gaim-migrate @ 11550]
Mark Doliner <markdoliner@pidgin.im>
parents:
10246
diff
changeset
|
1511 | silcgaim_add_buddies, /* add_buddies */ |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1512 | silcgaim_remove_buddy, /* remove_buddy */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1513 | NULL, /* remove_buddies */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1514 | NULL, /* add_permit */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1515 | NULL, /* add_deny */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1516 | NULL, /* rem_permit */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1517 | NULL, /* rem_deny */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1518 | NULL, /* set_permit_deny */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1519 | NULL, /* warn */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1520 | silcgaim_chat_join, /* join_chat */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1521 | NULL, /* reject_chat */ |
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9762
diff
changeset
|
1522 | silcgaim_get_chat_name, /* get_chat_name */ |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1523 | silcgaim_chat_invite, /* chat_invite */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1524 | silcgaim_chat_leave, /* chat_leave */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1525 | NULL, /* chat_whisper */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1526 | silcgaim_chat_send, /* chat_send */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1527 | silcgaim_keepalive, /* keepalive */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1528 | NULL, /* register_user */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1529 | NULL, /* get_cb_info */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1530 | NULL, /* get_cb_away */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1531 | NULL, /* alias_buddy */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1532 | NULL, /* group_buddy */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1533 | NULL, /* rename_group */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1534 | NULL, /* buddy_free */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1535 | NULL, /* convo_closed */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1536 | NULL, /* normalize */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1537 | NULL, /* set_buddy_icon */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1538 | NULL, /* remove_group */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1539 | NULL, /* get_cb_real_name */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1540 | silcgaim_chat_set_topic, /* set_chat_topic */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1541 | NULL, /* find_blist_chat */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1542 | silcgaim_roomlist_get_list, /* roomlist_get_list */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1543 | silcgaim_roomlist_cancel, /* roomlist_cancel */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1544 | NULL, /* roomlist_expand_category */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1545 | NULL, /* can_receive_file */ |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1546 | silcgaim_ftp_send_file /* send_file */ |
| 8849 | 1547 | }; |
| 1548 | ||
| 1549 | static GaimPluginInfo info = | |
| 1550 | { | |
| 9943 | 1551 | GAIM_PLUGIN_MAGIC, |
| 1552 | GAIM_MAJOR_VERSION, | |
| 1553 | GAIM_MINOR_VERSION, | |
| 8849 | 1554 | GAIM_PLUGIN_PROTOCOL, /**< type */ |
| 1555 | NULL, /**< ui_requirement */ | |
| 1556 | 0, /**< flags */ | |
| 1557 | NULL, /**< dependencies */ | |
| 1558 | GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 1559 | ||
| 1560 | "prpl-silc", /**< id */ | |
| 1561 | "SILC", /**< name */ | |
| 1562 | "1.0", /**< version */ | |
| 1563 | /** summary */ | |
| 1564 | N_("SILC Protocol Plugin"), | |
| 1565 | /** description */ | |
| 1566 | N_("Secure Internet Live Conferencing (SILC) Protocol"), | |
| 8891 | 1567 | "Pekka Riikonen", /**< author */ |
| 1568 | "http://silcnet.org/", /**< homepage */ | |
| 8849 | 1569 | |
| 1570 | NULL, /**< load */ | |
| 1571 | NULL, /**< unload */ | |
| 1572 | NULL, /**< destroy */ | |
| 1573 | ||
| 1574 | NULL, /**< ui_info */ | |
| 1575 | &prpl_info, /**< extra_info */ | |
| 8993 | 1576 | &prefs_info, /**< prefs_info */ |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1577 | silcgaim_actions |
| 8849 | 1578 | }; |
| 1579 | ||
| 1580 | static void | |
| 1581 | init_plugin(GaimPlugin *plugin) | |
| 1582 | { | |
| 1583 | GaimAccountOption *option; | |
| 1584 | char tmp[256]; | |
| 1585 | ||
| 1586 | silc_plugin = plugin; | |
| 1587 | ||
| 1588 | /* Account options */ | |
| 1589 | option = gaim_account_option_string_new(_("Connect server"), | |
| 1590 | "server", | |
| 1591 | "silc.silcnet.org"); | |
| 1592 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1593 | option = gaim_account_option_int_new(_("Port"), "port", 706); | |
| 1594 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1595 | ||
| 1596 | option = gaim_account_option_bool_new(_("Public key authentication"), | |
| 1597 | "pubkey-auth", FALSE); | |
| 1598 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1599 | #if 0 /* XXX Public key auth interface with explicit key pair is | |
| 1600 | broken in SILC Toolkit */ | |
|
10516
fb2ac3954ea0
[gaim-migrate @ 11818]
Daniel Atallah <datallah@pidgin.im>
parents:
10443
diff
changeset
|
1601 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcgaim_silcdir()); |
| 8849 | 1602 | option = gaim_account_option_string_new(_("Public Key File"), |
| 1603 | "public-key", tmp); | |
| 1604 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
|
10516
fb2ac3954ea0
[gaim-migrate @ 11818]
Daniel Atallah <datallah@pidgin.im>
parents:
10443
diff
changeset
|
1605 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcgaim_silcdir()); |
| 8849 | 1606 | option = gaim_account_option_string_new(_("Private Key File"), |
| 1607 | "public-key", tmp); | |
| 1608 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1609 | #endif | |
| 1610 | ||
| 1611 | option = gaim_account_option_bool_new(_("Reject watching by other users"), | |
| 1612 | "reject-watch", FALSE); | |
| 1613 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1614 | option = gaim_account_option_bool_new(_("Block invites"), | |
| 1615 | "block-invites", FALSE); | |
| 1616 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1617 | option = gaim_account_option_bool_new(_("Block IMs without Key Exchange"), | |
| 1618 | "block-ims", FALSE); | |
| 1619 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1620 | option = gaim_account_option_bool_new(_("Reject online status attribute requests"), | |
| 1621 | "reject-attrs", FALSE); | |
| 1622 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 1623 | ||
| 1624 | /* Preferences */ | |
| 1625 | gaim_prefs_add_none("/plugins/prpl/silc"); | |
| 1626 | gaim_prefs_add_bool("/plugins/prpl/silc/sign_im", FALSE); | |
| 1627 | gaim_prefs_add_bool("/plugins/prpl/silc/verify_im", FALSE); | |
| 1628 | gaim_prefs_add_bool("/plugins/prpl/silc/sign_chat", FALSE); | |
| 1629 | gaim_prefs_add_bool("/plugins/prpl/silc/verify_chat", FALSE); | |
|
10516
fb2ac3954ea0
[gaim-migrate @ 11818]
Daniel Atallah <datallah@pidgin.im>
parents:
10443
diff
changeset
|
1630 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcgaim_silcdir()); |
| 8849 | 1631 | gaim_prefs_add_string("/plugins/prpl/silc/pubkey", tmp); |
|
10516
fb2ac3954ea0
[gaim-migrate @ 11818]
Daniel Atallah <datallah@pidgin.im>
parents:
10443
diff
changeset
|
1632 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcgaim_silcdir()); |
| 8849 | 1633 | gaim_prefs_add_string("/plugins/prpl/silc/privkey", tmp); |
| 1634 | gaim_prefs_add_string("/plugins/prpl/silc/vcard", ""); | |
| 9272 | 1635 | |
| 1636 | silcgaim_register_commands(); | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1637 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1638 | #ifdef _WIN32 |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1639 | silc_net_win32_init(); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1640 | #endif |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1641 | |
| 8849 | 1642 | } |
| 1643 | ||
| 1644 | GAIM_INIT_PLUGIN(silc, init_plugin, info); |