Tue, 10 Sep 2013 22:32:40 +0200
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
| 8849 | 1 | /* |
| 2 | ||
| 15884 | 3 | silcpurple.c |
| 8849 | 4 | |
| 5 | Author: Pekka Riikonen <priikone@silcnet.org> | |
| 6 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
7 | Copyright (C) 2004 - 2007 Pekka Riikonen |
| 8849 | 8 | |
| 9 | This program is free software; you can redistribute it and/or modify | |
| 10 | it under the terms of the GNU General Public License as published by | |
| 11 | the Free Software Foundation; version 2 of the License. | |
| 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | GNU General Public License for more details. | |
| 17 | ||
| 18 | */ | |
| 19 | ||
|
28981
4e3922ab4844
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents:
27879
diff
changeset
|
20 | #include "internal.h" |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
21 | #include "silc.h" |
| 8849 | 22 | #include "silcclient.h" |
| 15884 | 23 | #include "silcpurple.h" |
| 9943 | 24 | #include "version.h" |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
25 | #include "wb.h" |
|
23551
b6109bbbbe6c
Added include for "core.h" to silc. Fix from phroggie, thanks. Fixes #6227
Evan Schoenberg <evands@pidgin.im>
parents:
23545
diff
changeset
|
26 | #include "core.h" |
| 8849 | 27 | |
| 28 | extern SilcClientOperations ops; | |
| 15884 | 29 | static PurplePlugin *silc_plugin = NULL; |
| 8849 | 30 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
31 | /* Error log message callback */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
32 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
33 | static SilcBool silcpurple_log_error(SilcLogType type, char *message, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
34 | void *context) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
35 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
36 | silc_say(NULL, NULL, SILC_CLIENT_MESSAGE_ERROR, message); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
37 | return TRUE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
38 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
39 | |
| 8849 | 40 | static const char * |
| 15884 | 41 | silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b) |
| 8849 | 42 | { |
| 43 | return (const char *)"silc"; | |
| 44 | } | |
| 45 | ||
| 46 | static GList * | |
| 15884 | 47 | silcpurple_away_states(PurpleAccount *account) |
| 8849 | 48 | { |
| 15884 | 49 | PurpleStatusType *type; |
| 9968 | 50 | GList *types = NULL; |
| 8849 | 51 | |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25545
diff
changeset
|
52 | type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE); |
| 9968 | 53 | types = g_list_append(types, type); |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25545
diff
changeset
|
54 | type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE); |
| 9968 | 55 | types = g_list_append(types, type); |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25545
diff
changeset
|
56 | type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE); |
| 9968 | 57 | types = g_list_append(types, type); |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25545
diff
changeset
|
58 | type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE); |
| 9968 | 59 | types = g_list_append(types, type); |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25545
diff
changeset
|
60 | type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE); |
| 9968 | 61 | types = g_list_append(types, type); |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25545
diff
changeset
|
62 | type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE); |
| 9968 | 63 | types = g_list_append(types, type); |
|
25552
ffd94785b2ad
For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25545
diff
changeset
|
64 | type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE); |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
65 | types = g_list_append(types, type); |
| 8849 | 66 | |
| 9968 | 67 | return types; |
| 8849 | 68 | } |
| 69 | ||
| 70 | static void | |
| 15884 | 71 | silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) |
| 8849 | 72 | { |
| 15884 | 73 | PurpleConnection *gc = purple_account_get_connection(account); |
| 74 | SilcPurple sg = NULL; | |
| 8849 | 75 | SilcUInt32 mode; |
| 76 | SilcBuffer idp; | |
| 77 | unsigned char mb[4]; | |
| 9968 | 78 | const char *state; |
| 8849 | 79 | |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
80 | if (gc != NULL) |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
81 | sg = purple_connection_get_protocol_data(gc); |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
82 | |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
83 | if (status == NULL) |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
84 | return; |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
85 | |
| 15884 | 86 | state = purple_status_get_id(status); |
|
10225
0dfea1bc8695
[gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10050
diff
changeset
|
87 | |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
88 | if (state == NULL) |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
89 | return; |
|
10225
0dfea1bc8695
[gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10050
diff
changeset
|
90 | |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
91 | if ((sg == NULL) || (sg->conn == NULL)) |
| 8849 | 92 | return; |
| 93 | ||
| 94 | mode = sg->conn->local_entry->mode; | |
| 95 | mode &= ~(SILC_UMODE_GONE | | |
| 96 | SILC_UMODE_HYPER | | |
| 97 | SILC_UMODE_BUSY | | |
| 98 | SILC_UMODE_INDISPOSED | | |
| 99 | SILC_UMODE_PAGE); | |
| 100 | ||
| 9968 | 101 | if (!strcmp(state, "hyper")) |
| 8849 | 102 | mode |= SILC_UMODE_HYPER; |
| 9968 | 103 | else if (!strcmp(state, "away")) |
| 8849 | 104 | mode |= SILC_UMODE_GONE; |
| 9968 | 105 | else if (!strcmp(state, "busy")) |
| 8849 | 106 | mode |= SILC_UMODE_BUSY; |
| 9968 | 107 | else if (!strcmp(state, "indisposed")) |
| 8849 | 108 | mode |= SILC_UMODE_INDISPOSED; |
| 9968 | 109 | else if (!strcmp(state, "page")) |
| 8849 | 110 | mode |= SILC_UMODE_PAGE; |
| 111 | ||
| 112 | /* Send UMODE */ | |
| 113 | idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); | |
| 114 | SILC_PUT32_MSB(mode, mb); | |
| 115 | silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
116 | silcpurple_command_reply, NULL, 2, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
117 | 1, idp->data, silc_buffer_len(idp), |
| 8849 | 118 | 2, mb, sizeof(mb)); |
| 119 | silc_buffer_free(idp); | |
| 120 | } | |
| 121 | ||
| 122 | ||
| 123 | /*************************** Connection Routines *****************************/ | |
| 124 | ||
| 125 | static void | |
| 15884 | 126 | silcpurple_keepalive(PurpleConnection *gc) |
| 8849 | 127 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
128 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
129 | silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
130 | NULL, 0); |
| 8849 | 131 | } |
| 132 | ||
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
133 | #if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) |
|
17566
687225d827a2
300 milliseconds apparently works on win32 for the SILC scheduler, let's
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17564
diff
changeset
|
134 | static gboolean |
| 15884 | 135 | silcpurple_scheduler(gpointer *context) |
| 8849 | 136 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
137 | SilcClient client = (SilcClient)context; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
138 | silc_client_run_one(client); |
|
17566
687225d827a2
300 milliseconds apparently works on win32 for the SILC scheduler, let's
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17564
diff
changeset
|
139 | return TRUE; |
| 8849 | 140 | } |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
141 | #else |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
142 | typedef struct { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
143 | SilcPurple sg; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
144 | SilcUInt32 fd; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
145 | guint tag; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
146 | } *SilcPurpleTask; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
147 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
148 | /* A timeout occurred. Call SILC scheduler. */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
149 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
150 | static gboolean |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
151 | silcpurple_scheduler_timeout(gpointer context) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
152 | { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
153 | SilcPurpleTask task = (SilcPurpleTask)context; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
154 | silc_client_run_one(task->sg->client); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
155 | silc_dlist_del(task->sg->tasks, task); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
156 | silc_free(task); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
157 | return FALSE; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
158 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
159 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
160 | /* An fd task event occurred. Call SILC scheduler. */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
161 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
162 | static void |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
163 | silcpurple_scheduler_fd(gpointer data, gint fd, PurpleInputCondition cond) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
164 | { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
165 | SilcClient client = (SilcClient)data; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
166 | silc_client_run_one(client); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
167 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
168 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
169 | /* SILC Scheduler notify callback. This is called whenever task is added to |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
170 | or deleted from SILC scheduler. It's also called when fd task events |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
171 | change. Here we add same tasks to glib's main loop. */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
172 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
173 | static void |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
174 | silcpurple_scheduler(SilcSchedule schedule, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
175 | SilcBool added, SilcTask task, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
176 | SilcBool fd_task, SilcUInt32 fd, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
177 | SilcTaskEvent event, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
178 | long seconds, long useconds, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
179 | void *context) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
180 | { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
181 | SilcClient client = (SilcClient)context; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
182 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
183 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
184 | SilcPurpleTask ptask = NULL; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
185 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
186 | if (added) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
187 | if (fd_task) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
188 | /* Add fd or change fd events */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
189 | PurpleInputCondition e = 0; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
190 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
191 | silc_dlist_start(sg->tasks); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
192 | while ((ptask = silc_dlist_get(sg->tasks))) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
193 | if (ptask->fd == fd) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
194 | purple_input_remove(ptask->tag); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
195 | break; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
196 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
197 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
198 | if (event & SILC_TASK_READ) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
199 | e |= PURPLE_INPUT_READ; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
200 | if (event & SILC_TASK_WRITE) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
201 | e |= PURPLE_INPUT_WRITE; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
202 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
203 | if (e) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
204 | if (!ptask) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
205 | ptask = silc_calloc(1, sizeof(*ptask)); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
206 | ptask->fd = fd; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
207 | silc_dlist_add(sg->tasks, ptask); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
208 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
209 | ptask->tag = purple_input_add(fd, e, silcpurple_scheduler_fd, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
210 | client); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
211 | } else if (ptask) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
212 | silc_dlist_del(sg->tasks, ptask); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
213 | silc_free(ptask); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
214 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
215 | } else { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
216 | /* Add timeout */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
217 | ptask = silc_calloc(1, sizeof(*ptask)); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
218 | ptask->sg = sg; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
219 | ptask->tag = purple_timeout_add((seconds * 1000) + |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
220 | (useconds / 1000), |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
221 | silcpurple_scheduler_timeout, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
222 | ptask); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
223 | silc_dlist_add(sg->tasks, ptask); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
224 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
225 | } else { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
226 | if (fd_task) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
227 | /* Remove fd */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
228 | silc_dlist_start(sg->tasks); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
229 | while ((ptask = silc_dlist_get(sg->tasks))) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
230 | if (ptask->fd == fd) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
231 | purple_input_remove(ptask->tag); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
232 | silc_dlist_del(sg->tasks, ptask); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
233 | silc_free(ptask); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
234 | break; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
235 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
236 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
237 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
238 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
239 | #endif /* __SILC_TOOLKIT_VERSION */ |
| 8849 | 240 | |
| 241 | static void | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
242 | silcpurple_connect_cb(SilcClient client, SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
243 | SilcClientConnectionStatus status, SilcStatus error, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
244 | const char *message, void *context) |
| 8849 | 245 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
246 | PurpleConnection *gc = context; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
247 | SilcPurple sg; |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
248 | SilcUInt32 mask; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
249 | char tz[16]; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
250 | PurpleStoredImage *img; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
251 | #ifdef HAVE_SYS_UTSNAME_H |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
252 | struct utsname u; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
253 | #endif |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
254 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
255 | sg = purple_connection_get_protocol_data(gc); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
256 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
257 | switch (status) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
258 | case SILC_CLIENT_CONN_SUCCESS: |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
259 | case SILC_CLIENT_CONN_SUCCESS_RESUME: |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
260 | sg->conn = conn; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
261 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
262 | /* Connection created successfully */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
263 | purple_connection_set_state(gc, PURPLE_CONNECTED); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
264 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
265 | /* Send the server our buddy list */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
266 | silcpurple_send_buddylist(gc); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
267 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
268 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
269 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
270 | /* Send any UMODEs configured for account */ |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
271 | if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
272 | silc_client_command_call(sg->client, sg->conn, NULL, |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
273 | "UMODE", "+P", NULL); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
274 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
275 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
276 | /* Set default attributes */ |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
277 | mask = SILC_ATTRIBUTE_MOOD_NORMAL; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
278 | silc_client_attribute_add(client, conn, |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
279 | SILC_ATTRIBUTE_STATUS_MOOD, |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
280 | SILC_32_TO_PTR(mask), |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
281 | sizeof(SilcUInt32)); |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
282 | mask = SILC_ATTRIBUTE_CONTACT_CHAT; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
283 | silc_client_attribute_add(client, conn, |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
284 | SILC_ATTRIBUTE_PREFERRED_CONTACT, |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
285 | SILC_32_TO_PTR(mask), |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
286 | sizeof(SilcUInt32)); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
287 | #ifdef HAVE_SYS_UTSNAME_H |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
288 | if (!uname(&u)) { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
289 | SilcAttributeObjDevice dev; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
290 | memset(&dev, 0, sizeof(dev)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
291 | dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
292 | dev.version = u.release; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
293 | dev.model = u.sysname; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
294 | silc_client_attribute_add(client, conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
295 | SILC_ATTRIBUTE_DEVICE_INFO, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
296 | (void *)&dev, sizeof(dev)); |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
297 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
298 | #endif |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
299 | silc_timezone(tz, sizeof(tz)); |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
300 | silc_client_attribute_add(client, conn, |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
301 | SILC_ATTRIBUTE_TIMEZONE, |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
302 | (void *)tz, strlen(tz)); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
303 | |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
304 | /* Set our buddy icon */ |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
305 | img = purple_buddy_icons_find_account_icon(sg->account); |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
306 | silcpurple_buddy_set_icon(gc, img); |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
307 | purple_imgstore_unref(img); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
308 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
309 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
310 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
311 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
312 | case SILC_CLIENT_CONN_DISCONNECTED: |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
313 | /* Disconnected */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
314 | if (sg->resuming && !sg->detaching) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
315 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
316 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
317 | /* Close the connection */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
318 | if (!sg->detaching) |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
319 | purple_connection_error(gc, |
| 21279 | 320 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
321 | _("Disconnected by server")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
322 | else |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
323 | /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
324 | purple_account_disconnect(purple_connection_get_account(gc)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
325 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
326 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
327 | case SILC_CLIENT_CONN_ERROR: |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
328 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
26482
diff
changeset
|
329 | _("Error connecting to SILC Server")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
330 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
331 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
332 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
333 | case SILC_CLIENT_CONN_ERROR_KE: |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
334 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
335 | _("Key Exchange failed")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
336 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
337 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
338 | case SILC_CLIENT_CONN_ERROR_AUTH: |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
339 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
340 | _("Authentication failed")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
341 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
342 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
343 | case SILC_CLIENT_CONN_ERROR_RESUME: |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
344 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
345 | _("Resuming detached session failed. " |
|
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
346 | "Press Reconnect to create new connection.")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
347 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
348 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
349 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
350 | case SILC_CLIENT_CONN_ERROR_TIMEOUT: |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
351 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
26482
diff
changeset
|
352 | _("Connection timed out")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
353 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
354 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
355 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
356 | /* Error */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
357 | sg->conn = NULL; |
| 8849 | 358 | } |
| 359 | ||
| 360 | static void | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
361 | silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
362 | void *context) |
| 8849 | 363 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
364 | PurpleConnection *gc = context; |
| 15884 | 365 | SilcPurple sg; |
|
9732
644615310076
[gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9597
diff
changeset
|
366 | SilcClient client; |
| 8849 | 367 | SilcClientConnectionParams params; |
| 368 | const char *dfile; | |
| 369 | ||
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
370 | sg = purple_connection_get_protocol_data(gc); |
|
13410
590ccd4c9bb1
[gaim-migrate @ 15784]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
371 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
372 | if (status != SILC_SOCKET_OK) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
373 | purple_connection_error(gc, |
|
21513
02642f4cb3df
Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <resiak@pidgin.im>
parents:
21503
diff
changeset
|
374 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
02642f4cb3df
Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <resiak@pidgin.im>
parents:
21503
diff
changeset
|
375 | _("Connection failed")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
376 | silc_pkcs_public_key_free(sg->public_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
377 | silc_pkcs_private_key_free(sg->private_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
378 | silc_free(sg); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
379 | purple_connection_set_protocol_data(gc, NULL); |
| 8849 | 380 | return; |
| 381 | } | |
|
9732
644615310076
[gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9597
diff
changeset
|
382 | |
|
644615310076
[gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9597
diff
changeset
|
383 | client = sg->client; |
| 8849 | 384 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
385 | /* Get session detachment data, if available */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
386 | memset(¶ms, 0, sizeof(params)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
387 | dfile = silcpurple_session_file(purple_account_get_username(sg->account)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
388 | params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
389 | if (params.detach_data) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
390 | params.detach_data[params.detach_data_len] = 0; |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
391 | params.ignore_requested_attributes = FALSE; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
392 | params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE); |
| 8849 | 393 | |
|
22847
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
394 | /* Progress */ |
|
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
395 | if (params.detach_data) { |
|
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
396 | purple_connection_update_progress(gc, _("Resuming session"), 2, 5); |
|
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
397 | sg->resuming = TRUE; |
|
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
398 | } else { |
|
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
399 | purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); |
|
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
400 | } |
|
fea937d28d73
Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
401 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
402 | /* Perform SILC Key Exchange. */ |
|
32763
fecea45a546b
Remove dead assignments found with clang-analyzer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32698
diff
changeset
|
403 | silc_client_key_exchange(client, ¶ms, sg->public_key, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
404 | sg->private_key, stream, SILC_CONN_SERVER, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
405 | silcpurple_connect_cb, gc); |
| 8849 | 406 | |
| 407 | silc_free(params.detach_data); | |
| 408 | } | |
| 409 | ||
| 410 | static void | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
411 | silcpurple_login_connected(gpointer data, gint source, const gchar *error_message) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
412 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
413 | PurpleConnection *gc = data; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
414 | SilcPurple sg; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
415 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
416 | g_return_if_fail(gc != NULL); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
417 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
418 | sg = purple_connection_get_protocol_data(gc); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
419 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
420 | if (source < 0) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
421 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
422 | _("Connection failed")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
423 | silc_pkcs_public_key_free(sg->public_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
424 | silc_pkcs_private_key_free(sg->private_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
425 | silc_free(sg); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
426 | purple_connection_set_protocol_data(gc, NULL); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
427 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
428 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
429 | |
|
21522
db7633b6104d
kill another compile warning
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21513
diff
changeset
|
430 | silc_hash_alloc((unsigned char *)"sha1", &sg->sha1hash); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
431 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
432 | /* Wrap socket to TCP stream */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
433 | silc_socket_tcp_stream_create(source, TRUE, FALSE, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
434 | sg->client->schedule, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
435 | silcpurple_stream_created, gc); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
436 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
437 | |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
438 | static void silcpurple_continue_running(SilcPurple sg) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
439 | { |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
440 | PurpleConnection *gc = sg->gc; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
441 | PurpleAccount *account = purple_connection_get_account(gc); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
442 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
443 | /* Connect to the SILC server */ |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
444 | if (purple_proxy_connect(gc, account, |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
445 | purple_account_get_string(account, "server", |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
446 | "silc.silcnet.org"), |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
447 | purple_account_get_int(account, "port", 706), |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
448 | silcpurple_login_connected, gc) == NULL) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
449 | { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
450 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
26482
diff
changeset
|
451 | _("Unable to connect")); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
452 | purple_connection_set_protocol_data(gc, NULL); |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
453 | silc_free(sg); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
454 | return; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
455 | } |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
456 | } |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
457 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
458 | static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
459 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
460 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
461 | PurpleAccount *account = purple_connection_get_account(gc); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
462 | char pkd[256], prd[256]; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
463 | const char *password; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
464 | gboolean remember; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
465 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
466 | /* The password prompt dialog doesn't get disposed if the account disconnects */ |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
467 | if (!PURPLE_CONNECTION_IS_VALID(gc)) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
468 | return; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
469 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
470 | password = purple_request_fields_get_string(fields, "password"); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
471 | remember = purple_request_fields_get_bool(fields, "remember"); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
472 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
473 | if (!password || !*password) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
474 | { |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
475 | purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
476 | purple_connection_set_protocol_data(gc, NULL); |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
477 | silc_free(sg); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
478 | return; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
479 | } |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
480 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
481 | if (remember) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
482 | purple_account_set_remember_password(account, TRUE); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
483 | |
|
34029
059c1270db1f
Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34028
diff
changeset
|
484 | purple_account_set_password(account, password, NULL, NULL); |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
485 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
486 | /* Load SILC key pair */ |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
487 | g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
488 | g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
489 | if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
490 | (char *)purple_account_get_string(account, "private-key", prd), |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
491 | password, |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
492 | &sg->public_key, &sg->private_key)) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
493 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
26482
diff
changeset
|
494 | _("Unable to load SILC key pair")); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
495 | purple_connection_set_protocol_data(gc, NULL); |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
496 | silc_free(sg); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
497 | return; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
498 | } |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
499 | silcpurple_continue_running(sg); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
500 | } |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
501 | |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
502 | static void silcpurple_no_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
503 | { |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
504 | SilcPurple sg; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
505 | /* The password prompt dialog doesn't get disposed if the account disconnects */ |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
506 | if (!PURPLE_CONNECTION_IS_VALID(gc)) |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
507 | return; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
508 | sg = purple_connection_get_protocol_data(gc); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
509 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
26482
diff
changeset
|
510 | _("Unable to load SILC key pair")); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
511 | purple_connection_set_protocol_data(gc, NULL); |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
512 | silc_free(sg); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
513 | } |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
514 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
515 | static void silcpurple_running(SilcClient client, void *context) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
516 | { |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
517 | SilcPurple sg = context; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
518 | PurpleConnection *gc = sg->gc; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
519 | PurpleAccount *account = purple_connection_get_account(gc); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
520 | char pkd[256], prd[256]; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
521 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
522 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
523 | /* Progress */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
524 | purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
525 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
526 | /* Load SILC key pair */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
527 | g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
528 | g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
529 | if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
530 | (char *)purple_account_get_string(account, "private-key", prd), |
|
32683
5376a35d461a
Samtime: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
531 | (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
532 | &sg->public_key, &sg->private_key)) { |
|
34022
c49f6e9ea27d
Make all the prpls build.
Paul Aurich <darkrain42@pidgin.im>
parents:
27879
diff
changeset
|
533 | if (!purple_connection_get_password(gc)) { |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
534 | purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
535 | G_CALLBACK(silcpurple_no_password_cb), gc); |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
536 | return; |
|
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
537 | } |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
538 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
27879
f53273ef4e7e
Fix an incorrect string. Yes, this breaks the string freeze. But the string
Mark Doliner <markdoliner@pidgin.im>
parents:
27635
diff
changeset
|
539 | _("Unable to load SILC key pair")); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
540 | purple_connection_set_protocol_data(gc, NULL); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
541 | silc_free(sg); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
542 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
543 | } |
|
22853
02735afc5a47
Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22852
diff
changeset
|
544 | silcpurple_continue_running(sg); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
545 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
546 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
547 | static void |
| 15884 | 548 | silcpurple_login(PurpleAccount *account) |
| 8849 | 549 | { |
| 550 | SilcClient client; | |
| 15884 | 551 | PurpleConnection *gc; |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
552 | SilcPurple sg; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
553 | SilcClientParams params; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
554 | const char *cipher, *hmac; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
555 | char *username, *hostname, *realname, **up; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
556 | int i; |
| 8849 | 557 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
558 | gc = purple_account_get_connection(account); |
| 8849 | 559 | if (!gc) |
| 560 | return; | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
561 | purple_connection_set_protocol_data(gc, NULL); |
| 8849 | 562 | |
| 563 | memset(¶ms, 0, sizeof(params)); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
564 | strcat(params.nickname_format, "%n#a"); |
| 8849 | 565 | |
| 566 | /* Allocate SILC client */ | |
| 567 | client = silc_client_alloc(&ops, ¶ms, gc, NULL); | |
| 568 | if (!client) { | |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
569 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
570 | _("Out of memory")); |
| 8849 | 571 | return; |
| 572 | } | |
| 573 | ||
| 574 | /* Get username, real name and local hostname for SILC library */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
575 | if (!purple_account_get_username(account)) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
576 | purple_account_set_username(account, silc_get_username()); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
577 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
578 | username = (char *)purple_account_get_username(account); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
579 | up = g_strsplit(username, "@", 2); |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
580 | username = g_strdup(up[0]); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
581 | g_strfreev(up); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
582 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
583 | if (!purple_account_get_user_info(account)) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
584 | purple_account_set_user_info(account, silc_get_real_name()); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
585 | if (!purple_account_get_user_info(account)) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
586 | purple_account_set_user_info(account, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
587 | "John T. Noname"); |
| 8849 | 588 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
589 | realname = (char *)purple_account_get_user_info(account); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
590 | hostname = silc_net_localhost(); |
| 8849 | 591 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
592 | purple_connection_set_display_name(gc, username); |
| 8849 | 593 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
594 | /* Register requested cipher and HMAC */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
595 | cipher = purple_account_get_string(account, "cipher", |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
596 | SILC_DEFAULT_CIPHER); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
597 | for (i = 0; silc_default_ciphers[i].name; i++) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
598 | if (!strcmp(silc_default_ciphers[i].name, cipher)) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
599 | silc_cipher_register(&(silc_default_ciphers[i])); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
600 | break; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
601 | } |
| 15884 | 602 | hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
603 | for (i = 0; silc_default_hmacs[i].name; i++) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
604 | if (!strcmp(silc_default_hmacs[i].name, hmac)) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
605 | silc_hmac_register(&(silc_default_hmacs[i])); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
606 | break; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
607 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
608 | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
609 | sg = silc_calloc(1, sizeof(*sg)); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
610 | if (!sg) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
611 | return; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
612 | sg->client = client; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
613 | sg->gc = gc; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
614 | sg->account = account; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
615 | purple_connection_set_protocol_data(gc, sg); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
616 | |
| 8849 | 617 | /* Init SILC client */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
618 | if (!silc_client_init(client, username, hostname, realname, |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
619 | silcpurple_running, sg)) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
620 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
26482
diff
changeset
|
621 | _("Unable to initialize SILC protocol")); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
622 | purple_connection_set_protocol_data(gc, NULL); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
623 | silc_free(sg); |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
624 | silc_free(hostname); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
625 | g_free(username); |
| 8849 | 626 | return; |
| 627 | } | |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
628 | silc_free(hostname); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
629 | g_free(username); |
| 8849 | 630 | |
| 631 | /* Check the ~/.silc dir and create it, and new key pair if necessary. */ | |
| 15884 | 632 | if (!silcpurple_check_silc_dir(gc)) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31802
diff
changeset
|
633 | purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
634 | _("Error loading SILC key pair")); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
635 | purple_connection_set_protocol_data(gc, NULL); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
636 | silc_free(sg); |
| 8849 | 637 | return; |
| 638 | } | |
| 639 | ||
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
640 | #if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) |
| 8849 | 641 | /* Schedule SILC using Glib's event loop */ |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
642 | sg->scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, client); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
643 | #else |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
644 | /* Run SILC scheduler */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
645 | sg->tasks = silc_dlist_init(); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
646 | silc_schedule_set_notify(client->schedule, silcpurple_scheduler, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
647 | client); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
648 | silc_client_run_one(client); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
649 | #endif /* __SILC_TOOLKIT_VERSION */ |
| 8849 | 650 | } |
| 651 | ||
| 652 | static int | |
| 15884 | 653 | silcpurple_close_final(gpointer *context) |
| 8849 | 654 | { |
| 15884 | 655 | SilcPurple sg = (SilcPurple)context; |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
656 | |
| 31444 | 657 | purple_debug_info("silc", "Finalizing SilcPurple %p\n", sg); |
| 658 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
659 | silc_client_stop(sg->client, NULL, NULL); |
| 8849 | 660 | silc_client_free(sg->client); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
661 | if (sg->sha1hash) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
662 | silc_hash_free(sg->sha1hash); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
663 | if (sg->mimeass) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
664 | silc_mime_assembler_free(sg->mimeass); |
| 8849 | 665 | silc_free(sg); |
| 666 | return 0; | |
| 667 | } | |
| 668 | ||
| 669 | static void | |
| 15884 | 670 | silcpurple_close(PurpleConnection *gc) |
| 8849 | 671 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
672 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
673 | #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
674 | SilcPurpleTask task; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
675 | #endif /* __SILC_TOOLKIT_VERSION */ |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
676 | GHashTable *ui_info; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
677 | const char *ui_name = NULL, *ui_website = NULL; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
678 | char *quit_msg; |
| 8849 | 679 | |
|
10547
61f5540fc15a
[gaim-migrate @ 11917]
Mark Doliner <markdoliner@pidgin.im>
parents:
10516
diff
changeset
|
680 | g_return_if_fail(sg != NULL); |
| 8849 | 681 | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
682 | ui_info = purple_core_get_ui_info(); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
683 | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
684 | if(ui_info) { |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
685 | ui_name = g_hash_table_lookup(ui_info, "name"); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
686 | ui_website = g_hash_table_lookup(ui_info, "website"); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
687 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
688 | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
689 | if(!ui_name || !ui_website) { |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
690 | ui_name = "Pidgin"; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
691 | ui_website = PURPLE_WEBSITE; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
692 | } |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
693 | quit_msg = g_strdup_printf(_("Download %s: %s"), |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
694 | ui_name, ui_website); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
695 | |
| 8849 | 696 | /* Send QUIT */ |
| 697 | silc_client_command_call(sg->client, sg->conn, NULL, | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
698 | "QUIT", quit_msg, |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
699 | NULL); |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
700 | g_free(quit_msg); |
| 8849 | 701 | |
| 702 | if (sg->conn) | |
| 703 | silc_client_close_connection(sg->client, sg->conn); | |
| 704 | ||
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
705 | #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
706 | if (sg->conn) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
707 | silc_client_run_one(sg->client); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
708 | silc_schedule_set_notify(sg->client->schedule, NULL, NULL); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
709 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
710 | silc_dlist_start(sg->tasks); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
711 | while ((task = silc_dlist_get(sg->tasks))) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
712 | purple_input_remove(task->tag); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
713 | silc_free(task); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
714 | } |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
715 | silc_dlist_uninit(sg->tasks); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
716 | #endif /* __SILC_TOOLKIT_VERSION */ |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
717 | |
|
17570
4cca2fc0ec83
libpurple should not use glib eventloop stuff directly, since we have our
Richard Laager <rlaager@pidgin.im>
parents:
17566
diff
changeset
|
718 | purple_timeout_remove(sg->scheduler); |
| 31444 | 719 | |
| 720 | purple_debug_info("silc", "Scheduling destruction of SilcPurple %p\n", sg); | |
|
17570
4cca2fc0ec83
libpurple should not use glib eventloop stuff directly, since we have our
Richard Laager <rlaager@pidgin.im>
parents:
17566
diff
changeset
|
721 | purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg); |
| 8849 | 722 | } |
| 723 | ||
| 724 | ||
| 725 | /****************************** Protocol Actions *****************************/ | |
| 726 | ||
| 727 | static void | |
| 15884 | 728 | silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) |
| 8849 | 729 | { |
| 730 | /* Nothing */ | |
| 731 | } | |
| 732 | ||
| 733 | static void | |
| 15884 | 734 | silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
| 8849 | 735 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
736 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 737 | SilcClient client = sg->client; |
| 738 | SilcClientConnection conn = sg->conn; | |
| 15884 | 739 | PurpleRequestField *f; |
| 8849 | 740 | char *tmp; |
| 741 | SilcUInt32 tmp_len, mask; | |
| 742 | SilcAttributeObjService service; | |
| 743 | SilcAttributeObjDevice dev; | |
| 744 | SilcVCardStruct vcard; | |
| 745 | const char *val; | |
| 746 | ||
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
747 | sg = purple_connection_get_protocol_data(gc); |
| 8849 | 748 | if (!sg) |
| 749 | return; | |
| 750 | ||
| 751 | memset(&service, 0, sizeof(service)); | |
| 752 | memset(&dev, 0, sizeof(dev)); | |
| 753 | memset(&vcard, 0, sizeof(vcard)); | |
| 754 | ||
| 755 | silc_client_attribute_del(client, conn, | |
| 756 | SILC_ATTRIBUTE_USER_INFO, NULL); | |
| 757 | silc_client_attribute_del(client, conn, | |
| 758 | SILC_ATTRIBUTE_SERVICE, NULL); | |
| 759 | silc_client_attribute_del(client, conn, | |
| 760 | SILC_ATTRIBUTE_STATUS_MOOD, NULL); | |
| 761 | silc_client_attribute_del(client, conn, | |
| 762 | SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); | |
| 763 | silc_client_attribute_del(client, conn, | |
| 764 | SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); | |
| 765 | silc_client_attribute_del(client, conn, | |
| 766 | SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); | |
| 767 | silc_client_attribute_del(client, conn, | |
| 768 | SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); | |
| 769 | silc_client_attribute_del(client, conn, | |
| 770 | SILC_ATTRIBUTE_TIMEZONE, NULL); | |
| 771 | silc_client_attribute_del(client, conn, | |
| 772 | SILC_ATTRIBUTE_GEOLOCATION, NULL); | |
| 773 | silc_client_attribute_del(client, conn, | |
| 774 | SILC_ATTRIBUTE_DEVICE_INFO, NULL); | |
| 775 | ||
| 776 | /* Set mood */ | |
| 777 | mask = 0; | |
| 15884 | 778 | f = purple_request_fields_get_field(fields, "mood_normal"); |
| 779 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 780 | mask |= SILC_ATTRIBUTE_MOOD_NORMAL; |
| 15884 | 781 | f = purple_request_fields_get_field(fields, "mood_happy"); |
| 782 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 783 | mask |= SILC_ATTRIBUTE_MOOD_HAPPY; |
| 15884 | 784 | f = purple_request_fields_get_field(fields, "mood_sad"); |
| 785 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 786 | mask |= SILC_ATTRIBUTE_MOOD_SAD; |
| 15884 | 787 | f = purple_request_fields_get_field(fields, "mood_angry"); |
| 788 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 789 | mask |= SILC_ATTRIBUTE_MOOD_ANGRY; |
| 15884 | 790 | f = purple_request_fields_get_field(fields, "mood_jealous"); |
| 791 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 792 | mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; |
| 15884 | 793 | f = purple_request_fields_get_field(fields, "mood_ashamed"); |
| 794 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 795 | mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; |
| 15884 | 796 | f = purple_request_fields_get_field(fields, "mood_invincible"); |
| 797 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 798 | mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; |
| 15884 | 799 | f = purple_request_fields_get_field(fields, "mood_inlove"); |
| 800 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 801 | mask |= SILC_ATTRIBUTE_MOOD_INLOVE; |
| 15884 | 802 | f = purple_request_fields_get_field(fields, "mood_sleepy"); |
| 803 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 804 | mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; |
| 15884 | 805 | f = purple_request_fields_get_field(fields, "mood_bored"); |
| 806 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 807 | mask |= SILC_ATTRIBUTE_MOOD_BORED; |
| 15884 | 808 | f = purple_request_fields_get_field(fields, "mood_excited"); |
| 809 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 810 | mask |= SILC_ATTRIBUTE_MOOD_EXCITED; |
| 15884 | 811 | f = purple_request_fields_get_field(fields, "mood_anxious"); |
| 812 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 813 | mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; |
| 814 | silc_client_attribute_add(client, conn, | |
| 815 | SILC_ATTRIBUTE_STATUS_MOOD, | |
| 816 | SILC_32_TO_PTR(mask), | |
| 817 | sizeof(SilcUInt32)); | |
| 818 | ||
| 819 | /* Set preferred contact */ | |
| 820 | mask = 0; | |
| 15884 | 821 | f = purple_request_fields_get_field(fields, "contact_chat"); |
| 822 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 823 | mask |= SILC_ATTRIBUTE_CONTACT_CHAT; |
| 15884 | 824 | f = purple_request_fields_get_field(fields, "contact_email"); |
| 825 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 826 | mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; |
| 15884 | 827 | f = purple_request_fields_get_field(fields, "contact_call"); |
| 828 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 829 | mask |= SILC_ATTRIBUTE_CONTACT_CALL; |
| 15884 | 830 | f = purple_request_fields_get_field(fields, "contact_sms"); |
| 831 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 832 | mask |= SILC_ATTRIBUTE_CONTACT_SMS; |
| 15884 | 833 | f = purple_request_fields_get_field(fields, "contact_mms"); |
| 834 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 835 | mask |= SILC_ATTRIBUTE_CONTACT_MMS; |
| 15884 | 836 | f = purple_request_fields_get_field(fields, "contact_video"); |
| 837 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 838 | mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; |
| 839 | if (mask) | |
| 840 | silc_client_attribute_add(client, conn, | |
| 841 | SILC_ATTRIBUTE_PREFERRED_CONTACT, | |
| 842 | SILC_32_TO_PTR(mask), | |
| 843 | sizeof(SilcUInt32)); | |
| 844 | ||
| 845 | /* Set status text */ | |
| 846 | val = NULL; | |
| 15884 | 847 | f = purple_request_fields_get_field(fields, "status_text"); |
| 8849 | 848 | if (f) |
| 15884 | 849 | val = purple_request_field_string_get_value(f); |
| 8849 | 850 | if (val && *val) |
| 851 | silc_client_attribute_add(client, conn, | |
| 852 | SILC_ATTRIBUTE_STATUS_FREETEXT, | |
| 853 | (void *)val, strlen(val)); | |
| 854 | ||
| 855 | /* Set vcard */ | |
| 856 | val = NULL; | |
| 15884 | 857 | f = purple_request_fields_get_field(fields, "vcard"); |
| 8849 | 858 | if (f) |
| 15884 | 859 | val = purple_request_field_string_get_value(f); |
| 8849 | 860 | if (val && *val) { |
| 15884 | 861 | purple_account_set_string(sg->account, "vcard", val); |
| 8849 | 862 | tmp = silc_file_readfile(val, &tmp_len); |
| 863 | if (tmp) { | |
| 864 | tmp[tmp_len] = 0; | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11257
diff
changeset
|
865 | if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) |
| 8849 | 866 | silc_client_attribute_add(client, conn, |
| 867 | SILC_ATTRIBUTE_USER_INFO, | |
| 868 | (void *)&vcard, | |
| 869 | sizeof(vcard)); | |
| 870 | } | |
| 871 | silc_vcard_free(&vcard); | |
| 872 | silc_free(tmp); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
873 | } else { |
| 15884 | 874 | purple_account_set_string(sg->account, "vcard", ""); |
| 8849 | 875 | } |
| 876 | ||
| 877 | #ifdef HAVE_SYS_UTSNAME_H | |
| 878 | /* Set device info */ | |
| 15884 | 879 | f = purple_request_fields_get_field(fields, "device"); |
| 880 | if (f && purple_request_field_bool_get_value(f)) { | |
| 8849 | 881 | struct utsname u; |
| 882 | if (!uname(&u)) { | |
| 883 | dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; | |
| 884 | dev.version = u.release; | |
| 885 | dev.model = u.sysname; | |
| 886 | silc_client_attribute_add(client, conn, | |
| 887 | SILC_ATTRIBUTE_DEVICE_INFO, | |
| 888 | (void *)&dev, sizeof(dev)); | |
| 889 | } | |
| 890 | } | |
| 891 | #endif | |
| 892 | ||
| 893 | /* Set timezone */ | |
| 894 | val = NULL; | |
| 15884 | 895 | f = purple_request_fields_get_field(fields, "timezone"); |
| 8849 | 896 | if (f) |
| 15884 | 897 | val = purple_request_field_string_get_value(f); |
| 8849 | 898 | if (val && *val) |
| 899 | silc_client_attribute_add(client, conn, | |
| 900 | SILC_ATTRIBUTE_TIMEZONE, | |
| 901 | (void *)val, strlen(val)); | |
| 902 | } | |
| 903 | ||
| 904 | static void | |
| 15884 | 905 | silcpurple_attrs(PurplePluginAction *action) |
| 8849 | 906 | { |
| 15884 | 907 | PurpleConnection *gc = (PurpleConnection *) action->context; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
908 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 909 | SilcClient client = sg->client; |
| 910 | SilcClientConnection conn = sg->conn; | |
| 15884 | 911 | PurpleRequestFields *fields; |
| 912 | PurpleRequestFieldGroup *g; | |
| 913 | PurpleRequestField *f; | |
| 8849 | 914 | SilcHashTable attrs; |
| 915 | SilcAttributePayload attr; | |
| 916 | gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, | |
| 917 | mangry = FALSE, mjealous = FALSE, mashamed = FALSE, | |
| 918 | minvincible = FALSE, minlove = FALSE, msleepy = FALSE, | |
| 919 | mbored = FALSE, mexcited = FALSE, manxious = FALSE; | |
| 920 | gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, | |
| 921 | cmms = FALSE, cchat = TRUE, cvideo = FALSE; | |
|
33896
fb896f14715b
win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
922 | #ifdef HAVE_SYS_UTSNAME_H |
| 8849 | 923 | gboolean device = TRUE; |
|
33896
fb896f14715b
win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
924 | #endif |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
925 | char status[1024], tz[16]; |
| 8849 | 926 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
927 | sg = purple_connection_get_protocol_data(gc); |
| 8849 | 928 | if (!sg) |
| 929 | return; | |
| 930 | ||
| 931 | memset(status, 0, sizeof(status)); | |
| 932 | ||
| 933 | attrs = silc_client_attributes_get(client, conn); | |
| 934 | if (attrs) { | |
| 935 | if (silc_hash_table_find(attrs, | |
| 936 | SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), | |
| 937 | NULL, (void *)&attr)) { | |
| 938 | SilcUInt32 mood = 0; | |
| 939 | silc_attribute_get_object(attr, &mood, sizeof(mood)); | |
| 940 | mnormal = !mood; | |
| 941 | mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); | |
| 942 | msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); | |
| 943 | mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); | |
| 944 | mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); | |
| 945 | mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); | |
| 946 | minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); | |
| 947 | minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); | |
| 948 | msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); | |
| 949 | mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); | |
| 950 | mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); | |
| 951 | manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); | |
| 952 | } | |
| 953 | ||
| 954 | if (silc_hash_table_find(attrs, | |
| 955 | SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), | |
| 956 | NULL, (void *)&attr)) { | |
| 957 | SilcUInt32 contact = 0; | |
| 958 | silc_attribute_get_object(attr, &contact, sizeof(contact)); | |
| 959 | cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); | |
| 960 | ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); | |
| 961 | csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); | |
| 962 | cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); | |
| 963 | cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); | |
| 964 | cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); | |
| 965 | } | |
| 966 | ||
| 967 | if (silc_hash_table_find(attrs, | |
| 968 | SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), | |
| 969 | NULL, (void *)&attr)) | |
| 970 | silc_attribute_get_object(attr, &status, sizeof(status)); | |
| 971 | ||
|
33896
fb896f14715b
win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
972 | #ifdef HAVE_SYS_UTSNAME_H |
| 8849 | 973 | if (!silc_hash_table_find(attrs, |
| 974 | SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), | |
| 975 | NULL, (void *)&attr)) | |
| 976 | device = FALSE; | |
|
33896
fb896f14715b
win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
977 | #endif |
| 8849 | 978 | } |
| 979 | ||
| 15884 | 980 | fields = purple_request_fields_new(); |
| 8849 | 981 | |
| 15884 | 982 | g = purple_request_field_group_new(NULL); |
| 983 | f = purple_request_field_label_new("l3", _("Your Current Mood")); | |
| 984 | purple_request_field_group_add_field(g, f); | |
| 985 | f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal); | |
| 986 | purple_request_field_group_add_field(g, f); | |
| 987 | f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy); | |
| 988 | purple_request_field_group_add_field(g, f); | |
| 989 | f = purple_request_field_bool_new("mood_sad", _("Sad"), msad); | |
| 990 | purple_request_field_group_add_field(g, f); | |
| 991 | f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry); | |
| 992 | purple_request_field_group_add_field(g, f); | |
| 993 | f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); | |
| 994 | purple_request_field_group_add_field(g, f); | |
| 995 | f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); | |
| 996 | purple_request_field_group_add_field(g, f); | |
| 997 | f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); | |
| 998 | purple_request_field_group_add_field(g, f); | |
| 999 | f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove); | |
| 1000 | purple_request_field_group_add_field(g, f); | |
| 1001 | f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); | |
| 1002 | purple_request_field_group_add_field(g, f); | |
| 1003 | f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored); | |
| 1004 | purple_request_field_group_add_field(g, f); | |
| 1005 | f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited); | |
| 1006 | purple_request_field_group_add_field(g, f); | |
| 1007 | f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious); | |
| 1008 | purple_request_field_group_add_field(g, f); | |
| 8849 | 1009 | |
| 15884 | 1010 | f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); |
| 1011 | purple_request_field_group_add_field(g, f); | |
| 1012 | f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat); | |
| 1013 | purple_request_field_group_add_field(g, f); | |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23278
diff
changeset
|
1014 | f = purple_request_field_bool_new("contact_email", _("Email"), cemail); |
| 15884 | 1015 | purple_request_field_group_add_field(g, f); |
| 1016 | f = purple_request_field_bool_new("contact_call", _("Phone"), ccall); | |
| 1017 | purple_request_field_group_add_field(g, f); | |
| 1018 | f = purple_request_field_bool_new("contact_sms", _("SMS"), csms); | |
| 1019 | purple_request_field_group_add_field(g, f); | |
| 1020 | f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms); | |
| 1021 | purple_request_field_group_add_field(g, f); | |
| 1022 | f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo); | |
| 1023 | purple_request_field_group_add_field(g, f); | |
| 1024 | purple_request_fields_add_group(fields, g); | |
| 8849 | 1025 | |
| 15884 | 1026 | g = purple_request_field_group_new(NULL); |
| 1027 | f = purple_request_field_string_new("status_text", _("Your Current Status"), | |
| 8849 | 1028 | status[0] ? status : NULL, TRUE); |
| 15884 | 1029 | purple_request_field_group_add_field(g, f); |
| 1030 | purple_request_fields_add_group(fields, g); | |
| 8849 | 1031 | |
| 15884 | 1032 | g = purple_request_field_group_new(NULL); |
| 8849 | 1033 | #if 0 |
| 15884 | 1034 | f = purple_request_field_label_new("l2", _("Online Services")); |
| 1035 | purple_request_field_group_add_field(g, f); | |
| 1036 | f = purple_request_field_bool_new("services", | |
| 8849 | 1037 | _("Let others see what services you are using"), |
| 1038 | TRUE); | |
| 15884 | 1039 | purple_request_field_group_add_field(g, f); |
| 8849 | 1040 | #endif |
| 1041 | #ifdef HAVE_SYS_UTSNAME_H | |
| 15884 | 1042 | f = purple_request_field_bool_new("device", |
| 8849 | 1043 | _("Let others see what computer you are using"), |
| 1044 | device); | |
| 15884 | 1045 | purple_request_field_group_add_field(g, f); |
| 8849 | 1046 | #endif |
| 15884 | 1047 | purple_request_fields_add_group(fields, g); |
| 8849 | 1048 | |
| 15884 | 1049 | g = purple_request_field_group_new(NULL); |
| 1050 | f = purple_request_field_string_new("vcard", _("Your VCard File"), | |
| 1051 | purple_account_get_string(sg->account, "vcard", ""), | |
| 8849 | 1052 | FALSE); |
| 15884 | 1053 | purple_request_field_group_add_field(g, f); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1054 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1055 | silc_timezone(tz, sizeof(tz)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1056 | f = purple_request_field_string_new("timezone", _("Timezone (UTC)"), tz, FALSE); |
| 15884 | 1057 | purple_request_field_group_add_field(g, f); |
| 1058 | purple_request_fields_add_group(fields, g); | |
| 8849 | 1059 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1060 | purple_request_fields(gc, _("User Online Status Attributes"), |
| 8849 | 1061 | _("User Online Status Attributes"), |
| 1062 | _("You can let other users see your online status information " | |
| 1063 | "and your personal information. Please fill the information " | |
| 1064 | "you would like other users to see about yourself."), | |
| 1065 | fields, | |
| 15884 | 1066 | _("OK"), G_CALLBACK(silcpurple_attrs_cb), |
|
16492
4f0dc2d16e55
Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
1067 | _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34312
diff
changeset
|
1068 | purple_request_cpar_from_connection(gc), gc); |
| 8849 | 1069 | } |
| 1070 | ||
| 1071 | static void | |
| 15884 | 1072 | silcpurple_detach(PurplePluginAction *action) |
| 8849 | 1073 | { |
| 15884 | 1074 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 1075 | SilcPurple sg; | |
| 8849 | 1076 | |
| 1077 | if (!gc) | |
| 1078 | return; | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1079 | sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1080 | if (!sg) |
| 1081 | return; | |
| 1082 | ||
| 1083 | /* Call DETACH */ | |
| 1084 | silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
| 1085 | sg->detaching = TRUE; | |
| 1086 | } | |
| 1087 | ||
| 1088 | static void | |
| 15884 | 1089 | silcpurple_view_motd(PurplePluginAction *action) |
| 8849 | 1090 | { |
| 15884 | 1091 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 1092 | SilcPurple sg; | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1093 | char *tmp; |
| 8849 | 1094 | |
| 1095 | if (!gc) | |
| 1096 | return; | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1097 | sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1098 | if (!sg) |
| 1099 | return; | |
| 1100 | ||
| 1101 | if (!sg->motd) { | |
| 15884 | 1102 | purple_notify_error( |
| 8849 | 1103 | gc, _("Message of the Day"), _("No Message of the Day available"), |
| 1104 | _("There is no Message of the Day associated with this connection")); | |
| 1105 | return; | |
| 1106 | } | |
| 1107 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
1108 | tmp = g_markup_escape_text(sg->motd, -1); |
| 15884 | 1109 | purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1110 | tmp, NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1111 | g_free(tmp); |
| 8849 | 1112 | } |
| 1113 | ||
| 9272 | 1114 | static void |
| 15884 | 1115 | silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields) |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1116 | { |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1117 | /* Nothing */ |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1118 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1119 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1120 | static void |
| 15884 | 1121 | silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1122 | { |
|
31802
f54b3406b834
silc: Dead (redundant) initialization
Paul Aurich <darkrain42@pidgin.im>
parents:
31595
diff
changeset
|
1123 | SilcPurple sg; |
| 15884 | 1124 | PurpleRequestField *f; |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1125 | const char *val, *pkfile = NULL, *prfile = NULL; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1126 | const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1127 | const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1128 | char *identifier; |
| 15884 | 1129 | int keylen = SILCPURPLE_DEF_PKCS_LEN; |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1130 | SilcPublicKey public_key; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1131 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1132 | sg = purple_connection_get_protocol_data(gc); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1133 | if (!sg) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1134 | return; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1135 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1136 | val = NULL; |
| 15884 | 1137 | f = purple_request_fields_get_field(fields, "pass1"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1138 | if (f) |
| 15884 | 1139 | val = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1140 | if (val && *val) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1141 | pass1 = val; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1142 | else |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1143 | pass1 = ""; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1144 | val = NULL; |
| 15884 | 1145 | f = purple_request_fields_get_field(fields, "pass2"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1146 | if (f) |
| 15884 | 1147 | val = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1148 | if (val && *val) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1149 | pass2 = val; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1150 | else |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1151 | pass2 = ""; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1152 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1153 | if (strcmp(pass1, pass2)) { |
| 15884 | 1154 | purple_notify_error( |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1155 | gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1156 | return; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1157 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1158 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1159 | val = NULL; |
| 15884 | 1160 | f = purple_request_fields_get_field(fields, "key"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1161 | if (f) |
| 15884 | 1162 | val = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1163 | if (val && *val) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1164 | keylen = atoi(val); |
| 15884 | 1165 | f = purple_request_fields_get_field(fields, "pkfile"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1166 | if (f) |
| 15884 | 1167 | pkfile = purple_request_field_string_get_value(f); |
| 1168 | f = purple_request_fields_get_field(fields, "prfile"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1169 | if (f) |
| 15884 | 1170 | prfile = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1171 | |
| 15884 | 1172 | f = purple_request_fields_get_field(fields, "un"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1173 | if (f) |
| 15884 | 1174 | un = purple_request_field_string_get_value(f); |
| 1175 | f = purple_request_fields_get_field(fields, "hn"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1176 | if (f) |
| 15884 | 1177 | hn = purple_request_field_string_get_value(f); |
| 1178 | f = purple_request_fields_get_field(fields, "rn"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1179 | if (f) |
| 15884 | 1180 | rn = purple_request_field_string_get_value(f); |
| 1181 | f = purple_request_fields_get_field(fields, "e"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1182 | if (f) |
| 15884 | 1183 | e = purple_request_field_string_get_value(f); |
| 1184 | f = purple_request_fields_get_field(fields, "o"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1185 | if (f) |
| 15884 | 1186 | o = purple_request_field_string_get_value(f); |
| 1187 | f = purple_request_fields_get_field(fields, "c"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1188 | if (f) |
| 15884 | 1189 | c = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1190 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1191 | identifier = silc_pkcs_silc_encode_identifier((char *)un, (char *)hn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1192 | (char *)rn, (char *)e, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1193 | (char *)o, (char *)c, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1194 | NULL); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1195 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1196 | /* Create the key pair */ |
| 15884 | 1197 | if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1198 | identifier, pass1, &public_key, NULL, |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1199 | FALSE)) { |
| 15884 | 1200 | purple_notify_error( |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1201 | gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1202 | return; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1203 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1204 | |
| 15884 | 1205 | silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1206 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1207 | silc_pkcs_public_key_free(public_key); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1208 | silc_free(identifier); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1209 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1210 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1211 | static void |
| 15884 | 1212 | silcpurple_create_keypair(PurplePluginAction *action) |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1213 | { |
| 15884 | 1214 | PurpleConnection *gc = (PurpleConnection *) action->context; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1215 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 15884 | 1216 | PurpleRequestFields *fields; |
| 1217 | PurpleRequestFieldGroup *g; | |
| 1218 | PurpleRequestField *f; | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1219 | const char *username, *realname; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1220 | char *hostname, **u; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1221 | char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1222 | |
| 15884 | 1223 | username = purple_account_get_username(sg->account); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1224 | u = g_strsplit(username, "@", 2); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1225 | username = u[0]; |
| 15884 | 1226 | realname = purple_account_get_user_info(sg->account); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1227 | hostname = silc_net_localhost(); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1228 | g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1229 | |
| 15884 | 1230 | g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); |
| 1231 | g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1232 | g_snprintf(pkd, sizeof(pkd) - 1, "%s", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
1233 | purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2)); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1234 | g_snprintf(prd, sizeof(prd) - 1, "%s", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
1235 | purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2)); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1236 | |
| 15884 | 1237 | fields = purple_request_fields_new(); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1238 | |
| 15884 | 1239 | g = purple_request_field_group_new(NULL); |
| 1240 | f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); | |
| 1241 | purple_request_field_group_add_field(g, f); | |
| 1242 | f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE); | |
| 1243 | purple_request_field_group_add_field(g, f); | |
| 1244 | f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE); | |
| 1245 | purple_request_field_group_add_field(g, f); | |
| 1246 | purple_request_fields_add_group(fields, g); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1247 | |
| 15884 | 1248 | g = purple_request_field_group_new(NULL); |
| 1249 | f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE); | |
| 1250 | purple_request_field_group_add_field(g, f); | |
| 1251 | f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); | |
| 1252 | purple_request_field_group_add_field(g, f); | |
| 1253 | f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE); | |
| 1254 | purple_request_field_group_add_field(g, f); | |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23278
diff
changeset
|
1255 | f = purple_request_field_string_new("e", _("Email"), tmp, FALSE); |
| 15884 | 1256 | purple_request_field_group_add_field(g, f); |
| 1257 | f = purple_request_field_string_new("o", _("Organization"), "", FALSE); | |
| 1258 | purple_request_field_group_add_field(g, f); | |
| 1259 | f = purple_request_field_string_new("c", _("Country"), "", FALSE); | |
| 1260 | purple_request_field_group_add_field(g, f); | |
| 1261 | purple_request_fields_add_group(fields, g); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1262 | |
| 15884 | 1263 | g = purple_request_field_group_new(NULL); |
| 1264 | f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE); | |
| 1265 | purple_request_field_string_set_masked(f, TRUE); | |
| 1266 | purple_request_field_group_add_field(g, f); | |
| 1267 | f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE); | |
| 1268 | purple_request_field_string_set_masked(f, TRUE); | |
| 1269 | purple_request_field_group_add_field(g, f); | |
| 1270 | purple_request_fields_add_group(fields, g); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1271 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1272 | purple_request_fields(gc, _("Create New SILC Key Pair"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1273 | _("Create New SILC Key Pair"), NULL, fields, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1274 | _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1275 | _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34312
diff
changeset
|
1276 | purple_request_cpar_from_connection(gc), gc); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1277 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1278 | g_strfreev(u); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1279 | silc_free(hostname); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1280 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1281 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1282 | static void |
| 15884 | 1283 | silcpurple_change_pass(PurplePluginAction *action) |
| 9272 | 1284 | { |
| 15884 | 1285 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 1286 | purple_account_request_change_password(purple_connection_get_account(gc)); | |
| 9272 | 1287 | } |
| 1288 | ||
| 1289 | static void | |
| 15884 | 1290 | silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) |
| 9272 | 1291 | { |
|
22852
f6f9031e09fe
Fix for changing silc private key passphrase to or from the empty string,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22847
diff
changeset
|
1292 | char prd[256]; |
| 15884 | 1293 | g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
1294 | silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1295 | "private-key", |
|
22852
f6f9031e09fe
Fix for changing silc private key passphrase to or from the empty string,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22847
diff
changeset
|
1296 | prd), old ? old : "", new ? new : ""); |
| 9272 | 1297 | } |
| 1298 | ||
| 1299 | static void | |
| 15884 | 1300 | silcpurple_show_set_info(PurplePluginAction *action) |
| 9272 | 1301 | { |
| 15884 | 1302 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 1303 | purple_account_request_change_user_info(purple_connection_get_account(gc)); | |
| 9272 | 1304 | } |
| 1305 | ||
| 1306 | static void | |
| 15884 | 1307 | silcpurple_set_info(PurpleConnection *gc, const char *text) |
| 9272 | 1308 | { |
| 1309 | } | |
| 1310 | ||
| 8849 | 1311 | static GList * |
| 15884 | 1312 | silcpurple_actions(PurplePlugin *plugin, gpointer context) |
| 8849 | 1313 | { |
| 1314 | GList *list = NULL; | |
| 15884 | 1315 | PurplePluginAction *act; |
| 8849 | 1316 | |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
1317 | act = purple_plugin_action_new(_("Online Status"), |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
1318 | silcpurple_attrs); |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
1319 | list = g_list_append(list, act); |
| 8849 | 1320 | |
| 15884 | 1321 | act = purple_plugin_action_new(_("Detach From Server"), |
| 1322 | silcpurple_detach); | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1323 | list = g_list_append(list, act); |
| 8849 | 1324 | |
| 15884 | 1325 | act = purple_plugin_action_new(_("View Message of the Day"), |
| 1326 | silcpurple_view_motd); | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1327 | list = g_list_append(list, act); |
| 8849 | 1328 | |
| 15884 | 1329 | act = purple_plugin_action_new(_("Create SILC Key Pair..."), |
| 1330 | silcpurple_create_keypair); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1331 | list = g_list_append(list, act); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1332 | |
| 15884 | 1333 | act = purple_plugin_action_new(_("Change Password..."), |
| 1334 | silcpurple_change_pass); | |
| 9272 | 1335 | list = g_list_append(list, act); |
| 1336 | ||
| 15884 | 1337 | act = purple_plugin_action_new(_("Set User Info..."), |
| 1338 | silcpurple_show_set_info); | |
| 9272 | 1339 | list = g_list_append(list, act); |
| 1340 | ||
| 8849 | 1341 | return list; |
| 1342 | } | |
| 1343 | ||
| 1344 | ||
| 1345 | /******************************* IM Routines *********************************/ | |
| 1346 | ||
| 1347 | typedef struct { | |
| 1348 | char *nick; | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11257
diff
changeset
|
1349 | char *message; |
| 8849 | 1350 | SilcUInt32 message_len; |
| 1351 | SilcMessageFlags flags; | |
| 15884 | 1352 | PurpleMessageFlags gflags; |
| 1353 | } *SilcPurpleIM; | |
| 8849 | 1354 | |
| 1355 | static void | |
| 15884 | 1356 | silcpurple_send_im_resolved(SilcClient client, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1357 | SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1358 | SilcStatus status, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1359 | SilcDList clients, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1360 | void *context) |
| 8849 | 1361 | { |
| 15884 | 1362 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1363 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 15884 | 1364 | SilcPurpleIM im = context; |
| 1365 | PurpleConversation *convo; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1366 | char tmp[256]; |
| 8849 | 1367 | SilcClientEntry client_entry; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1368 | SilcDList list; |
|
25545
040ec50ba303
Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents:
23551
diff
changeset
|
1369 | gboolean free_list = FALSE; |
| 8849 | 1370 | |
| 15884 | 1371 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1372 | sg->account); |
| 8849 | 1373 | if (!convo) |
| 1374 | return; | |
| 1375 | ||
| 1376 | if (!clients) | |
| 1377 | goto err; | |
| 1378 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1379 | if (silc_dlist_count(clients) > 1) { |
| 8849 | 1380 | /* Find the correct one. The im->nick might be a formatted nick |
| 1381 | so this will find the correct one. */ | |
| 1382 | clients = silc_client_get_clients_local(client, conn, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1383 | im->nick, FALSE); |
| 8849 | 1384 | if (!clients) |
| 1385 | goto err; | |
|
25545
040ec50ba303
Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents:
23551
diff
changeset
|
1386 | |
|
040ec50ba303
Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents:
23551
diff
changeset
|
1387 | free_list = TRUE; |
| 8849 | 1388 | } |
| 1389 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1390 | silc_dlist_start(clients); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1391 | client_entry = silc_dlist_get(clients); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1392 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1393 | /* Check for images */ |
| 15884 | 1394 | if (im->gflags & PURPLE_MESSAGE_IMAGES) { |
|
33798
ab26d8e3da97
silc: Use appropriate datatype for SilcMessageFlags
Daniel Atallah <datallah@pidgin.im>
parents:
31802
diff
changeset
|
1395 | list = silcpurple_image_message(im->message, &im->flags); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1396 | if (list) { |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1397 | /* Send one or more MIME message. If more than one, they |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1398 | are MIME fragments due to over large message */ |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1399 | SilcBuffer buf; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1400 | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1401 | silc_dlist_start(list); |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1402 | while ((buf = silc_dlist_get(list)) != SILC_LIST_END) |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1403 | silc_client_send_private_message(client, conn, |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
1404 | client_entry, im->flags, sg->sha1hash, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1405 | buf->data, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1406 | silc_buffer_len(buf)); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1407 | silc_mime_partial_free(list); |
| 15884 | 1408 | purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1409 | im->message, 0, time(NULL)); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1410 | goto out; |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1411 | } |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1412 | } |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1413 | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1414 | /* Send the message */ |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1415 | silc_client_send_private_message(client, conn, client_entry, im->flags, |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
1416 | sg->sha1hash, (unsigned char *)im->message, im->message_len); |
| 15884 | 1417 | purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1418 | im->message, 0, time(NULL)); |
| 8849 | 1419 | goto out; |
| 1420 | ||
| 1421 | err: | |
| 1422 | g_snprintf(tmp, sizeof(tmp), | |
| 1423 | _("User <I>%s</I> is not present in the network"), im->nick); | |
| 15884 | 1424 | purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8849 | 1425 | |
| 1426 | out: | |
|
25545
040ec50ba303
Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents:
23551
diff
changeset
|
1427 | if (free_list) { |
|
040ec50ba303
Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents:
23551
diff
changeset
|
1428 | silc_client_list_free(client, conn, clients); |
|
040ec50ba303
Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents:
23551
diff
changeset
|
1429 | } |
| 8849 | 1430 | g_free(im->nick); |
| 1431 | g_free(im->message); | |
| 1432 | silc_free(im); | |
| 1433 | } | |
| 1434 | ||
| 1435 | static int | |
| 15884 | 1436 | silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1437 | PurpleMessageFlags flags) |
| 8849 | 1438 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1439 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1440 | SilcClient client = sg->client; |
| 1441 | SilcClientConnection conn = sg->conn; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1442 | SilcDList clients; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1443 | SilcClientEntry client_entry; |
|
33798
ab26d8e3da97
silc: Use appropriate datatype for SilcMessageFlags
Daniel Atallah <datallah@pidgin.im>
parents:
31802
diff
changeset
|
1444 | SilcMessageFlags mflags; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1445 | char *msg, *tmp; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1446 | int ret = 0; |
| 15884 | 1447 | gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1448 | SilcDList list; |
| 8849 | 1449 | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1450 | if (!who || !message) |
| 8849 | 1451 | return 0; |
| 1452 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1453 | mflags = SILC_MESSAGE_FLAG_UTF8; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1454 | |
| 15884 | 1455 | tmp = msg = purple_unescape_html(message); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1456 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1457 | if (!g_ascii_strncasecmp(msg, "/me ", 4)) { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1458 | msg += 4; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1459 | if (!*msg) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1460 | g_free(tmp); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1461 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1462 | } |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1463 | mflags |= SILC_MESSAGE_FLAG_ACTION; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1464 | } else if (strlen(msg) > 1 && msg[0] == '/') { |
| 8849 | 1465 | if (!silc_client_command_call(client, conn, msg + 1)) |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1466 | purple_notify_error(gc, _("Call Command"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1467 | _("Cannot call command"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1468 | _("Unknown command")); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1469 | g_free(tmp); |
| 8849 | 1470 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1471 | } |
| 8849 | 1472 | |
| 1473 | if (sign) | |
| 1474 | mflags |= SILC_MESSAGE_FLAG_SIGNED; | |
| 1475 | ||
| 1476 | /* Find client entry */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1477 | clients = silc_client_get_clients_local(client, conn, who, FALSE); |
| 8849 | 1478 | if (!clients) { |
| 1479 | /* Resolve unknown user */ | |
| 15884 | 1480 | SilcPurpleIM im = silc_calloc(1, sizeof(*im)); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1481 | if (!im) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1482 | g_free(tmp); |
| 8849 | 1483 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1484 | } |
| 8849 | 1485 | im->nick = g_strdup(who); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1486 | im->message = g_strdup(message); |
| 8849 | 1487 | im->message_len = strlen(im->message); |
| 1488 | im->flags = mflags; | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1489 | im->gflags = flags; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1490 | silc_client_get_clients(client, conn, who, NULL, |
| 15884 | 1491 | silcpurple_send_im_resolved, im); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1492 | g_free(tmp); |
| 8849 | 1493 | return 0; |
| 1494 | } | |
| 1495 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1496 | silc_dlist_start(clients); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1497 | client_entry = silc_dlist_get(clients); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1498 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1499 | /* Check for images */ |
| 15884 | 1500 | if (flags & PURPLE_MESSAGE_IMAGES) { |
| 1501 | list = silcpurple_image_message(message, &mflags); | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1502 | if (list) { |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1503 | /* Send one or more MIME message. If more than one, they |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1504 | are MIME fragments due to over large message */ |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1505 | SilcBuffer buf; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1506 | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1507 | silc_dlist_start(list); |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1508 | while ((buf = silc_dlist_get(list)) != SILC_LIST_END) |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1509 | ret = |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1510 | silc_client_send_private_message(client, conn, |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
1511 | client_entry, mflags, sg->sha1hash, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1512 | buf->data, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1513 | silc_buffer_len(buf)); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1514 | silc_mime_partial_free(list); |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1515 | g_free(tmp); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1516 | silc_client_list_free(client, conn, clients); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1517 | return ret; |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1518 | } |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1519 | } |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1520 | |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1521 | /* Send private message directly */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1522 | ret = silc_client_send_private_message(client, conn, client_entry, |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19684
diff
changeset
|
1523 | mflags, sg->sha1hash, |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1524 | (unsigned char *)msg, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1525 | strlen(msg)); |
| 8849 | 1526 | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1527 | g_free(tmp); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1528 | silc_client_list_free(client, conn, clients); |
| 8849 | 1529 | return ret; |
| 1530 | } | |
| 1531 | ||
| 1532 | ||
| 15884 | 1533 | static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) { |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1534 | /* split this single menu building function back into the two |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1535 | original: one for buddies and one for chats */ |
| 15884 | 1536 | if(PURPLE_BLIST_NODE_IS_CHAT(node)) { |
| 1537 | return silcpurple_chat_menu((PurpleChat *) node); | |
| 1538 | } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
| 1539 | return silcpurple_buddy_menu((PurpleBuddy *) node); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1540 | } else { |
| 9038 | 1541 | g_return_val_if_reached(NULL); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1542 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1543 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1544 | |
| 9272 | 1545 | /********************************* Commands **********************************/ |
| 1546 | ||
| 15884 | 1547 | static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, |
| 9597 | 1548 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1549 | { |
| 15884 | 1550 | PurpleConnection *gc; |
| 1551 | PurpleConversation *convo = conv; | |
| 9272 | 1552 | int id = 0; |
| 1553 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1554 | gc = purple_conversation_get_connection(conv); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1555 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1556 | if (gc == NULL) |
| 15884 | 1557 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1558 | |
|
13636
7f3119845b45
[gaim-migrate @ 16033]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13546
diff
changeset
|
1559 | if(args && args[0]) |
| 15884 | 1560 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
1561 | purple_connection_get_account(gc)); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1562 | |
|
13636
7f3119845b45
[gaim-migrate @ 16033]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13546
diff
changeset
|
1563 | if (convo != NULL) |
| 15884 | 1564 | id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1565 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1566 | if (id == 0) |
| 15884 | 1567 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1568 | |
| 15884 | 1569 | silcpurple_chat_leave(gc, id); |
| 9272 | 1570 | |
| 15884 | 1571 | return PURPLE_CMD_RET_OK; |
| 9272 | 1572 | |
| 1573 | } | |
| 1574 | ||
| 15884 | 1575 | static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, |
| 9597 | 1576 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1577 | { |
| 15884 | 1578 | PurpleConnection *gc; |
| 9272 | 1579 | int id = 0; |
| 9762 | 1580 | char *buf, *tmp, *tmp2; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1581 | const char *topic; |
| 9272 | 1582 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1583 | gc = purple_conversation_get_connection(conv); |
| 15884 | 1584 | id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); |
| 9272 | 1585 | |
| 1586 | if (gc == NULL || id == 0) | |
| 15884 | 1587 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1588 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1589 | if (!args || !args[0]) { |
| 15884 | 1590 | topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1591 | if (topic) { |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
1592 | tmp = g_markup_escape_text(topic, -1); |
| 15884 | 1593 | tmp2 = purple_markup_linkify(tmp); |
| 9762 | 1594 | buf = g_strdup_printf(_("current topic is: %s"), tmp2); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1595 | g_free(tmp); |
| 9762 | 1596 | g_free(tmp2); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1597 | } else |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1598 | buf = g_strdup(_("No topic is set")); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
1599 | purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(purple_connection_get_account(gc)), buf, |
| 15884 | 1600 | PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1601 | g_free(buf); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1602 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1603 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1604 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1605 | if (args && args[0] && (strlen(args[0]) > 255)) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1606 | *error = g_strdup(_("Topic too long")); |
| 15884 | 1607 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1608 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1609 | |
| 15884 | 1610 | silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL); |
| 9272 | 1611 | |
| 15884 | 1612 | return PURPLE_CMD_RET_OK; |
| 9272 | 1613 | } |
| 1614 | ||
| 15884 | 1615 | static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, |
| 9597 | 1616 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1617 | { |
| 1618 | GHashTable *comp; | |
| 1619 | ||
| 1620 | if(!args || !args[0]) | |
| 15884 | 1621 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1622 | |
| 1623 | comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); | |
| 1624 | ||
| 1625 | g_hash_table_replace(comp, "channel", args[0]); | |
| 1626 | if(args[1]) | |
| 1627 | g_hash_table_replace(comp, "passphrase", args[1]); | |
| 1628 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1629 | silcpurple_chat_join(purple_conversation_get_connection(conv), comp); |
| 9272 | 1630 | |
| 1631 | g_hash_table_destroy(comp); | |
| 15884 | 1632 | return PURPLE_CMD_RET_OK; |
| 9272 | 1633 | } |
| 1634 | ||
| 15884 | 1635 | static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, |
| 9597 | 1636 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1637 | { |
| 15884 | 1638 | PurpleConnection *gc; |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1639 | gc = purple_conversation_get_connection(conv); |
| 15884 | 1640 | purple_roomlist_show_with_account(purple_connection_get_account(gc)); |
| 1641 | return PURPLE_CMD_RET_OK; | |
| 9272 | 1642 | } |
| 1643 | ||
| 15884 | 1644 | static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, |
| 9597 | 1645 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1646 | { |
| 15884 | 1647 | PurpleConnection *gc; |
| 9272 | 1648 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1649 | gc = purple_conversation_get_connection(conv); |
| 9272 | 1650 | |
| 1651 | if (gc == NULL) | |
| 15884 | 1652 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1653 | |
| 15884 | 1654 | silcpurple_get_info(gc, args[0]); |
| 9272 | 1655 | |
| 15884 | 1656 | return PURPLE_CMD_RET_OK; |
| 9272 | 1657 | } |
| 1658 | ||
| 15884 | 1659 | static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, |
| 9597 | 1660 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1661 | { |
| 1662 | int ret; | |
| 15884 | 1663 | PurpleConnection *gc; |
| 9272 | 1664 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1665 | gc = purple_conversation_get_connection(conv); |
| 9272 | 1666 | |
| 1667 | if (gc == NULL) | |
| 15884 | 1668 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1669 | |
| 15884 | 1670 | ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); |
| 9272 | 1671 | |
| 1672 | if (ret) | |
| 15884 | 1673 | return PURPLE_CMD_RET_OK; |
| 9272 | 1674 | else |
| 15884 | 1675 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1676 | } |
| 1677 | ||
| 15884 | 1678 | static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, |
| 9597 | 1679 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1680 | { |
| 1681 | int ret = 1; | |
| 15884 | 1682 | PurpleConversation *convo; |
| 1683 | PurpleConnection *gc; | |
| 1684 | PurpleAccount *account; | |
| 9272 | 1685 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1686 | if (!args || !args[0]) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1687 | *error = g_strdup(_("You must specify a nick")); |
| 15884 | 1688 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1689 | } |
| 9272 | 1690 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1691 | gc = purple_conversation_get_connection(conv); |
| 9272 | 1692 | |
| 1693 | if (gc == NULL) | |
| 15884 | 1694 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1695 | |
| 15884 | 1696 | account = purple_connection_get_account(gc); |
| 9272 | 1697 | |
| 15884 | 1698 | convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]); |
| 9272 | 1699 | |
| 1700 | if (args[1]) { | |
| 15884 | 1701 | ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); |
| 1702 | purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), | |
| 1703 | args[1], PURPLE_MESSAGE_SEND, time(NULL)); | |
| 9272 | 1704 | } |
| 1705 | ||
| 1706 | if (ret) | |
| 15884 | 1707 | return PURPLE_CMD_RET_OK; |
| 9272 | 1708 | else |
| 15884 | 1709 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1710 | } |
| 1711 | ||
| 15884 | 1712 | static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, |
| 9597 | 1713 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1714 | { |
| 15884 | 1715 | PurpleConnection *gc; |
| 1716 | SilcPurple sg; | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1717 | char *tmp; |
| 9272 | 1718 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1719 | gc = purple_conversation_get_connection(conv); |
| 9272 | 1720 | |
| 1721 | if (gc == NULL) | |
| 15884 | 1722 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1723 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1724 | sg = purple_connection_get_protocol_data(gc); |
| 9272 | 1725 | |
| 1726 | if (sg == NULL) | |
| 15884 | 1727 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1728 | |
| 1729 | if (!sg->motd) { | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1730 | *error = g_strdup(_("There is no Message of the Day associated with this connection")); |
| 15884 | 1731 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1732 | } |
| 1733 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
1734 | tmp = g_markup_escape_text(sg->motd, -1); |
| 15884 | 1735 | purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1736 | tmp, NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1737 | g_free(tmp); |
| 9272 | 1738 | |
| 15884 | 1739 | return PURPLE_CMD_RET_OK; |
| 9272 | 1740 | } |
| 1741 | ||
| 15884 | 1742 | static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, |
| 9597 | 1743 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1744 | { |
| 15884 | 1745 | PurpleConnection *gc; |
| 1746 | SilcPurple sg; | |
| 9272 | 1747 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1748 | gc = purple_conversation_get_connection(conv); |
| 9272 | 1749 | |
| 1750 | if (gc == NULL) | |
| 15884 | 1751 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1752 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1753 | sg = purple_connection_get_protocol_data(gc); |
| 9272 | 1754 | |
| 1755 | if (sg == NULL) | |
| 15884 | 1756 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1757 | |
| 1758 | silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
| 1759 | sg->detaching = TRUE; | |
| 1760 | ||
| 15884 | 1761 | return PURPLE_CMD_RET_OK; |
| 9272 | 1762 | } |
| 1763 | ||
| 15884 | 1764 | static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, |
| 9597 | 1765 | const char *cmd, char **args, char **error, void *data) |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1766 | { |
| 15884 | 1767 | PurpleConnection *gc; |
| 1768 | SilcPurple sg; | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1769 | SilcChannelEntry channel; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1770 | char *silccmd, *silcargs, *msg, tmp[256]; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1771 | const char *chname; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1772 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1773 | gc = purple_conversation_get_connection(conv); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1774 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1775 | if (gc == NULL || !args || purple_connection_get_protocol_data(gc) == NULL) |
| 15884 | 1776 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1777 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1778 | sg = purple_connection_get_protocol_data(gc); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1779 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1780 | if (args[0]) |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1781 | chname = args[0]; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1782 | else |
| 15884 | 1783 | chname = purple_conversation_get_name(conv); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1784 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1785 | if (!args[1]) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1786 | channel = silc_client_get_channel(sg->client, sg->conn, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1787 | (char *)chname); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1788 | if (!channel) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1789 | *error = g_strdup_printf(_("channel %s not found"), chname); |
| 15884 | 1790 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1791 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1792 | if (channel->mode) { |
| 15884 | 1793 | silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1794 | msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1795 | } else { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1796 | msg = g_strdup_printf(_("no channel modes are set on %s"), chname); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1797 | } |
| 15884 | 1798 | purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", |
| 1799 | msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1800 | g_free(msg); |
| 15884 | 1801 | return PURPLE_CMD_RET_OK; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1802 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1803 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1804 | silcargs = g_strjoinv(" ", args); |
|
33801
6dbfcd72998e
Fix a few cases of dead code
Daniel Atallah <datallah@pidgin.im>
parents:
33798
diff
changeset
|
1805 | silccmd = g_strconcat(cmd, " ", silcargs, NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1806 | g_free(silcargs); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1807 | if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1808 | g_free(silccmd); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1809 | *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); |
| 15884 | 1810 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1811 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1812 | g_free(silccmd); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1813 | |
| 15884 | 1814 | return PURPLE_CMD_RET_OK; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1815 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1816 | |
| 15884 | 1817 | static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, |
| 9597 | 1818 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1819 | { |
| 15884 | 1820 | PurpleConnection *gc; |
| 1821 | SilcPurple sg; | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1822 | char *silccmd, *silcargs; |
| 9272 | 1823 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1824 | gc = purple_conversation_get_connection(conv); |
| 9272 | 1825 | |
| 1826 | if (gc == NULL) | |
| 15884 | 1827 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1828 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1829 | sg = purple_connection_get_protocol_data(gc); |
| 9272 | 1830 | |
| 1831 | if (sg == NULL) | |
| 15884 | 1832 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1833 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1834 | silcargs = g_strjoinv(" ", args); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1835 | silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1836 | g_free(silcargs); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1837 | if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1838 | g_free(silccmd); |
|
15444
b793ef258d23
I think this changes every user-visible string that contains 'Gaim.' We probably want the UI to be able
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1839 | *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd); |
| 15884 | 1840 | return PURPLE_CMD_RET_FAILED; |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1841 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1842 | g_free(silccmd); |
| 9272 | 1843 | |
| 15884 | 1844 | return PURPLE_CMD_RET_OK; |
| 9272 | 1845 | } |
| 1846 | ||
| 15884 | 1847 | static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, |
| 9597 | 1848 | const char *cmd, char **args, char **error, void *data) |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1849 | { |
| 15884 | 1850 | PurpleConnection *gc; |
| 1851 | SilcPurple sg; | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1852 | GHashTable *ui_info; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1853 | const char *ui_name = NULL, *ui_website = NULL; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1854 | char *quit_msg; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1855 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1856 | gc = purple_conversation_get_connection(conv); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1857 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1858 | if (gc == NULL) |
| 15884 | 1859 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1860 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1861 | sg = purple_connection_get_protocol_data(gc); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1862 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1863 | if (sg == NULL) |
| 15884 | 1864 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1865 | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1866 | ui_info = purple_core_get_ui_info(); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1867 | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1868 | if(ui_info) { |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1869 | ui_name = g_hash_table_lookup(ui_info, "name"); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1870 | ui_website = g_hash_table_lookup(ui_info, "website"); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1871 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30138
diff
changeset
|
1872 | |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1873 | if(!ui_name || !ui_website) { |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1874 | ui_name = "Pidgin"; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1875 | ui_website = PURPLE_WEBSITE; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1876 | } |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1877 | quit_msg = g_strdup_printf(_("Download %s: %s"), |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1878 | ui_name, ui_website); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1879 | |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1880 | silc_client_command_call(sg->client, sg->conn, NULL, |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1881 | "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1882 | g_free(quit_msg); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1883 | |
| 15884 | 1884 | return PURPLE_CMD_RET_OK; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1885 | } |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1886 | |
| 15884 | 1887 | static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, |
| 9597 | 1888 | const char *cmd, char **args, char **error, void *data) |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1889 | { |
| 15884 | 1890 | PurpleConnection *gc; |
| 1891 | SilcPurple sg; | |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1892 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32683
diff
changeset
|
1893 | gc = purple_conversation_get_connection(conv); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1894 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1895 | if (gc == NULL) |
| 15884 | 1896 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1897 | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
1898 | sg = purple_connection_get_protocol_data(gc); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1899 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1900 | if (sg == NULL) |
| 15884 | 1901 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1902 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1903 | if (!silc_client_command_call(sg->client, sg->conn, args[0])) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1904 | *error = g_strdup_printf(_("Unknown command: %s"), args[0]); |
| 15884 | 1905 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1906 | } |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1907 | |
| 15884 | 1908 | return PURPLE_CMD_RET_OK; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1909 | } |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1910 | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1911 | |
| 8849 | 1912 | /************************** Plugin Initialization ****************************/ |
| 1913 | ||
| 9272 | 1914 | static void |
| 15884 | 1915 | silcpurple_register_commands(void) |
| 9272 | 1916 | { |
| 15884 | 1917 | purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL, |
| 1918 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 1919 | PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, | |
| 1920 | "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); | |
| 1921 | purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL, | |
| 1922 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 1923 | PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, | |
| 1924 | "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); | |
| 1925 | purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, | |
| 1926 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1927 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
| 1928 | silcpurple_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); | |
| 1929 | purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, | |
| 1930 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 1931 | PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, | |
| 1932 | "prpl-silc", silcpurple_cmd_chat_join, | |
| 9597 | 1933 | _("join <channel> [<password>]: Join a chat on this network"), NULL); |
| 15884 | 1934 | purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, |
| 1935 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1936 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
| 1937 | silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL); | |
| 1938 | purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL, | |
| 1939 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9272 | 1940 | "prpl-silc", |
| 15884 | 1941 | silcpurple_cmd_whois, _("whois <nick>: View nick's information"), NULL); |
| 1942 | purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, | |
| 1943 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1944 | "prpl-silc", silcpurple_cmd_msg, | |
| 9597 | 1945 | _("msg <nick> <message>: Send a private message to a user"), NULL); |
| 15884 | 1946 | purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL, |
| 1947 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1948 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query, | |
| 9597 | 1949 | _("query <nick> [<message>]: Send a private message to a user"), NULL); |
| 15884 | 1950 | purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL, |
| 1951 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1952 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd, | |
| 9597 | 1953 | _("motd: View the server's Message Of The Day"), NULL); |
| 15884 | 1954 | purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL, |
| 1955 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1956 | "prpl-silc", silcpurple_cmd_detach, | |
| 9597 | 1957 | _("detach: Detach this session"), NULL); |
| 15884 | 1958 | purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL, |
| 1959 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1960 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit, | |
| 9597 | 1961 | _("quit [message]: Disconnect from the server, with an optional message"), NULL); |
| 15884 | 1962 | purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL, |
| 1963 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1964 | "prpl-silc", silcpurple_cmd_call, | |
| 9597 | 1965 | _("call <command>: Call any silc client command"), NULL); |
| 1966 | /* These below just get passed through for the silc client library to deal | |
| 1967 | * with */ | |
| 15884 | 1968 | purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL, |
| 1969 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1970 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1971 | _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); |
| 15884 | 1972 | purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL, |
| 1973 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1974 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1975 | _("nick <newnick>: Change your nickname"), NULL); |
| 15884 | 1976 | purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL, |
| 1977 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1978 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1979 | _("whowas <nick>: View nick's information"), NULL); |
| 15884 | 1980 | purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL, |
| 1981 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1982 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode, | |
| 9597 | 1983 | _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); |
| 15884 | 1984 | purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL, |
| 1985 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1986 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1987 | _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); |
| 15884 | 1988 | purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL, |
| 1989 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1990 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1991 | _("umode <usermodes>: Set your modes in the network"), NULL); |
| 15884 | 1992 | purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL, |
| 1993 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1994 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1995 | _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); |
| 15884 | 1996 | purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, |
| 1997 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1998 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1999 | _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); |
| 15884 | 2000 | purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL, |
| 2001 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2002 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 2003 | _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); |
| 15884 | 2004 | purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL, |
| 2005 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2006 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 2007 | _("info [server]: View server administrative details"), NULL); |
| 15884 | 2008 | purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL, |
| 2009 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2010 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 2011 | _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); |
| 15884 | 2012 | purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL, |
| 2013 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 2014 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 2015 | _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); |
| 15884 | 2016 | purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL, |
| 2017 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 2018 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 2019 | _("stats: View server and network statistics"), NULL); |
| 15884 | 2020 | purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL, |
| 2021 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 2022 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 2023 | _("ping: Send PING to the connected server"), NULL); |
| 15884 | 2024 | #if 0 /* Purple doesn't handle these yet */ |
| 2025 | purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL, | |
| 2026 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 2027 | "prpl-silc", silcpurple_cmd_users, | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
2028 | _("users <channel>: List users in channel")); |
| 15884 | 2029 | purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL, |
| 2030 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 2031 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_names, | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
2032 | _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
2033 | #endif |
| 9272 | 2034 | } |
| 2035 | ||
| 15884 | 2036 | static PurpleWhiteboardPrplOps silcpurple_wb_ops = |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
2037 | { |
| 15884 | 2038 | silcpurple_wb_start, |
| 2039 | silcpurple_wb_end, | |
| 2040 | silcpurple_wb_get_dimensions, | |
| 2041 | silcpurple_wb_set_dimensions, | |
| 2042 | silcpurple_wb_get_brush, | |
| 2043 | silcpurple_wb_set_brush, | |
| 2044 | silcpurple_wb_send, | |
| 2045 | silcpurple_wb_clear, | |
|
16776
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2046 | |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2047 | /* padding */ |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2048 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2049 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2050 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2051 | NULL |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
2052 | }; |
|
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
2053 | |
| 15884 | 2054 | static PurplePluginProtocolInfo prpl_info = |
| 8849 | 2055 | { |
|
32320
75839f9d761c
silc: Fix build and update for API changes
Paul Aurich <darkrain42@pidgin.im>
parents:
32281
diff
changeset
|
2056 | sizeof(PurplePluginProtocolInfo), /* struct_size */ |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2057 | OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | |
|
18092
1a2362194473
Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17408
diff
changeset
|
2058 | OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | |
|
1a2362194473
Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17408
diff
changeset
|
2059 | OPT_PROTO_SLASH_COMMANDS_NATIVE, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2060 | NULL, /* user_splits */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2061 | NULL, /* protocol_options */ |
| 15884 | 2062 | {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2063 | silcpurple_list_icon, /* list_icon */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2064 | NULL, /* list_emblems */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2065 | silcpurple_status_text, /* status_text */ |
| 15884 | 2066 | silcpurple_tooltip_text, /* tooltip_text */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2067 | silcpurple_away_states, /* away_states */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2068 | silcpurple_blist_node_menu, /* blist_node_menu */ |
| 15884 | 2069 | silcpurple_chat_info, /* chat_info */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2070 | silcpurple_chat_info_defaults, /* chat_info_defaults */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2071 | silcpurple_login, /* login */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2072 | silcpurple_close, /* close */ |
| 15884 | 2073 | silcpurple_send_im, /* send_im */ |
| 2074 | silcpurple_set_info, /* set_info */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2075 | NULL, /* send_typing */ |
| 15884 | 2076 | silcpurple_get_info, /* get_info */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2077 | silcpurple_set_status, /* set_status */ |
| 15884 | 2078 | silcpurple_idle_set, /* set_idle */ |
| 2079 | silcpurple_change_passwd, /* change_passwd */ | |
| 2080 | silcpurple_add_buddy, /* add_buddy */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2081 | NULL, /* add_buddies */ |
| 15884 | 2082 | silcpurple_remove_buddy, /* remove_buddy */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2083 | NULL, /* remove_buddies */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2084 | NULL, /* add_permit */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2085 | NULL, /* add_deny */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2086 | NULL, /* rem_permit */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2087 | NULL, /* rem_deny */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2088 | NULL, /* set_permit_deny */ |
| 15884 | 2089 | silcpurple_chat_join, /* join_chat */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2090 | NULL, /* reject_chat */ |
| 15884 | 2091 | silcpurple_get_chat_name, /* get_chat_name */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2092 | silcpurple_chat_invite, /* chat_invite */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2093 | silcpurple_chat_leave, /* chat_leave */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2094 | NULL, /* chat_whisper */ |
| 15884 | 2095 | silcpurple_chat_send, /* chat_send */ |
| 2096 | silcpurple_keepalive, /* keepalive */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2097 | NULL, /* register_user */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2098 | NULL, /* get_cb_info */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2099 | NULL, /* alias_buddy */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2100 | NULL, /* group_buddy */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2101 | NULL, /* rename_group */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2102 | NULL, /* buddy_free */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2103 | NULL, /* convo_closed */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2104 | NULL, /* normalize */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2105 | silcpurple_buddy_set_icon, /* set_buddy_icon */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2106 | NULL, /* remove_group */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2107 | NULL, /* get_cb_real_name */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2108 | silcpurple_chat_set_topic, /* set_chat_topic */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2109 | NULL, /* find_blist_chat */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2110 | silcpurple_roomlist_get_list, /* roomlist_get_list */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2111 | silcpurple_roomlist_cancel, /* roomlist_cancel */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2112 | NULL, /* roomlist_expand_category */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2113 | NULL, /* can_receive_file */ |
| 15884 | 2114 | silcpurple_ftp_send_file, /* send_file */ |
| 2115 | silcpurple_ftp_new_xfer, /* new_xfer */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2116 | NULL, /* offline_message */ |
| 15884 | 2117 | &silcpurple_wb_ops, /* whiteboard_prpl_ops */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2118 | NULL, /* send_raw */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2119 | NULL, /* roomlist_room_serialize */ |
|
22071
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
2120 | NULL, /* unregister_user */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
2121 | NULL, /* send_attention */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
2122 | NULL, /* get_attention_types */ |
|
23707
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
2123 | NULL, /* get_account_text_table */ |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22071
diff
changeset
|
2124 | NULL, /* initiate_media */ |
|
29757
f137c1386384
Add a NULL for PurplePluginProtocolInfo::get_moods to all the plugins I build
Paul Aurich <darkrain42@pidgin.im>
parents:
28981
diff
changeset
|
2125 | NULL, /* get_media_caps */ |
|
30138
cca9685df785
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents:
29757
diff
changeset
|
2126 | NULL, /* get_moods */ |
|
cca9685df785
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents:
29757
diff
changeset
|
2127 | NULL, /* set_public_alias */ |
|
34312
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34148
diff
changeset
|
2128 | NULL, /* get_public_alias */ |
|
4461d5c1e61c
Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34148
diff
changeset
|
2129 | NULL /* get_max_message_size */ |
| 8849 | 2130 | }; |
| 2131 | ||
| 15884 | 2132 | static PurplePluginInfo info = |
| 8849 | 2133 | { |
| 15884 | 2134 | PURPLE_PLUGIN_MAGIC, |
| 2135 | PURPLE_MAJOR_VERSION, | |
| 2136 | PURPLE_MINOR_VERSION, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2137 | PURPLE_PLUGIN_PROTOCOL, /**< type */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2138 | NULL, /**< ui_requirement */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2139 | 0, /**< flags */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2140 | NULL, /**< dependencies */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2141 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 8849 | 2142 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2143 | "prpl-silc", /**< id */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2144 | "SILC", /**< name */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2145 | "1.1", /**< version */ |
| 8849 | 2146 | /** summary */ |
| 2147 | N_("SILC Protocol Plugin"), | |
| 2148 | /** description */ | |
| 2149 | N_("Secure Internet Live Conferencing (SILC) Protocol"), | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2150 | "Pekka Riikonen", /**< author */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2151 | "http://silcnet.org/", /**< homepage */ |
| 8849 | 2152 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2153 | NULL, /**< load */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2154 | NULL, /**< unload */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2155 | NULL, /**< destroy */ |
| 8849 | 2156 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2157 | NULL, /**< ui_info */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2158 | &prpl_info, /**< extra_info */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2159 | NULL, /**< prefs_info */ |
|
16776
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2160 | silcpurple_actions, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2161 | |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2162 | /* padding */ |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2163 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2164 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2165 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
2166 | NULL |
| 8849 | 2167 | }; |
| 2168 | ||
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2169 | #if 0 |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2170 | static SilcBool silcpurple_debug_cb(char *file, char *function, int line, |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2171 | char *message, void *context) |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2172 | { |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2173 | purple_debug_info("SILC", "%s:%d:%s - %s\n", file ? file : "(null)", line, function ? function : "(null)", message ? message : "(null)"); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2174 | return TRUE; |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2175 | } |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2176 | #endif |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2177 | |
| 8849 | 2178 | static void |
| 15884 | 2179 | init_plugin(PurplePlugin *plugin) |
| 8849 | 2180 | { |
| 15884 | 2181 | PurpleAccountOption *option; |
| 2182 | PurpleAccountUserSplit *split; | |
| 8849 | 2183 | char tmp[256]; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2184 | int i; |
| 15884 | 2185 | PurpleKeyValuePair *kvp; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2186 | GList *list = NULL; |
| 8849 | 2187 | |
| 2188 | silc_plugin = plugin; | |
| 2189 | ||
| 15884 | 2190 | split = purple_account_user_split_new(_("Network"), "silcnet.org", '@'); |
|
10825
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
2191 | prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
|
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
2192 | |
| 8849 | 2193 | /* Account options */ |
| 15884 | 2194 | option = purple_account_option_string_new(_("Connect server"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2195 | "server", |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2196 | "silc.silcnet.org"); |
| 8849 | 2197 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 2198 | option = purple_account_option_int_new(_("Port"), "port", 706); |
| 8849 | 2199 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 2200 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); |
| 2201 | option = purple_account_option_string_new(_("Public Key file"), | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2202 | "public-key", tmp); |
|
10825
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
2203 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 2204 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); |
| 2205 | option = purple_account_option_string_new(_("Private Key file"), | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2206 | "private-key", tmp); |
|
10825
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
2207 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2208 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2209 | for (i = 0; silc_default_ciphers[i].name; i++) { |
| 15884 | 2210 | kvp = g_new0(PurpleKeyValuePair, 1); |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
2211 | kvp->key = g_strdup(silc_default_ciphers[i].name); |
|
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
2212 | kvp->value = g_strdup(silc_default_ciphers[i].name); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2213 | list = g_list_append(list, kvp); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2214 | } |
| 15884 | 2215 | option = purple_account_option_list_new(_("Cipher"), "cipher", list); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2216 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2217 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2218 | list = NULL; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2219 | for (i = 0; silc_default_hmacs[i].name; i++) { |
| 15884 | 2220 | kvp = g_new0(PurpleKeyValuePair, 1); |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
2221 | kvp->key = g_strdup(silc_default_hmacs[i].name); |
|
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
2222 | kvp->value = g_strdup(silc_default_hmacs[i].name); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2223 | list = g_list_append(list, kvp); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2224 | } |
| 15884 | 2225 | option = purple_account_option_list_new(_("HMAC"), "hmac", list); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2226 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
2227 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2228 | option = purple_account_option_bool_new(_("Use Perfect Forward Secrecy"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2229 | "pfs", FALSE); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2230 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2231 | |
| 15884 | 2232 | option = purple_account_option_bool_new(_("Public key authentication"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2233 | "pubkey-auth", FALSE); |
| 8849 | 2234 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 2235 | option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2236 | "block-ims", FALSE); |
| 8849 | 2237 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 2238 | option = purple_account_option_bool_new(_("Block messages to whiteboard"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2239 | "block-wb", FALSE); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
2240 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 2241 | option = purple_account_option_bool_new(_("Automatically open whiteboard"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2242 | "open-wb", FALSE); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
2243 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 2244 | option = purple_account_option_bool_new(_("Digitally sign and verify all messages"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2245 | "sign-verify", FALSE); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
2246 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 8849 | 2247 | |
| 15884 | 2248 | purple_prefs_remove("/plugins/prpl/silc"); |
| 9272 | 2249 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2250 | silc_log_set_callback(SILC_LOG_ERROR, silcpurple_log_error, NULL); |
| 15884 | 2251 | silcpurple_register_commands(); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
2252 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2253 | #if 0 |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2254 | silc_log_debug(TRUE); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2255 | silc_log_set_debug_string("*client*"); |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2256 | silc_log_quick(TRUE); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22853
diff
changeset
|
2257 | silc_log_set_debug_callbacks(silcpurple_debug_cb, NULL, NULL, NULL); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2258 | #endif |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
2259 | |
| 8849 | 2260 | } |
| 2261 | ||
| 15884 | 2262 | PURPLE_INIT_PLUGIN(silc, init_plugin, info); |