annotate src/protocols/silc/silc.c @ 12820:cb3cbd69284d

[gaim-migrate @ 15168] Oops, typos. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Wed, 11 Jan 2006 05:01:45 +0000
parents 95a73ce6e285
children b704e60fe5de
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;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
147 SilcGaim sg = gc->proto_data;
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;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
150 GaimAccount *account = sg->account;
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
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
154 if (source < 0) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
155 gaim_connection_error(gc, _("Connection failed"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
156 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
157 }
9732
eb9c345d45a3 [gaim-migrate @ 10593]
Ethan Blanton <elb@pidgin.im>
parents: 9597
diff changeset
158
eb9c345d45a3 [gaim-migrate @ 10593]
Ethan Blanton <elb@pidgin.im>
parents: 9597
diff changeset
159 if (sg == NULL)
eb9c345d45a3 [gaim-migrate @ 10593]
Ethan Blanton <elb@pidgin.im>
parents: 9597
diff changeset
160 return;
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 client = sg->client;
eb9c345d45a3 [gaim-migrate @ 10593]
Ethan Blanton <elb@pidgin.im>
parents: 9597
diff changeset
163
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
164 if (!g_list_find(gaim_connections_get_all(), gc)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
165 close(source);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
166 g_source_remove(sg->scheduler);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
167 silc_client_stop(sg->client);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
168 silc_client_free(sg->client);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
169 silc_free(sg);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
170 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
171 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
172
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
173 /* Get session detachment data, if available */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
174 memset(&params, 0, sizeof(params));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
175 dfile = silcgaim_session_file(gaim_account_get_username(sg->account));
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11257
diff changeset
176 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
177 if (params.detach_data)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
178 params.detach_data[params.detach_data_len] = 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
179
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
180 /* Add connection to SILC client library */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
181 conn = silc_client_add_connection(
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
182 sg->client, &params,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
183 (char *)gaim_account_get_string(account, "server",
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
184 "silc.silcnet.org"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
185 gaim_account_get_int(account, "port", 706), sg);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
186 if (!conn) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
187 gaim_connection_error(gc, _("Cannot initialize SILC Client connection"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
188 gc->proto_data = NULL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
189 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
190 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
191 sg->conn = conn;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
192
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
193 /* Progress */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
194 if (params.detach_data) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
195 gaim_connection_update_progress(gc, _("Resuming session"), 2, 5);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
196 sg->resuming = TRUE;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
197 } else {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
198 gaim_connection_update_progress(gc, _("Performing key exchange"), 2, 5);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
199 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
200
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
201 /* Perform SILC Key Exchange. The "silc_connected" will be called
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
202 eventually. */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
203 silc_client_start_key_exchange(sg->client, sg->conn, source);
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 /* Set default attributes */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
206 if (!gaim_account_get_bool(account, "reject-attrs", FALSE)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
207 SilcUInt32 mask;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
208 const char *tmp;
12761
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
209 #ifdef SILC_ATTRIBUTE_USER_ICON
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
210 char *icon;
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
211 #endif
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
212 #ifdef HAVE_SYS_UTSNAME_H
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
213 struct utsname u;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
214 #endif
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
215
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
216 mask = SILC_ATTRIBUTE_MOOD_NORMAL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
217 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
218 SILC_ATTRIBUTE_STATUS_MOOD,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
219 SILC_32_TO_PTR(mask),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
220 sizeof(SilcUInt32));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
221 mask = SILC_ATTRIBUTE_CONTACT_CHAT;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
222 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
223 SILC_ATTRIBUTE_PREFERRED_CONTACT,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
224 SILC_32_TO_PTR(mask),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
225 sizeof(SilcUInt32));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
226 #ifdef HAVE_SYS_UTSNAME_H
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
227 if (!uname(&u)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
228 SilcAttributeObjDevice dev;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
229 memset(&dev, 0, sizeof(dev));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
230 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
231 dev.version = u.release;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
232 dev.model = u.sysname;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
233 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
234 SILC_ATTRIBUTE_DEVICE_INFO,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
235 (void *)&dev, sizeof(dev));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
236 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
237 #endif
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
238 #ifdef _WIN32
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
239 tmp = _tzname[0];
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
240 #else
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
241 tmp = tzname[0];
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
242 #endif
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
243 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
244 SILC_ATTRIBUTE_TIMEZONE,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
245 (void *)tmp, strlen(tmp));
12761
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
246
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
247 #ifdef SILC_ATTRIBUTE_USER_ICON
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
248 /* Set our buddy icon */
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
249 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
250 silcgaim_buddy_set_icon(gc, icon);
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
251 g_free(icon);
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
252 #endif
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
253 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
254
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
255 silc_free(params.detach_data);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
256 }
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 static void
11837
fa742ad8068c [gaim-migrate @ 14128]
Mark Doliner <mark@kingant.net>
parents: 11718
diff changeset
259 silcgaim_login(GaimAccount *account)
8849
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 SilcGaim sg;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
262 SilcClient client;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
263 SilcClientParams params;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
264 GaimConnection *gc;
10825
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
265 char pkd[256], prd[256];
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
266 const char *cipher, *hmac;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
267 int i;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
268
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
269 gc = account->gc;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
270 if (!gc)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
271 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
272 gc->proto_data = NULL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
273
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
274 memset(&params, 0, sizeof(params));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
275 strcat(params.nickname_format, "%n@%h%a");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
276 params.nickname_parse = silcgaim_nickname_parse;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
277 params.ignore_requested_attributes =
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
278 gaim_account_get_bool(account, "reject-attrs", FALSE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
279
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
280 /* Allocate SILC client */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
281 client = silc_client_alloc(&ops, &params, gc, NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
282 if (!client) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
283 gaim_connection_error(gc, _("Out of memory"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
284 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
285 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
286
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
287 /* Get username, real name and local hostname for SILC library */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
288 if (gaim_account_get_username(account)) {
10825
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
289 const char *u = gaim_account_get_username(account);
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
290 char **up = g_strsplit(u, "@", 2);
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
291 client->username = strdup(up[0]);
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
292 g_strfreev(up);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
293 } else {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
294 client->username = silc_get_username();
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
295 gaim_account_set_username(account, client->username);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
296 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
297 if (gaim_account_get_user_info(account)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
298 client->realname = strdup(gaim_account_get_user_info(account));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
299 } else {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
300 client->realname = silc_get_real_name();
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
301 gaim_account_set_user_info(account, client->realname);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
302 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
303 client->hostname = silc_net_localhost();
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
304
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
305 gaim_connection_set_display_name(gc, client->username);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
306
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
307 /* Register requested cipher and HMAC */
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
308 cipher = gaim_account_get_string(account, "cipher", SILC_DEFAULT_CIPHER);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
309 for (i = 0; silc_default_ciphers[i].name; i++)
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
310 if (!strcmp(silc_default_ciphers[i].name, cipher)) {
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
311 silc_cipher_register(&(silc_default_ciphers[i]));
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
312 break;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
313 }
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
314 hmac = gaim_account_get_string(account, "hmac", SILC_DEFAULT_HMAC);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
315 for (i = 0; silc_default_hmacs[i].name; i++)
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
316 if (!strcmp(silc_default_hmacs[i].name, hmac)) {
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
317 silc_hmac_register(&(silc_default_hmacs[i]));
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
318 break;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
319 }
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
320
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
321 /* Init SILC client */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
322 if (!silc_client_init(client)) {
10909
bd6c0aa9ff6c [gaim-migrate @ 12642]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10869
diff changeset
323 gc->wants_to_die = TRUE;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
324 gaim_connection_error(gc, ("Cannot initialize SILC protocol"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
325 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
326 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
327
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
328 /* 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
329 if (!silcgaim_check_silc_dir(gc)) {
10909
bd6c0aa9ff6c [gaim-migrate @ 12642]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10869
diff changeset
330 gc->wants_to_die = TRUE;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
331 gaim_connection_error(gc, ("Cannot find/access ~/.silc directory"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
332 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
333 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
334
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
335 /* Progress */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
336 gaim_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5);
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 /* Load SILC key pair */
10909
bd6c0aa9ff6c [gaim-migrate @ 12642]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10869
diff changeset
339 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
340 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
341 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
342 (char *)gaim_account_get_string(account, "private-key", prd),
10751
bf5e48215158 [gaim-migrate @ 12354]
Mark Doliner <mark@kingant.net>
parents: 10732
diff changeset
343 (gc->password == NULL) ? "" : gc->password, &client->pkcs,
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
344 &client->public_key, &client->private_key)) {
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
345 g_snprintf(pkd, sizeof(pkd), ("Could not load SILC key pair: %s"), strerror(errno));
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
346 gaim_connection_error(gc, pkd);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
347 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
348 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
349
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
350 sg = silc_calloc(1, sizeof(*sg));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
351 if (!sg)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
352 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
353 memset(sg, 0, sizeof(*sg));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
354 sg->client = client;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
355 sg->gc = gc;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
356 sg->account = account;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
357 gc->proto_data = sg;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
358
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
359 /* Connect to the SILC server */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
360 if (gaim_proxy_connect(account,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
361 gaim_account_get_string(account, "server",
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
362 "silc.silcnet.org"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
363 gaim_account_get_int(account, "port", 706),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
364 silcgaim_login_connected, gc)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
365 gaim_connection_error(gc, ("Unable to create connection"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
366 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
367 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
368
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
369 /* Schedule SILC using Glib's event loop */
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
370 #ifndef _WIN32
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
371 sg->scheduler = g_timeout_add(5, (GSourceFunc)silcgaim_scheduler, sg);
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
372 #else
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
373 sg->scheduler = g_timeout_add(300, (GSourceFunc)silcgaim_scheduler, sg);
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
374 #endif
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
375 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
376
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
377 static int
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
378 silcgaim_close_final(gpointer *context)
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 SilcGaim sg = (SilcGaim)context;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
381 silc_client_stop(sg->client);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
382 silc_client_free(sg->client);
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
383 #ifdef HAVE_SILCMIME_H
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
384 if (sg->mimeass)
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
385 silc_mime_assembler_free(sg->mimeass);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
386 #endif
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
387 silc_free(sg);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
388 return 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
389 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
390
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
391 static void
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
392 silcgaim_close(GaimConnection *gc)
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 SilcGaim sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
395
10547
82d6760ba000 [gaim-migrate @ 11917]
Mark Doliner <mark@kingant.net>
parents: 10516
diff changeset
396 g_return_if_fail(sg != NULL);
8849
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 /* Send QUIT */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
399 silc_client_command_call(sg->client, sg->conn, NULL,
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
400 "QUIT", "Download Gaim: " GAIM_WEBSITE, 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 if (sg->conn)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
403 silc_client_close_connection(sg->client, sg->conn);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
404
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
405 g_source_remove(sg->scheduler);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
406 g_timeout_add(1, (GSourceFunc)silcgaim_close_final, sg);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
407 }
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
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
410 /****************************** Protocol Actions *****************************/
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 static void
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
413 silcgaim_attrs_cancel(GaimConnection *gc, GaimRequestFields *fields)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
414 {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
415 /* Nothing */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
416 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
417
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
418 static void
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
419 silcgaim_attrs_cb(GaimConnection *gc, GaimRequestFields *fields)
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 SilcGaim sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
422 SilcClient client = sg->client;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
423 SilcClientConnection conn = sg->conn;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
424 GaimRequestField *f;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
425 char *tmp;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
426 SilcUInt32 tmp_len, mask;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
427 SilcAttributeObjService service;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
428 SilcAttributeObjDevice dev;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
429 SilcVCardStruct vcard;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
430 const char *val;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
431
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
432 sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
433 if (!sg)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
434 return;
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 memset(&service, 0, sizeof(service));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
437 memset(&dev, 0, sizeof(dev));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
438 memset(&vcard, 0, sizeof(vcard));
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 silc_client_attribute_del(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
441 SILC_ATTRIBUTE_USER_INFO, NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
442 silc_client_attribute_del(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
443 SILC_ATTRIBUTE_SERVICE, NULL);
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_STATUS_MOOD, 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_STATUS_FREETEXT, 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_MESSAGE, 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_PREFERRED_LANGUAGE, 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_PREFERRED_CONTACT, 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_TIMEZONE, 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_GEOLOCATION, 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_DEVICE_INFO, NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
460
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
461 /* Set mood */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
462 mask = 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
463 f = gaim_request_fields_get_field(fields, "mood_normal");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
464 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
465 mask |= SILC_ATTRIBUTE_MOOD_NORMAL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
466 f = gaim_request_fields_get_field(fields, "mood_happy");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
467 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
468 mask |= SILC_ATTRIBUTE_MOOD_HAPPY;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
469 f = gaim_request_fields_get_field(fields, "mood_sad");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
470 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
471 mask |= SILC_ATTRIBUTE_MOOD_SAD;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
472 f = gaim_request_fields_get_field(fields, "mood_angry");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
473 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
474 mask |= SILC_ATTRIBUTE_MOOD_ANGRY;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
475 f = gaim_request_fields_get_field(fields, "mood_jealous");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
476 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
477 mask |= SILC_ATTRIBUTE_MOOD_JEALOUS;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
478 f = gaim_request_fields_get_field(fields, "mood_ashamed");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
479 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
480 mask |= SILC_ATTRIBUTE_MOOD_ASHAMED;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
481 f = gaim_request_fields_get_field(fields, "mood_invincible");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
482 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
483 mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
484 f = gaim_request_fields_get_field(fields, "mood_inlove");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
485 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
486 mask |= SILC_ATTRIBUTE_MOOD_INLOVE;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
487 f = gaim_request_fields_get_field(fields, "mood_sleepy");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
488 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
489 mask |= SILC_ATTRIBUTE_MOOD_SLEEPY;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
490 f = gaim_request_fields_get_field(fields, "mood_bored");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
491 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
492 mask |= SILC_ATTRIBUTE_MOOD_BORED;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
493 f = gaim_request_fields_get_field(fields, "mood_excited");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
494 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
495 mask |= SILC_ATTRIBUTE_MOOD_EXCITED;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
496 f = gaim_request_fields_get_field(fields, "mood_anxious");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
497 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
498 mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
499 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
500 SILC_ATTRIBUTE_STATUS_MOOD,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
501 SILC_32_TO_PTR(mask),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
502 sizeof(SilcUInt32));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
503
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
504 /* Set preferred contact */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
505 mask = 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
506 f = gaim_request_fields_get_field(fields, "contact_chat");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
507 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
508 mask |= SILC_ATTRIBUTE_CONTACT_CHAT;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
509 f = gaim_request_fields_get_field(fields, "contact_email");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
510 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
511 mask |= SILC_ATTRIBUTE_CONTACT_EMAIL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
512 f = gaim_request_fields_get_field(fields, "contact_call");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
513 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
514 mask |= SILC_ATTRIBUTE_CONTACT_CALL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
515 f = gaim_request_fields_get_field(fields, "contact_sms");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
516 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
517 mask |= SILC_ATTRIBUTE_CONTACT_SMS;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
518 f = gaim_request_fields_get_field(fields, "contact_mms");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
519 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
520 mask |= SILC_ATTRIBUTE_CONTACT_MMS;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
521 f = gaim_request_fields_get_field(fields, "contact_video");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
522 if (f && gaim_request_field_bool_get_value(f))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
523 mask |= SILC_ATTRIBUTE_CONTACT_VIDEO;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
524 if (mask)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
525 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
526 SILC_ATTRIBUTE_PREFERRED_CONTACT,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
527 SILC_32_TO_PTR(mask),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
528 sizeof(SilcUInt32));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
529
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
530 /* Set status text */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
531 val = NULL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
532 f = gaim_request_fields_get_field(fields, "status_text");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
533 if (f)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
534 val = gaim_request_field_string_get_value(f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
535 if (val && *val)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
536 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
537 SILC_ATTRIBUTE_STATUS_FREETEXT,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
538 (void *)val, strlen(val));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
539
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
540 /* Set vcard */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
541 val = NULL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
542 f = gaim_request_fields_get_field(fields, "vcard");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
543 if (f)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
544 val = gaim_request_field_string_get_value(f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
545 if (val && *val) {
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
546 gaim_account_set_string(sg->account, "vcard", val);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
547 tmp = silc_file_readfile(val, &tmp_len);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
548 if (tmp) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
549 tmp[tmp_len] = 0;
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11257
diff changeset
550 if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard))
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
551 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
552 SILC_ATTRIBUTE_USER_INFO,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
553 (void *)&vcard,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
554 sizeof(vcard));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
555 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
556 silc_vcard_free(&vcard);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
557 silc_free(tmp);
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
558 } else {
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
559 gaim_account_set_string(sg->account, "vcard", "");
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
560 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
561
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
562 #ifdef HAVE_SYS_UTSNAME_H
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
563 /* Set device info */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
564 f = gaim_request_fields_get_field(fields, "device");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
565 if (f && gaim_request_field_bool_get_value(f)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
566 struct utsname u;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
567 if (!uname(&u)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
568 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
569 dev.version = u.release;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
570 dev.model = u.sysname;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
571 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
572 SILC_ATTRIBUTE_DEVICE_INFO,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
573 (void *)&dev, sizeof(dev));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
574 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
575 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
576 #endif
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
577
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
578 /* Set timezone */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
579 val = NULL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
580 f = gaim_request_fields_get_field(fields, "timezone");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
581 if (f)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
582 val = gaim_request_field_string_get_value(f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
583 if (val && *val)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
584 silc_client_attribute_add(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
585 SILC_ATTRIBUTE_TIMEZONE,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
586 (void *)val, strlen(val));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
587 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
588
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
589 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
590 silcgaim_attrs(GaimPluginAction *action)
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
591 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
592 GaimConnection *gc = (GaimConnection *) action->context;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
593 SilcGaim sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
594 SilcClient client = sg->client;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
595 SilcClientConnection conn = sg->conn;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
596 GaimRequestFields *fields;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
597 GaimRequestFieldGroup *g;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
598 GaimRequestField *f;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
599 SilcHashTable attrs;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
600 SilcAttributePayload attr;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
601 gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
602 mangry = FALSE, mjealous = FALSE, mashamed = FALSE,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
603 minvincible = FALSE, minlove = FALSE, msleepy = FALSE,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
604 mbored = FALSE, mexcited = FALSE, manxious = FALSE;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
605 gboolean cemail = FALSE, ccall = FALSE, csms = FALSE,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
606 cmms = FALSE, cchat = TRUE, cvideo = FALSE;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
607 gboolean device = TRUE;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
608 char status[1024];
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
609
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
610 sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
611 if (!sg)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
612 return;
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 memset(status, 0, sizeof(status));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
615
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
616 attrs = silc_client_attributes_get(client, conn);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
617 if (attrs) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
618 if (silc_hash_table_find(attrs,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
619 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
620 NULL, (void *)&attr)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
621 SilcUInt32 mood = 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
622 silc_attribute_get_object(attr, &mood, sizeof(mood));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
623 mnormal = !mood;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
624 mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
625 msad = (mood & SILC_ATTRIBUTE_MOOD_SAD);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
626 mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
627 mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
628 mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
629 minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
630 minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
631 msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
632 mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
633 mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
634 manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
635 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
636
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
637 if (silc_hash_table_find(attrs,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
638 SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
639 NULL, (void *)&attr)) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
640 SilcUInt32 contact = 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
641 silc_attribute_get_object(attr, &contact, sizeof(contact));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
642 cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
643 ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
644 csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
645 cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
646 cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
647 cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
648 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
649
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
650 if (silc_hash_table_find(attrs,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
651 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
652 NULL, (void *)&attr))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
653 silc_attribute_get_object(attr, &status, sizeof(status));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
654
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
655 if (!silc_hash_table_find(attrs,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
656 SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
657 NULL, (void *)&attr))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
658 device = FALSE;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
659 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
660
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
661 fields = gaim_request_fields_new();
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
662
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
663 g = gaim_request_field_group_new(NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
664 f = gaim_request_field_label_new("l3", _("Your Current Mood"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
665 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
666 f = gaim_request_field_bool_new("mood_normal", _("Normal"), mnormal);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
667 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
668 f = gaim_request_field_bool_new("mood_happy", _("Happy"), mhappy);
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_sad", _("Sad"), msad);
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_angry", _("Angry"), mangry);
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_jealous", _("Jealous"), mjealous);
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_ashamed", _("Ashamed"), mashamed);
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_invincible", _("Invincible"), minvincible);
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_inlove", _("In Love"), minlove);
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_sleepy", _("Sleepy"), msleepy);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
683 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
684 f = gaim_request_field_bool_new("mood_bored", _("Bored"), mbored);
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_excited", _("Excited"), mexcited);
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_anxious", _("Anxious"), manxious);
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
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
691 f = gaim_request_field_label_new("l4", _("\nYour Preferred Contact Methods"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
692 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
693 f = gaim_request_field_bool_new("contact_chat", _("Chat"), cchat);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
694 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
695 f = gaim_request_field_bool_new("contact_email", _("Email"), cemail);
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_call", _("Phone"), ccall);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
698 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
699 f = gaim_request_field_bool_new("contact_sms", _("SMS"), csms);
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_mms", _("MMS"), cmms);
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_video", _("Video Conferencing"), cvideo);
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 gaim_request_fields_add_group(fields, g);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
706
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
707 g = gaim_request_field_group_new(NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
708 f = gaim_request_field_string_new("status_text", _("Your Current Status"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
709 status[0] ? status : NULL, TRUE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
710 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
711 gaim_request_fields_add_group(fields, g);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
712
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
713 g = gaim_request_field_group_new(NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
714 #if 0
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
715 f = gaim_request_field_label_new("l2", _("Online Services"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
716 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
717 f = gaim_request_field_bool_new("services",
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
718 _("Let others see what services you are using"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
719 TRUE);
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 #endif
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
722 #ifdef HAVE_SYS_UTSNAME_H
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
723 f = gaim_request_field_bool_new("device",
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
724 _("Let others see what computer you are using"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
725 device);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
726 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
727 #endif
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
728 gaim_request_fields_add_group(fields, g);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
729
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
730 g = gaim_request_field_group_new(NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
731 f = gaim_request_field_string_new("vcard", _("Your VCard File"),
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
732 gaim_account_get_string(sg->account, "vcard", ""),
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
733 FALSE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
734 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
735 #ifdef _WIN32
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
736 f = gaim_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
737 #else
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
738 f = gaim_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
739 #endif
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
740 gaim_request_field_group_add_field(g, f);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
741 gaim_request_fields_add_group(fields, g);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
742
11201
07dc8c6a359f [gaim-migrate @ 13329]
Mark Doliner <mark@kingant.net>
parents: 11033
diff changeset
743 gaim_request_fields(gc, _("User Online Status Attributes"),
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
744 _("User Online Status Attributes"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
745 _("You can let other users see your online status information "
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
746 "and your personal information. Please fill the information "
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
747 "you would like other users to see about yourself."),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
748 fields,
8906
0d3a68e36132 [gaim-migrate @ 9676]
Nathan Walp <nwalp@pidgin.im>
parents: 8891
diff changeset
749 _("OK"), G_CALLBACK(silcgaim_attrs_cb),
0d3a68e36132 [gaim-migrate @ 9676]
Nathan Walp <nwalp@pidgin.im>
parents: 8891
diff changeset
750 _("Cancel"), G_CALLBACK(silcgaim_attrs_cancel), gc);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
751 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
752
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
753 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
754 silcgaim_detach(GaimPluginAction *action)
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
755 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
756 GaimConnection *gc = (GaimConnection *) action->context;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
757 SilcGaim sg;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
758
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
759 if (!gc)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
760 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
761 sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
762 if (!sg)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
763 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
764
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
765 /* Call DETACH */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
766 silc_client_command_call(sg->client, sg->conn, "DETACH");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
767 sg->detaching = TRUE;
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
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
770 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
771 silcgaim_view_motd(GaimPluginAction *action)
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
772 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
773 GaimConnection *gc = (GaimConnection *) action->context;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
774 SilcGaim sg;
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
775 char *tmp;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
776
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
777 if (!gc)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
778 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
779 sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
780 if (!sg)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
781 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
782
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
783 if (!sg->motd) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
784 gaim_notify_error(
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
785 gc, _("Message of the Day"), _("No Message of the Day available"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
786 _("There is no Message of the Day associated with this connection"));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
787 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
788 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
789
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10547
diff changeset
790 tmp = g_markup_escape_text(sg->motd, -1);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
791 gaim_notify_formatted(gc, NULL, _("Message of the Day"), NULL,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
792 tmp, NULL, NULL);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
793 g_free(tmp);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
794 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
795
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
796 static void
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
797 silcgaim_create_keypair_cancel(GaimConnection *gc, GaimRequestFields *fields)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
798 {
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
799 /* Nothing */
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
800 }
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
801
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
802 static void
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
803 silcgaim_create_keypair_cb(GaimConnection *gc, GaimRequestFields *fields)
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 SilcGaim sg = gc->proto_data;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
806 GaimRequestField *f;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
807 const char *val, *pkfile = NULL, *prfile = NULL;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
808 const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
809 const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
810 char *identifier;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
811 int keylen = SILCGAIM_DEF_PKCS_LEN;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
812 SilcPublicKey public_key;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
813
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
814 sg = gc->proto_data;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
815 if (!sg)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
816 return;
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 val = NULL;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
819 f = gaim_request_fields_get_field(fields, "pass1");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
820 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
821 val = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
822 if (val && *val)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
823 pass1 = val;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
824 else
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
825 pass1 = "";
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
826 val = NULL;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
827 f = gaim_request_fields_get_field(fields, "pass2");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
828 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
829 val = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
830 if (val && *val)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
831 pass2 = val;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
832 else
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
833 pass2 = "";
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
834
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
835 if (strcmp(pass1, pass2)) {
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
836 gaim_notify_error(
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
837 gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
838 return;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
839 }
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
840
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
841 val = NULL;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
842 f = gaim_request_fields_get_field(fields, "key");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
843 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
844 val = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
845 if (val && *val)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
846 keylen = atoi(val);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
847 f = gaim_request_fields_get_field(fields, "pkfile");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
848 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
849 pkfile = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
850 f = gaim_request_fields_get_field(fields, "prfile");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
851 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
852 prfile = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
853
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
854 f = gaim_request_fields_get_field(fields, "un");
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 un = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
857 f = gaim_request_fields_get_field(fields, "hn");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
858 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
859 hn = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
860 f = gaim_request_fields_get_field(fields, "rn");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
861 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
862 rn = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
863 f = gaim_request_fields_get_field(fields, "e");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
864 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
865 e = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
866 f = gaim_request_fields_get_field(fields, "o");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
867 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
868 o = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
869 f = gaim_request_fields_get_field(fields, "c");
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
870 if (f)
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
871 c = gaim_request_field_string_get_value(f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
872
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
873 identifier = silc_pkcs_encode_identifier((char *)un, (char *)hn,
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
874 (char *)rn, (char *)e, (char *)o, (char *)c);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
875
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
876 /* Create the key pair */
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
877 if (!silc_create_key_pair(SILCGAIM_DEF_PKCS, keylen, pkfile, prfile,
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
878 identifier, pass1, NULL, &public_key, NULL,
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
879 FALSE)) {
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
880 gaim_notify_error(
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
881 gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
882 return;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
883 }
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
884
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
885 silcgaim_show_public_key(sg, NULL, public_key, NULL, NULL);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
886
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
887 silc_pkcs_public_key_free(public_key);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
888 silc_free(identifier);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
889 }
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 static void
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
892 silcgaim_create_keypair(GaimPluginAction *action)
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 GaimConnection *gc = (GaimConnection *) action->context;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
895 SilcGaim sg = gc->proto_data;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
896 GaimRequestFields *fields;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
897 GaimRequestFieldGroup *g;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
898 GaimRequestField *f;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
899 const char *username, *realname;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
900 char *hostname, **u;
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
901 char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256];
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
902
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
903 username = gaim_account_get_username(sg->account);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
904 u = g_strsplit(username, "@", 2);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
905 username = u[0];
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
906 realname = gaim_account_get_user_info(sg->account);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
907 hostname = silc_net_localhost();
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
908 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
909
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
910 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
911 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
912 g_snprintf(pkd, sizeof(pkd) - 1, "%s",
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
913 gaim_account_get_string(gc->account, "public-key", pkd2));
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
914 g_snprintf(prd, sizeof(prd) - 1, "%s",
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
915 gaim_account_get_string(gc->account, "private-key", prd2));
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
916
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
917 fields = gaim_request_fields_new();
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
918
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
919 g = gaim_request_field_group_new(NULL);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
920 f = gaim_request_field_string_new("key", _("Key Length"), "2048", FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
921 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
922 f = gaim_request_field_string_new("pkfile", _("Public Key File"), pkd, FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
923 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
924 f = gaim_request_field_string_new("prfile", _("Private Key File"), prd, FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
925 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
926 gaim_request_fields_add_group(fields, g);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
927
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
928 g = gaim_request_field_group_new(NULL);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
929 f = gaim_request_field_string_new("un", _("Username"), username ? username : "", FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
930 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
931 f = gaim_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
932 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
933 f = gaim_request_field_string_new("rn", _("Real Name"), realname ? realname : "", 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("e", _("Email"), tmp, FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
936 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
937 f = gaim_request_field_string_new("o", _("Organization"), "", FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
938 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
939 f = gaim_request_field_string_new("c", _("Country"), "", FALSE);
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 gaim_request_fields_add_group(fields, g);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
942
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
943 g = gaim_request_field_group_new(NULL);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
944 f = gaim_request_field_string_new("pass1", _("Passphrase"), "", FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
945 gaim_request_field_string_set_masked(f, TRUE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
946 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
947 f = gaim_request_field_string_new("pass2", _("Re-type Passphrase"), "", FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
948 gaim_request_field_string_set_masked(f, TRUE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
949 gaim_request_field_group_add_field(g, f);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
950 gaim_request_fields_add_group(fields, g);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
951
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
952 gaim_request_fields(gc, _("Create New SILC Key Pair"),
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
953 _("Create New SILC Key Pair"), NULL, fields,
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
954 _("Generate Key Pair"), G_CALLBACK(silcgaim_create_keypair_cb),
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
955 _("Cancel"), G_CALLBACK(silcgaim_create_keypair_cancel), gc);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
956
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
957 g_strfreev(u);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
958 silc_free(hostname);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
959 }
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 static void
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
962 silcgaim_change_pass(GaimPluginAction *action)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
963 {
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
964 GaimConnection *gc = (GaimConnection *) action->context;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
965 gaim_account_request_change_password(gaim_connection_get_account(gc));
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
966 }
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 static void
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
969 silcgaim_change_passwd(GaimConnection *gc, const char *old, const char *new)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
970 {
10825
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
971 char prd[256];
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
972 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
973 silc_change_private_key_passphrase(gaim_account_get_string(gc->account,
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
974 "private-key",
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
975 prd), old, new);
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
976 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
977
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
978 static void
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
979 silcgaim_show_set_info(GaimPluginAction *action)
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 GaimConnection *gc = (GaimConnection *) action->context;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
982 gaim_account_request_change_user_info(gaim_connection_get_account(gc));
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
983 }
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 static void
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
986 silcgaim_set_info(GaimConnection *gc, const char *text)
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
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
990 static GList *
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
991 silcgaim_actions(GaimPlugin *plugin, gpointer context)
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
992 {
9024
85caba2f820a [gaim-migrate @ 9800]
Tim Ringenbach <marv@pidgin.im>
parents: 9015
diff changeset
993 GaimConnection *gc = context;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
994 GList *list = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
995 GaimPluginAction *act;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
996
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
997 if (!gaim_account_get_bool(gc->account, "reject-attrs", FALSE)) {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
998 act = gaim_plugin_action_new(_("Online Status"),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
999 silcgaim_attrs);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1000 list = g_list_append(list, act);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1001 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1002
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1003 act = gaim_plugin_action_new(_("Detach From Server"),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1004 silcgaim_detach);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1005 list = g_list_append(list, act);
8849
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(_("View Message of the Day"),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1008 silcgaim_view_motd);
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
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1011 act = gaim_plugin_action_new(_("Create SILC Key Pair..."),
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1012 silcgaim_create_keypair);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1013 list = g_list_append(list, act);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1014
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1015 act = gaim_plugin_action_new(_("Change Password..."),
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1016 silcgaim_change_pass);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1017 list = g_list_append(list, act);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1018
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1019 act = gaim_plugin_action_new(_("Set User Info..."),
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1020 silcgaim_show_set_info);
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
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1023 return list;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1024 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1025
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1026
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1027 /******************************* IM Routines *********************************/
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 typedef struct {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1030 char *nick;
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11257
diff changeset
1031 char *message;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1032 SilcUInt32 message_len;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1033 SilcMessageFlags flags;
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1034 GaimMessageFlags gflags;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1035 } *SilcGaimIM;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1036
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1037 static void
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1038 silcgaim_send_im_resolved(SilcClient client,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1039 SilcClientConnection conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1040 SilcClientEntry *clients,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1041 SilcUInt32 clients_count,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1042 void *context)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1043 {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1044 GaimConnection *gc = client->application;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1045 SilcGaim sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1046 SilcGaimIM im = context;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1047 GaimConversation *convo;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1048 char tmp[256], *nickname = NULL;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1049 SilcClientEntry client_entry;
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1050 #ifdef HAVE_SILCMIME_H
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1051 SilcDList list;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1052 #endif
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1053
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11318
diff changeset
1054 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
1055 sg->account);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1056 if (!convo)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1057 return;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1058
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1059 if (!clients)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1060 goto err;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1061
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1062 if (clients_count > 1) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1063 silc_parse_userfqdn(im->nick, &nickname, NULL);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1064
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1065 /* Find the correct one. The im->nick might be a formatted nick
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1066 so this will find the correct one. */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1067 clients = silc_client_get_clients_local(client, conn,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1068 nickname, im->nick,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1069 &clients_count);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1070 if (!clients)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1071 goto err;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1072 client_entry = clients[0];
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1073 silc_free(clients);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1074 } else {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1075 client_entry = clients[0];
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1076 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1077
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1078 #ifdef HAVE_SILCMIME_H
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1079 /* Check for images */
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1080 if (im->gflags & GAIM_MESSAGE_IMAGES) {
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1081 list = silcgaim_image_message(im->message, (SilcUInt32 *)&im->flags);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1082 if (list) {
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1083 /* Send one or more MIME message. If more than one, they
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1084 are MIME fragments due to over large message */
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1085 SilcBuffer buf;
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1086
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1087 silc_dlist_start(list);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1088 while ((buf = silc_dlist_get(list)) != SILC_LIST_END)
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1089 silc_client_send_private_message(client, conn,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1090 client_entry, im->flags,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1091 buf->data, buf->len,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1092 TRUE);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1093 silc_mime_partial_free(list);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1094 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
1095 im->message, 0, time(NULL));
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1096 goto out;
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1097 }
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1098 }
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1099 #endif
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1100
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1101 /* Send the message */
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1102 silc_client_send_private_message(client, conn, client_entry, im->flags,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1103 (unsigned char *)im->message, im->message_len, TRUE);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1104 gaim_conv_im_write(GAIM_CONV_IM(convo), conn->local_entry->nickname,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1105 im->message, 0, time(NULL));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1106 goto out;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1107
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1108 err:
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1109 g_snprintf(tmp, sizeof(tmp),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1110 _("User <I>%s</I> is not present in the network"), im->nick);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1111 gaim_conversation_write(convo, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1112
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1113 out:
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1114 g_free(im->nick);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1115 g_free(im->message);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1116 silc_free(im);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1117 silc_free(nickname);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1118 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1119
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1120 static int
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1121 silcgaim_send_im(GaimConnection *gc, const char *who, const char *message,
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1122 GaimMessageFlags flags)
8849
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 SilcGaim sg = gc->proto_data;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1125 SilcClient client = sg->client;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1126 SilcClientConnection conn = sg->conn;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1127 SilcClientEntry *clients;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1128 SilcUInt32 clients_count, mflags;
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1129 char *nickname, *msg, *tmp;
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1130 int ret = 0;
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1131 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
1132 #ifdef HAVE_SILCMIME_H
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1133 SilcDList list;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1134 #endif
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1135
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1136 if (!who || !message)
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1137 return 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1138
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1139 mflags = SILC_MESSAGE_FLAG_UTF8;
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1140
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1141 tmp = msg = gaim_unescape_html(message);
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1142
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1143 if (!g_ascii_strncasecmp(msg, "/me ", 4)) {
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1144 msg += 4;
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1145 if (!*msg) {
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1146 g_free(tmp);
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1147 return 0;
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1148 }
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1149 mflags |= SILC_MESSAGE_FLAG_ACTION;
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1150 } else if (strlen(msg) > 1 && msg[0] == '/') {
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1151 if (!silc_client_command_call(client, conn, msg + 1))
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1152 gaim_notify_error(gc, ("Call Command"), _("Cannot call command"),
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1153 _("Unknown command"));
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1154 g_free(tmp);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1155 return 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1156 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1157
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1158
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1159 if (!silc_parse_userfqdn(who, &nickname, NULL)) {
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1160 g_free(tmp);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1161 return 0;
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1162 }
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1163
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1164 if (sign)
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1165 mflags |= SILC_MESSAGE_FLAG_SIGNED;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1166
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1167 /* Find client entry */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1168 clients = silc_client_get_clients_local(client, conn, nickname, who,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1169 &clients_count);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1170 if (!clients) {
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1171 /* Resolve unknown user */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1172 SilcGaimIM im = silc_calloc(1, sizeof(*im));
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1173 if (!im) {
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1174 g_free(tmp);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1175 return 0;
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1176 }
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1177 im->nick = g_strdup(who);
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1178 im->message = g_strdup(message);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1179 im->message_len = strlen(im->message);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1180 im->flags = mflags;
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1181 im->gflags = flags;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1182 silc_client_get_clients(client, conn, nickname, NULL,
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1183 silcgaim_send_im_resolved, im);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1184 silc_free(nickname);
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1185 g_free(tmp);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1186 return 0;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1187 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1188
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1189 #ifdef HAVE_SILCMIME_H
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1190 /* Check for images */
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1191 if (flags & GAIM_MESSAGE_IMAGES) {
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1192 list = silcgaim_image_message(message, &mflags);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1193 if (list) {
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1194 /* Send one or more MIME message. If more than one, they
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1195 are MIME fragments due to over large message */
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1196 SilcBuffer buf;
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1197
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1198 silc_dlist_start(list);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1199 while ((buf = silc_dlist_get(list)) != SILC_LIST_END)
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1200 ret =
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1201 silc_client_send_private_message(client, conn,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1202 clients[0], mflags,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1203 buf->data, buf->len,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1204 TRUE);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1205 silc_mime_partial_free(list);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1206 g_free(tmp);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1207 silc_free(nickname);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1208 silc_free(clients);
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1209 return ret;
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1210 }
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1211 }
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1212 #endif
12303
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1213
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1214 /* Send private message directly */
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1215 ret = silc_client_send_private_message(client, conn, clients[0],
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1216 mflags,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1217 (unsigned char *)msg,
01f689cd7b49 [gaim-migrate @ 14607]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12217
diff changeset
1218 strlen(msg), TRUE);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1219
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12167
diff changeset
1220 g_free(tmp);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1221 silc_free(nickname);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1222 silc_free(clients);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1223 return ret;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1224 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1225
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1226
12325
33026deed1ce [gaim-migrate @ 14629]
Richard Laager <rlaager@wiktel.com>
parents: 12303
diff changeset
1227 static GList *silcgaim_blist_node_menu(GaimBlistNode *node) {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1228 /* split this single menu building function back into the two
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1229 original: one for buddies and one for chats */
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1230
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1231 if(GAIM_BLIST_NODE_IS_CHAT(node)) {
9038
095731b5e4f6 [gaim-migrate @ 9814]
Tim Ringenbach <marv@pidgin.im>
parents: 9030
diff changeset
1232 return silcgaim_chat_menu((GaimChat *) node);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1233 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1234 return silcgaim_buddy_menu((GaimBuddy *) node);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1235 } else {
9038
095731b5e4f6 [gaim-migrate @ 9814]
Tim Ringenbach <marv@pidgin.im>
parents: 9030
diff changeset
1236 g_return_val_if_reached(NULL);
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1237 }
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1238 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1239
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1240 /********************************* Commands **********************************/
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1241
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1242 static GaimCmdRet silcgaim_cmd_chat_part(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1243 const char *cmd, char **args, char **error, void *data)
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1244 {
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1245 GaimConnection *gc;
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1246 GaimConversation *convo;
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1247 int id = 0;
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 gc = gaim_conversation_get_gc(conv);
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1250
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1251 if (gc == NULL)
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1252 return GAIM_CMD_RET_FAILED;
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1253
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1254 if(args && args[0]) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11318
diff changeset
1255 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
1256 gc->account);
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1257 } else
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1258 convo = conv;
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1259
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1260 id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo));
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1261
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1262 if (id == 0)
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1263 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1264
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1265 silcgaim_chat_leave(gc, id);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1266
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1267 return GAIM_CMD_RET_OK;
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 }
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 static GaimCmdRet silcgaim_cmd_chat_topic(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1272 const char *cmd, char **args, char **error, void *data)
9272
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 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1275 int id = 0;
9762
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9754
diff changeset
1276 char *buf, *tmp, *tmp2;
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1277 const char *topic;
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1278
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1279 gc = gaim_conversation_get_gc(conv);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1280 id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv));
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1281
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1282 if (gc == NULL || id == 0)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1283 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1284
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1285 if (!args || !args[0]) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1286 topic = gaim_conv_chat_get_topic (GAIM_CONV_CHAT(conv));
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1287 if (topic) {
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10547
diff changeset
1288 tmp = g_markup_escape_text(topic, -1);
9762
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9754
diff changeset
1289 tmp2 = gaim_markup_linkify(tmp);
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9754
diff changeset
1290 buf = g_strdup_printf(_("current topic is: %s"), tmp2);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1291 g_free(tmp);
9762
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9754
diff changeset
1292 g_free(tmp2);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1293 } else
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1294 buf = g_strdup(_("No topic is set"));
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1295 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
1296 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1297 g_free(buf);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1298
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1299 }
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1300
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1301 if (args && args[0] && (strlen(args[0]) > 255)) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1302 *error = g_strdup(_("Topic too long"));
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1303 return GAIM_CMD_RET_FAILED;
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
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1306 silcgaim_chat_set_topic(gc, id, args ? args[0] : NULL);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1307
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1308 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1309 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1310
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1311 static GaimCmdRet silcgaim_cmd_chat_join(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1312 const char *cmd, char **args, char **error, void *data)
9272
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 GHashTable *comp;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1315
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1316 if(!args || !args[0])
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1317 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1318
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1319 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
1320
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1321 g_hash_table_replace(comp, "channel", args[0]);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1322 if(args[1])
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1323 g_hash_table_replace(comp, "passphrase", args[1]);
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 silcgaim_chat_join(gaim_conversation_get_gc(conv), comp);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1326
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1327 g_hash_table_destroy(comp);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1328 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1329 }
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 static GaimCmdRet silcgaim_cmd_chat_list(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1332 const char *cmd, char **args, char **error, void *data)
9272
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 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1335 gc = gaim_conversation_get_gc(conv);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1336 gaim_roomlist_show_with_account(gaim_connection_get_account(gc));
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1337 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1338 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1339
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1340 static GaimCmdRet silcgaim_cmd_whois(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1341 const char *cmd, char **args, char **error, void *data)
9272
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 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1344
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1345 gc = gaim_conversation_get_gc(conv);
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 if (gc == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1348 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1349
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1350 silcgaim_get_info(gc, args[0]);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1351
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1352 return GAIM_CMD_RET_OK;
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
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1355 static GaimCmdRet silcgaim_cmd_msg(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1356 const char *cmd, char **args, char **error, void *data)
9272
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 int ret;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1359 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1360
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1361 gc = gaim_conversation_get_gc(conv);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1362
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1363 if (gc == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1364 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1365
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1366 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
1367
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1368 if (ret)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1369 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1370 else
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1371 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1372 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1373
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1374 static GaimCmdRet silcgaim_cmd_query(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1375 const char *cmd, char **args, char **error, void *data)
9272
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 int ret = 1;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1378 GaimConversation *convo;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1379 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1380 GaimAccount *account;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1381
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1382 if (!args || !args[0]) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1383 *error = g_strdup(_("You must specify a nick"));
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1384 return GAIM_CMD_RET_FAILED;
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1385 }
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1386
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1387 gc = gaim_conversation_get_gc(conv);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1388
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1389 if (gc == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1390 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1391
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1392 account = gaim_connection_get_account(gc);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1393
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11318
diff changeset
1394 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
1395
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1396 if (args[1]) {
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1397 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
1398 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
1399 args[1], GAIM_MESSAGE_SEND, time(NULL));
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1400 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1401
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1402 if (ret)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1403 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1404 else
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1405 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1406 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1407
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1408 static GaimCmdRet silcgaim_cmd_motd(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1409 const char *cmd, char **args, char **error, void *data)
9272
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 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1412 SilcGaim sg;
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1413 char *tmp;
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 gc = gaim_conversation_get_gc(conv);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1416
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1417 if (gc == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1418 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1419
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1420 sg = gc->proto_data;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1421
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1422 if (sg == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1423 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1424
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1425 if (!sg->motd) {
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1426 *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
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
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10547
diff changeset
1430 tmp = g_markup_escape_text(sg->motd, -1);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1431 gaim_notify_formatted(gc, NULL, _("Message of the Day"), NULL,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1432 tmp, NULL, NULL);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1433 g_free(tmp);
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1434
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1435 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1436 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1437
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1438 static GaimCmdRet silcgaim_cmd_detach(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1439 const char *cmd, char **args, char **error, void *data)
9272
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 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1442 SilcGaim sg;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1443
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1444 gc = gaim_conversation_get_gc(conv);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1445
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1446 if (gc == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1447 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1448
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1449 sg = gc->proto_data;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1450
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1451 if (sg == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1452 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1453
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1454 silc_client_command_call(sg->client, sg->conn, "DETACH");
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1455 sg->detaching = TRUE;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1456
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1457 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1458 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1459
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1460 static GaimCmdRet silcgaim_cmd_cmode(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1461 const char *cmd, char **args, char **error, void *data)
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1462 {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1463 GaimConnection *gc;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1464 SilcGaim sg;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1465 SilcChannelEntry channel;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1466 char *silccmd, *silcargs, *msg, tmp[256];
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1467 const char *chname;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1468
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1469 gc = gaim_conversation_get_gc(conv);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1470
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1471 if (gc == NULL || !args || gc->proto_data == NULL)
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1472 return GAIM_CMD_RET_FAILED;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1473
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1474 sg = gc->proto_data;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1475
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1476 if (args[0])
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1477 chname = args[0];
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1478 else
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1479 chname = gaim_conversation_get_name(conv);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1480
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1481 if (!args[1]) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1482 channel = silc_client_get_channel(sg->client, sg->conn,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1483 (char *)chname);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1484 if (!channel) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1485 *error = g_strdup_printf(_("channel %s not found"), chname);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1486 return GAIM_CMD_RET_FAILED;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1487 }
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1488 if (channel->mode) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1489 silcgaim_get_chmode_string(channel->mode, tmp, sizeof(tmp));
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1490 msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1491 } else {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1492 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
1493 }
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1494 gaim_conv_chat_write(GAIM_CONV_CHAT(conv), "",
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1495 msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1496 g_free(msg);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1497 return GAIM_CMD_RET_OK;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1498 }
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1499
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1500 silcargs = g_strjoinv(" ", args);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1501 silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1502 g_free(silcargs);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1503 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1504 g_free(silccmd);
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1505 *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
1506 return GAIM_CMD_RET_FAILED;
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1507 }
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
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1510 return GAIM_CMD_RET_OK;
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
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1513 static GaimCmdRet silcgaim_cmd_generic(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1514 const char *cmd, char **args, char **error, void *data)
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1515 {
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1516 GaimConnection *gc;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1517 SilcGaim sg;
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1518 char *silccmd, *silcargs;
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 gc = gaim_conversation_get_gc(conv);
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1521
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1522 if (gc == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1523 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1524
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1525 sg = gc->proto_data;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1526
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1527 if (sg == NULL)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1528 return GAIM_CMD_RET_FAILED;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1529
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1530 silcargs = g_strjoinv(" ", args);
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1531 silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL);
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1532 g_free(silcargs);
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1533 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) {
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1534 g_free(silccmd);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1535 *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
1536 return GAIM_CMD_RET_FAILED;
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1537 }
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1538 g_free(silccmd);
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1539
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1540 return GAIM_CMD_RET_OK;
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1541 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1542
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1543 static GaimCmdRet silcgaim_cmd_quit(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1544 const char *cmd, char **args, char **error, void *data)
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1545 {
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1546 GaimConnection *gc;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1547 SilcGaim sg;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1548
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1549 gc = gaim_conversation_get_gc(conv);
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1550
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1551 if (gc == NULL)
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1552 return GAIM_CMD_RET_FAILED;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1553
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1554 sg = gc->proto_data;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1555
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1556 if (sg == NULL)
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1557 return GAIM_CMD_RET_FAILED;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1558
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1559 silc_client_command_call(sg->client, sg->conn, NULL,
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1560 "QUIT", (args && args[0]) ? args[0] : "Download Gaim: " GAIM_WEBSITE, NULL);
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1561
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1562 return GAIM_CMD_RET_OK;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1563 }
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1564
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1565 static GaimCmdRet silcgaim_cmd_call(GaimConversation *conv,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1566 const char *cmd, char **args, char **error, void *data)
9359
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 GaimConnection *gc;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1569 SilcGaim sg;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1570
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1571 gc = gaim_conversation_get_gc(conv);
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1572
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1573 if (gc == NULL)
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1574 return GAIM_CMD_RET_FAILED;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1575
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1576 sg = gc->proto_data;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1577
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1578 if (sg == NULL)
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1579 return GAIM_CMD_RET_FAILED;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1580
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1581 if (!silc_client_command_call(sg->client, sg->conn, args[0])) {
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1582 *error = g_strdup_printf(_("Unknown command: %s"), args[0]);
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1583 return GAIM_CMD_RET_FAILED;
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1584 }
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1585
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1586 return GAIM_CMD_RET_OK;
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1587 }
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1588
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9024
diff changeset
1589
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1590 /************************** Plugin Initialization ****************************/
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1591
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1592 static void
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1593 silcgaim_register_commands(void)
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1594 {
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1595 gaim_cmd_register("part", "w", GAIM_CMD_P_PRPL,
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1596 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT |
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1597 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
1598 "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
1599 gaim_cmd_register("leave", "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, _("leave [channel]: Leave the chat"), NULL);
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1603 gaim_cmd_register("topic", "s", GAIM_CMD_P_PRPL,
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1604 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1605 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc",
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1606 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
1607 gaim_cmd_register("join", "ws", GAIM_CMD_P_PRPL,
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1608 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT |
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1609 GAIM_CMD_FLAG_PRPL_ONLY | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS,
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1610 "prpl-silc", silcgaim_cmd_chat_join,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1611 _("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
1612 gaim_cmd_register("list", "", GAIM_CMD_P_PRPL,
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1613 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
1614 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc",
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1615 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
1616 gaim_cmd_register("whois", "w", 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 "prpl-silc",
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1619 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
1620 gaim_cmd_register("msg", "ws", 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", silcgaim_cmd_msg,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1623 _("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
1624 gaim_cmd_register("query", "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 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
1627 _("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
1628 gaim_cmd_register("motd", "", 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_motd,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1631 _("motd: View the server's Message Of The Day"), NULL);
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1632 gaim_cmd_register("detach", "", GAIM_CMD_P_PRPL,
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1633 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
1634 "prpl-silc", silcgaim_cmd_detach,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1635 _("detach: Detach this session"), NULL);
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1636 gaim_cmd_register("quit", "s", GAIM_CMD_P_PRPL,
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1637 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
1638 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
1639 _("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
1640 gaim_cmd_register("call", "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 "prpl-silc", silcgaim_cmd_call,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1643 _("call &lt;command&gt;: Call any silc client command"), NULL);
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1644 /* 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
1645 * with */
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1646 gaim_cmd_register("kill", "ws", GAIM_CMD_P_PRPL,
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1647 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
1648 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
1649 _("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
1650 gaim_cmd_register("nick", "w", 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 "prpl-silc", silcgaim_cmd_generic,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1653 _("nick &lt;newnick&gt;: Change your nickname"), NULL);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1654 gaim_cmd_register("whowas", "ww", GAIM_CMD_P_PRPL,
9359
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 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
1657 _("whowas &lt;nick&gt;: View nick's information"), NULL);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1658 gaim_cmd_register("cmode", "wws", GAIM_CMD_P_PRPL,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1659 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1660 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
1661 _("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
1662 gaim_cmd_register("cumode", "wws", GAIM_CMD_P_PRPL,
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1663 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
1664 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
1665 _("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
1666 gaim_cmd_register("umode", "w", GAIM_CMD_P_PRPL,
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1667 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
1668 "prpl-silc", silcgaim_cmd_generic,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1669 _("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
1670 gaim_cmd_register("oper", "s", GAIM_CMD_P_PRPL,
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1671 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
1672 "prpl-silc", silcgaim_cmd_generic,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1673 _("oper &lt;nick&gt; [-pubkey]: Get server operator privileges"), NULL);
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1674 gaim_cmd_register("invite", "ws", 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 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
1677 _("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
1678 gaim_cmd_register("kick", "wws", 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 _("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
1682 gaim_cmd_register("info", "w", GAIM_CMD_P_PRPL,
9359
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 _("info [server]: View server administrative details"), NULL);
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1686 gaim_cmd_register("ban", "ww", GAIM_CMD_P_PRPL,
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 _("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
1690 gaim_cmd_register("getkey", "w", GAIM_CMD_P_PRPL,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1691 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
1692 "prpl-silc", silcgaim_cmd_generic,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1693 _("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
1694 gaim_cmd_register("stats", "", 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 _("stats: View server and network statistics"), NULL);
9359
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1698 gaim_cmd_register("ping", "", GAIM_CMD_P_PRPL,
43741d8f76f7 [gaim-migrate @ 10167]
Ethan Blanton <elb@pidgin.im>
parents: 9353
diff changeset
1699 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
1700 "prpl-silc", silcgaim_cmd_generic,
9597
d6f398e80b32 [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1701 _("ping: Send PING to the connected server"), NULL);
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1702 #if 0 /* Gaim doesn't handle these yet */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1703 gaim_cmd_register("users", "w", GAIM_CMD_P_PRPL,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1704 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1705 "prpl-silc", silcgaim_cmd_users,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1706 _("users &lt;channel&gt;: List users in channel"));
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1707 gaim_cmd_register("names", "ww", 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 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_names,
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1710 _("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
1711 #endif
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1712 }
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1713
12058
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1714 static GaimWhiteboardPrplOps silcgaim_wb_ops =
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1715 {
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1716 silcgaim_wb_start,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1717 silcgaim_wb_end,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1718 silcgaim_wb_get_dimensions,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1719 silcgaim_wb_set_dimensions,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1720 silcgaim_wb_get_brush,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1721 silcgaim_wb_set_brush,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1722 silcgaim_wb_send,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1723 silcgaim_wb_clear,
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1724 };
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1725
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1726 static GaimPluginProtocolInfo prpl_info =
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1727 {
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1728 #ifdef HAVE_SILCMIME_H
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1729 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME |
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1730 OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE,
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1731 #else
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1732 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME |
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1733 OPT_PROTO_PASSWORD_OPTIONAL,
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1734 #endif
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1735 NULL, /* user_splits */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1736 NULL, /* protocol_options */
12761
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1737 #ifdef SILC_ATTRIBUTE_USER_ICON
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1738 {"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
1739 #else
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1740 NO_BUDDY_ICONS,
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1741 #endif
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1742 silcgaim_list_icon, /* list_icon */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1743 silcgaim_list_emblems, /* list_emblems */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1744 silcgaim_status_text, /* status_text */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1745 silcgaim_tooltip_text, /* tooltip_text */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1746 silcgaim_away_states, /* away_states */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1747 silcgaim_blist_node_menu, /* blist_node_menu */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1748 silcgaim_chat_info, /* chat_info */
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9732
diff changeset
1749 silcgaim_chat_info_defaults,/* chat_info_defaults */
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1750 silcgaim_login, /* login */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1751 silcgaim_close, /* close */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1752 silcgaim_send_im, /* send_im */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1753 silcgaim_set_info, /* set_info */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1754 NULL, /* send_typing */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1755 silcgaim_get_info, /* get_info */
9968
67468d443cd1 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
1756 silcgaim_set_status, /* set_status */
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1757 silcgaim_idle_set, /* set_idle */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1758 silcgaim_change_passwd, /* change_passwd */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1759 silcgaim_add_buddy, /* add_buddy */
10869
3e43c132f151 [gaim-migrate @ 12556]
Mark Doliner <mark@kingant.net>
parents: 10825
diff changeset
1760 NULL, /* add_buddies */
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1761 silcgaim_remove_buddy, /* remove_buddy */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1762 NULL, /* remove_buddies */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1763 NULL, /* add_permit */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1764 NULL, /* add_deny */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1765 NULL, /* rem_permit */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1766 NULL, /* rem_deny */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1767 NULL, /* set_permit_deny */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1768 silcgaim_chat_join, /* join_chat */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1769 NULL, /* reject_chat */
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9762
diff changeset
1770 silcgaim_get_chat_name, /* get_chat_name */
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1771 silcgaim_chat_invite, /* chat_invite */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1772 silcgaim_chat_leave, /* chat_leave */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1773 NULL, /* chat_whisper */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1774 silcgaim_chat_send, /* chat_send */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1775 silcgaim_keepalive, /* keepalive */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1776 NULL, /* register_user */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1777 NULL, /* get_cb_info */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1778 NULL, /* get_cb_away */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1779 NULL, /* alias_buddy */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1780 NULL, /* group_buddy */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1781 NULL, /* rename_group */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1782 NULL, /* buddy_free */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1783 NULL, /* convo_closed */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1784 NULL, /* normalize */
12761
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1785 #ifdef SILC_ATTRIBUTE_USER_ICON
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1786 silcgaim_buddy_set_icon, /* set_buddy_icon */
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1787 #else
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1788 NULL,
95a73ce6e285 [gaim-migrate @ 15108]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12658
diff changeset
1789 #endif
9488
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1790 NULL, /* remove_group */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1791 NULL, /* get_cb_real_name */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1792 silcgaim_chat_set_topic, /* set_chat_topic */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1793 NULL, /* find_blist_chat */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1794 silcgaim_roomlist_get_list, /* roomlist_get_list */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1795 silcgaim_roomlist_cancel, /* roomlist_cancel */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1796 NULL, /* roomlist_expand_category */
2770a0e659ca [gaim-migrate @ 10313]
Ethan Blanton <elb@pidgin.im>
parents: 9466
diff changeset
1797 NULL, /* can_receive_file */
12058
d5daff460913 [gaim-migrate @ 14353]
Ethan Blanton <elb@pidgin.im>
parents: 11837
diff changeset
1798 silcgaim_ftp_send_file, /* send_file */
12143
cbebda5f019c [gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents: 12130
diff changeset
1799 silcgaim_ftp_new_xfer, /* new_xfer */
12645
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
1800 NULL, /* offline_message */
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12595
diff changeset
1801 &silcgaim_wb_ops, /* whiteboard_prpl_ops */
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12595
diff changeset
1802 NULL, /* media_prpl_ops */
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1803 };
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1804
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1805 static GaimPluginInfo info =
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1806 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9917
diff changeset
1807 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9917
diff changeset
1808 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9917
diff changeset
1809 GAIM_MINOR_VERSION,
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1810 GAIM_PLUGIN_PROTOCOL, /**< type */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1811 NULL, /**< ui_requirement */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1812 0, /**< flags */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1813 NULL, /**< dependencies */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1814 GAIM_PRIORITY_DEFAULT, /**< priority */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1815
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1816 "prpl-silc", /**< id */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1817 "SILC", /**< name */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1818 "1.0", /**< version */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1819 /** summary */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1820 N_("SILC Protocol Plugin"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1821 /** description */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1822 N_("Secure Internet Live Conferencing (SILC) Protocol"),
8891
4f7c365c5c5a [gaim-migrate @ 9660]
Mark Doliner <mark@kingant.net>
parents: 8849
diff changeset
1823 "Pekka Riikonen", /**< author */
4f7c365c5c5a [gaim-migrate @ 9660]
Mark Doliner <mark@kingant.net>
parents: 8849
diff changeset
1824 "http://silcnet.org/", /**< homepage */
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1825
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1826 NULL, /**< load */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1827 NULL, /**< unload */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1828 NULL, /**< destroy */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1829
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1830 NULL, /**< ui_info */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1831 &prpl_info, /**< extra_info */
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1832 NULL, /**< prefs_info */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
1833 silcgaim_actions
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1834 };
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1835
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1836 static void
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1837 init_plugin(GaimPlugin *plugin)
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 GaimAccountOption *option;
10825
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
1840 GaimAccountUserSplit *split;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1841 char tmp[256];
12217
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1842 int i;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1843 GaimKeyValuePair *kvp;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1844 GList *list = NULL;
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1845
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1846 silc_plugin = plugin;
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1847
10825
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
1848 split = gaim_account_user_split_new(_("Network"), "silcnet.org", '@');
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
1849 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
1850
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1851 /* Account options */
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1852 option = gaim_account_option_string_new(_("Connect server"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1853 "server",
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1854 "silc.silcnet.org");
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1855 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1856 option = gaim_account_option_int_new(_("Port"), "port", 706);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1857 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
1858 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
1859 option = gaim_account_option_string_new(_("Public Key file"),
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
1860 "public-key", tmp);
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
1861 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
1862 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
1863 option = gaim_account_option_string_new(_("Private Key file"),
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
1864 "private-key", tmp);
cb625efd1071 [gaim-migrate @ 12490]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10802
diff changeset
1865 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
1866
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1867 for (i = 0; silc_default_ciphers[i].name; i++) {
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1868 kvp = silc_calloc(1, sizeof(*kvp));
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1869 kvp->key = strdup(silc_default_ciphers[i].name);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1870 kvp->value = strdup(silc_default_ciphers[i].name);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1871 list = g_list_append(list, kvp);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1872 }
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1873 option = gaim_account_option_list_new(_("Cipher"), "cipher", list);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1874 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
1875
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1876 list = NULL;
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1877 for (i = 0; silc_default_hmacs[i].name; i++) {
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1878 kvp = silc_calloc(1, sizeof(*kvp));
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1879 kvp->key = strdup(silc_default_hmacs[i].name);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1880 kvp->value = strdup(silc_default_hmacs[i].name);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1881 list = g_list_append(list, kvp);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1882 }
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1883 option = gaim_account_option_list_new(_("HMAC"), "hmac", list);
029802981b81 [gaim-migrate @ 14519]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12216
diff changeset
1884 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
1885
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1886 option = gaim_account_option_bool_new(_("Public key authentication"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1887 "pubkey-auth", FALSE);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1888 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1889 option = gaim_account_option_bool_new(_("Reject watching by other users"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1890 "reject-watch", 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(_("Block invites"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1893 "block-invites", 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 IMs without Key Exchange"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1896 "block-ims", 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(_("Reject online status attribute requests"),
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1899 "reject-attrs", 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);
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1901 option = gaim_account_option_bool_new(_("Block messages to whiteboard"),
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1902 "block-wb", FALSE);
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1903 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
1904 option = gaim_account_option_bool_new(_("Automatically open whiteboard"),
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1905 "open-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(_("Digitally sign and verify all messages"),
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1908 "sign-verify", 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);
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1910
12167
5851a9219bc7 [gaim-migrate @ 14468]
Ethan Blanton <elb@pidgin.im>
parents: 12149
diff changeset
1911 gaim_prefs_remove("/plugins/prpl/silc");
9272
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1912
ac4480944fc3 [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1913 silcgaim_register_commands();
9353
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1914
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1915 #ifdef _WIN32
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1916 silc_net_win32_init();
b8138f3959dc [gaim-migrate @ 10161]
Ethan Blanton <elb@pidgin.im>
parents: 9308
diff changeset
1917 #endif
8849
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1918 }
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1919
50d0f76639e7 [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1920 GAIM_INIT_PLUGIN(silc, init_plugin, info);