annotate src/protocols/silc/silc.c @ 13545:cfc2f7fcb3dd

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