Sun, 14 Oct 2007 21:08:42 +0000
Rename:
* PurpleDisconnectReason to PurpleConnectionError;
* elements of that enum from PURPLE_REASON_* to PURPLE_CONNECTION_ERROR_*;
* purple_connection_reason_is_fatal to purple_connection_error_is_fatal.
| 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 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
20 | #include "silc.h" |
| 8849 | 21 | #include "silcclient.h" |
| 15884 | 22 | #include "silcpurple.h" |
| 9943 | 23 | #include "version.h" |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
24 | #include "wb.h" |
| 8849 | 25 | |
| 26 | extern SilcClientOperations ops; | |
| 15884 | 27 | static PurplePlugin *silc_plugin = NULL; |
| 8849 | 28 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
29 | /* 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
|
30 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
31 | 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
|
32 | 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
|
33 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
34 | 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
|
35 | 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
|
36 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
37 | |
| 8849 | 38 | static const char * |
| 15884 | 39 | silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b) |
| 8849 | 40 | { |
| 41 | return (const char *)"silc"; | |
| 42 | } | |
| 43 | ||
| 44 | static GList * | |
| 15884 | 45 | silcpurple_away_states(PurpleAccount *account) |
| 8849 | 46 | { |
| 15884 | 47 | PurpleStatusType *type; |
| 9968 | 48 | GList *types = NULL; |
| 8849 | 49 | |
| 15884 | 50 | type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, FALSE, TRUE, FALSE); |
| 9968 | 51 | types = g_list_append(types, type); |
| 15884 | 52 | type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), FALSE, TRUE, FALSE); |
| 9968 | 53 | types = g_list_append(types, type); |
| 15884 | 54 | type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, FALSE, TRUE, FALSE); |
| 9968 | 55 | types = g_list_append(types, type); |
| 15884 | 56 | type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), FALSE, TRUE, FALSE); |
| 9968 | 57 | types = g_list_append(types, type); |
| 15884 | 58 | type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), FALSE, TRUE, FALSE); |
| 9968 | 59 | types = g_list_append(types, type); |
| 15884 | 60 | type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), FALSE, TRUE, FALSE); |
| 9968 | 61 | types = g_list_append(types, type); |
| 15884 | 62 | type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, FALSE, TRUE, FALSE); |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
63 | types = g_list_append(types, type); |
| 8849 | 64 | |
| 9968 | 65 | return types; |
| 8849 | 66 | } |
| 67 | ||
| 68 | static void | |
| 15884 | 69 | silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) |
| 8849 | 70 | { |
| 15884 | 71 | PurpleConnection *gc = purple_account_get_connection(account); |
| 72 | SilcPurple sg = NULL; | |
| 8849 | 73 | SilcUInt32 mode; |
| 74 | SilcBuffer idp; | |
| 75 | unsigned char mb[4]; | |
| 9968 | 76 | const char *state; |
| 8849 | 77 | |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
78 | if (gc != NULL) |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
79 | sg = gc->proto_data; |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
80 | |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
81 | if (status == NULL) |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
82 | return; |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
83 | |
| 15884 | 84 | state = purple_status_get_id(status); |
|
10225
0dfea1bc8695
[gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10050
diff
changeset
|
85 | |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
86 | if (state == NULL) |
|
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
87 | return; |
|
10225
0dfea1bc8695
[gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10050
diff
changeset
|
88 | |
|
10801
b5f44181183f
[gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
89 | if ((sg == NULL) || (sg->conn == NULL)) |
| 8849 | 90 | return; |
| 91 | ||
| 92 | mode = sg->conn->local_entry->mode; | |
| 93 | mode &= ~(SILC_UMODE_GONE | | |
| 94 | SILC_UMODE_HYPER | | |
| 95 | SILC_UMODE_BUSY | | |
| 96 | SILC_UMODE_INDISPOSED | | |
| 97 | SILC_UMODE_PAGE); | |
| 98 | ||
| 9968 | 99 | if (!strcmp(state, "hyper")) |
| 8849 | 100 | mode |= SILC_UMODE_HYPER; |
| 9968 | 101 | else if (!strcmp(state, "away")) |
| 8849 | 102 | mode |= SILC_UMODE_GONE; |
| 9968 | 103 | else if (!strcmp(state, "busy")) |
| 8849 | 104 | mode |= SILC_UMODE_BUSY; |
| 9968 | 105 | else if (!strcmp(state, "indisposed")) |
| 8849 | 106 | mode |= SILC_UMODE_INDISPOSED; |
| 9968 | 107 | else if (!strcmp(state, "page")) |
| 8849 | 108 | mode |= SILC_UMODE_PAGE; |
| 109 | ||
| 110 | /* Send UMODE */ | |
| 111 | idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); | |
| 112 | SILC_PUT32_MSB(mode, mb); | |
| 113 | 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
|
114 | 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
|
115 | 1, idp->data, silc_buffer_len(idp), |
| 8849 | 116 | 2, mb, sizeof(mb)); |
| 117 | silc_buffer_free(idp); | |
| 118 | } | |
| 119 | ||
| 120 | ||
| 121 | /*************************** Connection Routines *****************************/ | |
| 122 | ||
| 123 | static void | |
| 15884 | 124 | silcpurple_keepalive(PurpleConnection *gc) |
| 8849 | 125 | { |
| 15884 | 126 | SilcPurple sg = gc->proto_data; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
127 | 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
|
128 | NULL, 0); |
| 8849 | 129 | } |
| 130 | ||
|
17566
687225d827a2
300 milliseconds apparently works on win32 for the SILC scheduler, let's
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17564
diff
changeset
|
131 | static gboolean |
| 15884 | 132 | silcpurple_scheduler(gpointer *context) |
| 8849 | 133 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
134 | 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
|
135 | 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
|
136 | return TRUE; |
| 8849 | 137 | } |
| 138 | ||
| 139 | 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
|
140 | 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
|
141 | 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
|
142 | const char *message, void *context) |
| 8849 | 143 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
144 | 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
|
145 | SilcPurple sg; |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
146 | SilcUInt32 mask; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
147 | char tz[16]; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
148 | PurpleStoredImage *img; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
149 | #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
|
150 | struct utsname u; |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
151 | #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
|
152 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
153 | sg = gc->proto_data; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
154 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
155 | 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
|
156 | 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
|
157 | 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
|
158 | 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
|
159 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
160 | /* 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
|
161 | 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
|
162 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
163 | /* 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
|
164 | 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
|
165 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
166 | 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
|
167 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
168 | /* 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
|
169 | 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
|
170 | 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
|
171 | "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
|
172 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
173 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
174 | /* 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
|
175 | 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
|
176 | 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
|
177 | 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
|
178 | 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
|
179 | sizeof(SilcUInt32)); |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
180 | 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
|
181 | 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
|
182 | 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
|
183 | 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
|
184 | 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
|
185 | #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
|
186 | 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
|
187 | 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
|
188 | 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
|
189 | 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
|
190 | 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
|
191 | 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
|
192 | 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
|
193 | 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
|
194 | (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
|
195 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
196 | #endif |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
197 | 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
|
198 | 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
|
199 | SILC_ATTRIBUTE_TIMEZONE, |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
200 | (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
|
201 | |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
202 | /* 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
|
203 | 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
|
204 | 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
|
205 | 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
|
206 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
207 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
208 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
209 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
210 | 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
|
211 | /* Disconnected */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
212 | 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
|
213 | 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
|
214 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
215 | /* 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
|
216 | if (!sg->detaching) |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
217 | purple_connection_error_reason(gc, |
| 21279 | 218 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
219 | _("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
|
220 | else |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
221 | /* 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
|
222 | 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
|
223 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
224 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
225 | case SILC_CLIENT_CONN_ERROR: |
| 21279 | 226 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
227 | _("Error during 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
|
228 | 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
|
229 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
230 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
231 | case SILC_CLIENT_CONN_ERROR_KE: |
| 21279 | 232 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
233 | _("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
|
234 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
235 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
236 | case SILC_CLIENT_CONN_ERROR_AUTH: |
| 21279 | 237 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
238 | _("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
|
239 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
240 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
241 | case SILC_CLIENT_CONN_ERROR_RESUME: |
| 21279 | 242 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
243 | _("Resuming detached session failed. " |
|
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
244 | "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
|
245 | 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
|
246 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
247 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
248 | case SILC_CLIENT_CONN_ERROR_TIMEOUT: |
| 21279 | 249 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
250 | _("Connection Timeout")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
251 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
252 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
253 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
254 | /* Error */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
255 | sg->conn = NULL; |
| 8849 | 256 | } |
| 257 | ||
| 258 | 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
|
259 | 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
|
260 | void *context) |
| 8849 | 261 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
262 | PurpleConnection *gc = context; |
| 15884 | 263 | SilcPurple sg; |
|
9732
644615310076
[gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9597
diff
changeset
|
264 | SilcClient client; |
| 8849 | 265 | SilcClientConnectionParams params; |
| 266 | const char *dfile; | |
| 267 | ||
|
14179
b54c870fb9d0
[gaim-migrate @ 16751]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
268 | sg = gc->proto_data; |
|
13410
590ccd4c9bb1
[gaim-migrate @ 15784]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
269 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
270 | if (status != SILC_SOCKET_OK) { |
| 21279 | 271 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
272 | _("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
|
273 | 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
|
274 | 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
|
275 | 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
|
276 | gc->proto_data = NULL; |
| 8849 | 277 | return; |
| 278 | } | |
|
9732
644615310076
[gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9597
diff
changeset
|
279 | |
|
644615310076
[gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9597
diff
changeset
|
280 | client = sg->client; |
| 8849 | 281 | |
| 282 | /* Progress */ | |
| 283 | if (params.detach_data) { | |
| 15884 | 284 | purple_connection_update_progress(gc, _("Resuming session"), 2, 5); |
| 8849 | 285 | sg->resuming = TRUE; |
| 286 | } else { | |
| 15884 | 287 | purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); |
| 8849 | 288 | } |
| 289 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
290 | /* 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
|
291 | 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
|
292 | 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
|
293 | 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
|
294 | 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
|
295 | 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
|
296 | 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
|
297 | params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE); |
| 8849 | 298 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
299 | /* Perform SILC Key Exchange. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
300 | silc_client_key_exchange(sg->client, ¶ms, 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
|
301 | 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
|
302 | silcpurple_connect_cb, gc); |
| 8849 | 303 | |
| 304 | silc_free(params.detach_data); | |
| 305 | } | |
| 306 | ||
| 307 | 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
|
308 | 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
|
309 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
310 | 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
|
311 | 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
|
312 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
313 | 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
|
314 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
315 | sg = gc->proto_data; |
|
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 | if (source < 0) { |
| 21279 | 318 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
319 | _("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
|
320 | 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
|
321 | 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
|
322 | 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
|
323 | gc->proto_data = NULL; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
324 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
325 | } |
|
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 | /* 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
|
328 | 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
|
329 | 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
|
330 | 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
|
331 | } |
|
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 | 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
|
334 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
335 | PurpleAccount *account = context; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
336 | PurpleConnection *gc = 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
|
337 | 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
|
338 | 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
|
339 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
340 | sg = silc_calloc(1, sizeof(*sg)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
341 | if (!sg) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
342 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
343 | memset(sg, 0, sizeof(*sg)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
344 | sg->client = client; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
345 | sg->gc = gc; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
346 | sg->account = account; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
347 | sg->scheduler = SILC_PTR_TO_32(gc->proto_data); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
348 | gc->proto_data = sg; |
|
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 | /* Progress */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
351 | 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
|
352 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
353 | /* 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
|
354 | 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
|
355 | 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
|
356 | 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
|
357 | (char *)purple_account_get_string(account, "private-key", prd), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
358 | (gc->password == NULL) ? "" : gc->password, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
359 | &sg->public_key, &sg->private_key)) { |
| 21279 | 360 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
361 | _("Could not load 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
|
362 | gc->proto_data = NULL; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
363 | 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
|
364 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
365 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
366 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
367 | /* Connect to the SILC server */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
368 | if (purple_proxy_connect(gc, account, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
369 | purple_account_get_string(account, "server", |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
370 | "silc.silcnet.org"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
371 | purple_account_get_int(account, "port", 706), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
372 | silcpurple_login_connected, 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
|
373 | { |
| 21279 | 374 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
375 | _("Unable to create 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
|
376 | gc->proto_data = NULL; |
|
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_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
|
378 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
379 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
380 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
381 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
382 | static void |
| 15884 | 383 | silcpurple_login(PurpleAccount *account) |
| 8849 | 384 | { |
| 385 | SilcClient client; | |
| 15884 | 386 | PurpleConnection *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
|
387 | SilcClientParams params; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
388 | 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
|
389 | char *username, *hostname, *realname, **up; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
390 | guint scheduler; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
391 | int i; |
| 8849 | 392 | |
| 393 | gc = account->gc; | |
| 394 | if (!gc) | |
| 395 | return; | |
| 396 | gc->proto_data = NULL; | |
| 397 | ||
| 398 | 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
|
399 | strcat(params.nickname_format, "%n#a"); |
| 8849 | 400 | |
| 401 | /* Allocate SILC client */ | |
| 402 | client = silc_client_alloc(&ops, ¶ms, gc, NULL); | |
| 403 | if (!client) { | |
| 21279 | 404 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
405 | _("Out of memory")); |
| 8849 | 406 | return; |
| 407 | } | |
| 408 | ||
| 409 | /* 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
|
410 | 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
|
411 | 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
|
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 | 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
|
414 | up = g_strsplit(username, "@", 2); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
415 | username = strdup(up[0]); |
|
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_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
|
417 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
418 | 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
|
419 | 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
|
420 | 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
|
421 | 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
|
422 | "John T. Noname"); |
| 8849 | 423 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
424 | 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
|
425 | hostname = silc_net_localhost(); |
| 8849 | 426 | |
|
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 | purple_connection_set_display_name(gc, username); |
| 8849 | 428 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
429 | /* 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
|
430 | 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
|
431 | SILC_DEFAULT_CIPHER); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
432 | for (i = 0; silc_default_ciphers[i].name; i++) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
433 | if (!strcmp(silc_default_ciphers[i].name, cipher)) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
434 | silc_cipher_register(&(silc_default_ciphers[i])); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
435 | break; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
436 | } |
| 15884 | 437 | hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
438 | for (i = 0; silc_default_hmacs[i].name; i++) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
439 | if (!strcmp(silc_default_hmacs[i].name, hmac)) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
440 | silc_hmac_register(&(silc_default_hmacs[i])); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
441 | break; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
442 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
443 | |
| 8849 | 444 | /* 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
|
445 | if (!silc_client_init(client, username, hostname, realname, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
446 | silcpurple_running, account)) { |
| 21279 | 447 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
448 | _("Cannot initialize SILC protocol")); |
| 8849 | 449 | return; |
| 450 | } | |
| 451 | ||
| 452 | /* Check the ~/.silc dir and create it, and new key pair if necessary. */ | |
| 15884 | 453 | if (!silcpurple_check_silc_dir(gc)) { |
| 21279 | 454 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
20458
446bd3a80bdc
Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents:
19684
diff
changeset
|
455 | _("Error loading SILC key pair")); |
| 8849 | 456 | return; |
| 457 | } | |
| 458 | ||
| 459 | /* Schedule SILC using Glib's event loop */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
460 | scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, client); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
461 | gc->proto_data = SILC_32_TO_PTR(scheduler); |
| 8849 | 462 | } |
| 463 | ||
| 464 | static int | |
| 15884 | 465 | silcpurple_close_final(gpointer *context) |
| 8849 | 466 | { |
| 15884 | 467 | SilcPurple sg = (SilcPurple)context; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
468 | silc_client_stop(sg->client, NULL, NULL); |
| 8849 | 469 | silc_client_free(sg->client); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
470 | if (sg->mimeass) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
471 | silc_mime_assembler_free(sg->mimeass); |
| 8849 | 472 | silc_free(sg); |
| 473 | return 0; | |
| 474 | } | |
| 475 | ||
| 476 | static void | |
| 15884 | 477 | silcpurple_close(PurpleConnection *gc) |
| 8849 | 478 | { |
| 15884 | 479 | SilcPurple sg = gc->proto_data; |
| 8849 | 480 | |
|
10547
61f5540fc15a
[gaim-migrate @ 11917]
Mark Doliner <markdoliner@pidgin.im>
parents:
10516
diff
changeset
|
481 | g_return_if_fail(sg != NULL); |
| 8849 | 482 | |
| 483 | /* Send QUIT */ | |
| 484 | silc_client_command_call(sg->client, sg->conn, 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
|
485 | "QUIT", "Download Pidgin: " PURPLE_WEBSITE, NULL); |
| 8849 | 486 | |
| 487 | if (sg->conn) | |
| 488 | silc_client_close_connection(sg->client, sg->conn); | |
| 489 | ||
|
17570
4cca2fc0ec83
libpurple should not use glib eventloop stuff directly, since we have our
Richard Laager <rlaager@pidgin.im>
parents:
17566
diff
changeset
|
490 | purple_timeout_remove(sg->scheduler); |
|
4cca2fc0ec83
libpurple should not use glib eventloop stuff directly, since we have our
Richard Laager <rlaager@pidgin.im>
parents:
17566
diff
changeset
|
491 | purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg); |
| 8849 | 492 | } |
| 493 | ||
| 494 | ||
| 495 | /****************************** Protocol Actions *****************************/ | |
| 496 | ||
| 497 | static void | |
| 15884 | 498 | silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) |
| 8849 | 499 | { |
| 500 | /* Nothing */ | |
| 501 | } | |
| 502 | ||
| 503 | static void | |
| 15884 | 504 | silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
| 8849 | 505 | { |
| 15884 | 506 | SilcPurple sg = gc->proto_data; |
| 8849 | 507 | SilcClient client = sg->client; |
| 508 | SilcClientConnection conn = sg->conn; | |
| 15884 | 509 | PurpleRequestField *f; |
| 8849 | 510 | char *tmp; |
| 511 | SilcUInt32 tmp_len, mask; | |
| 512 | SilcAttributeObjService service; | |
| 513 | SilcAttributeObjDevice dev; | |
| 514 | SilcVCardStruct vcard; | |
| 515 | const char *val; | |
| 516 | ||
| 517 | sg = gc->proto_data; | |
| 518 | if (!sg) | |
| 519 | return; | |
| 520 | ||
| 521 | memset(&service, 0, sizeof(service)); | |
| 522 | memset(&dev, 0, sizeof(dev)); | |
| 523 | memset(&vcard, 0, sizeof(vcard)); | |
| 524 | ||
| 525 | silc_client_attribute_del(client, conn, | |
| 526 | SILC_ATTRIBUTE_USER_INFO, NULL); | |
| 527 | silc_client_attribute_del(client, conn, | |
| 528 | SILC_ATTRIBUTE_SERVICE, NULL); | |
| 529 | silc_client_attribute_del(client, conn, | |
| 530 | SILC_ATTRIBUTE_STATUS_MOOD, NULL); | |
| 531 | silc_client_attribute_del(client, conn, | |
| 532 | SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); | |
| 533 | silc_client_attribute_del(client, conn, | |
| 534 | SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); | |
| 535 | silc_client_attribute_del(client, conn, | |
| 536 | SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); | |
| 537 | silc_client_attribute_del(client, conn, | |
| 538 | SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); | |
| 539 | silc_client_attribute_del(client, conn, | |
| 540 | SILC_ATTRIBUTE_TIMEZONE, NULL); | |
| 541 | silc_client_attribute_del(client, conn, | |
| 542 | SILC_ATTRIBUTE_GEOLOCATION, NULL); | |
| 543 | silc_client_attribute_del(client, conn, | |
| 544 | SILC_ATTRIBUTE_DEVICE_INFO, NULL); | |
| 545 | ||
| 546 | /* Set mood */ | |
| 547 | mask = 0; | |
| 15884 | 548 | f = purple_request_fields_get_field(fields, "mood_normal"); |
| 549 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 550 | mask |= SILC_ATTRIBUTE_MOOD_NORMAL; |
| 15884 | 551 | f = purple_request_fields_get_field(fields, "mood_happy"); |
| 552 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 553 | mask |= SILC_ATTRIBUTE_MOOD_HAPPY; |
| 15884 | 554 | f = purple_request_fields_get_field(fields, "mood_sad"); |
| 555 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 556 | mask |= SILC_ATTRIBUTE_MOOD_SAD; |
| 15884 | 557 | f = purple_request_fields_get_field(fields, "mood_angry"); |
| 558 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 559 | mask |= SILC_ATTRIBUTE_MOOD_ANGRY; |
| 15884 | 560 | f = purple_request_fields_get_field(fields, "mood_jealous"); |
| 561 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 562 | mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; |
| 15884 | 563 | f = purple_request_fields_get_field(fields, "mood_ashamed"); |
| 564 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 565 | mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; |
| 15884 | 566 | f = purple_request_fields_get_field(fields, "mood_invincible"); |
| 567 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 568 | mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; |
| 15884 | 569 | f = purple_request_fields_get_field(fields, "mood_inlove"); |
| 570 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 571 | mask |= SILC_ATTRIBUTE_MOOD_INLOVE; |
| 15884 | 572 | f = purple_request_fields_get_field(fields, "mood_sleepy"); |
| 573 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 574 | mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; |
| 15884 | 575 | f = purple_request_fields_get_field(fields, "mood_bored"); |
| 576 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 577 | mask |= SILC_ATTRIBUTE_MOOD_BORED; |
| 15884 | 578 | f = purple_request_fields_get_field(fields, "mood_excited"); |
| 579 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 580 | mask |= SILC_ATTRIBUTE_MOOD_EXCITED; |
| 15884 | 581 | f = purple_request_fields_get_field(fields, "mood_anxious"); |
| 582 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 583 | mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; |
| 584 | silc_client_attribute_add(client, conn, | |
| 585 | SILC_ATTRIBUTE_STATUS_MOOD, | |
| 586 | SILC_32_TO_PTR(mask), | |
| 587 | sizeof(SilcUInt32)); | |
| 588 | ||
| 589 | /* Set preferred contact */ | |
| 590 | mask = 0; | |
| 15884 | 591 | f = purple_request_fields_get_field(fields, "contact_chat"); |
| 592 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 593 | mask |= SILC_ATTRIBUTE_CONTACT_CHAT; |
| 15884 | 594 | f = purple_request_fields_get_field(fields, "contact_email"); |
| 595 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 596 | mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; |
| 15884 | 597 | f = purple_request_fields_get_field(fields, "contact_call"); |
| 598 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 599 | mask |= SILC_ATTRIBUTE_CONTACT_CALL; |
| 15884 | 600 | f = purple_request_fields_get_field(fields, "contact_sms"); |
| 601 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 602 | mask |= SILC_ATTRIBUTE_CONTACT_SMS; |
| 15884 | 603 | f = purple_request_fields_get_field(fields, "contact_mms"); |
| 604 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 605 | mask |= SILC_ATTRIBUTE_CONTACT_MMS; |
| 15884 | 606 | f = purple_request_fields_get_field(fields, "contact_video"); |
| 607 | if (f && purple_request_field_bool_get_value(f)) | |
| 8849 | 608 | mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; |
| 609 | if (mask) | |
| 610 | silc_client_attribute_add(client, conn, | |
| 611 | SILC_ATTRIBUTE_PREFERRED_CONTACT, | |
| 612 | SILC_32_TO_PTR(mask), | |
| 613 | sizeof(SilcUInt32)); | |
| 614 | ||
| 615 | /* Set status text */ | |
| 616 | val = NULL; | |
| 15884 | 617 | f = purple_request_fields_get_field(fields, "status_text"); |
| 8849 | 618 | if (f) |
| 15884 | 619 | val = purple_request_field_string_get_value(f); |
| 8849 | 620 | if (val && *val) |
| 621 | silc_client_attribute_add(client, conn, | |
| 622 | SILC_ATTRIBUTE_STATUS_FREETEXT, | |
| 623 | (void *)val, strlen(val)); | |
| 624 | ||
| 625 | /* Set vcard */ | |
| 626 | val = NULL; | |
| 15884 | 627 | f = purple_request_fields_get_field(fields, "vcard"); |
| 8849 | 628 | if (f) |
| 15884 | 629 | val = purple_request_field_string_get_value(f); |
| 8849 | 630 | if (val && *val) { |
| 15884 | 631 | purple_account_set_string(sg->account, "vcard", val); |
| 8849 | 632 | tmp = silc_file_readfile(val, &tmp_len); |
| 633 | if (tmp) { | |
| 634 | tmp[tmp_len] = 0; | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11257
diff
changeset
|
635 | if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) |
| 8849 | 636 | silc_client_attribute_add(client, conn, |
| 637 | SILC_ATTRIBUTE_USER_INFO, | |
| 638 | (void *)&vcard, | |
| 639 | sizeof(vcard)); | |
| 640 | } | |
| 641 | silc_vcard_free(&vcard); | |
| 642 | silc_free(tmp); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
643 | } else { |
| 15884 | 644 | purple_account_set_string(sg->account, "vcard", ""); |
| 8849 | 645 | } |
| 646 | ||
| 647 | #ifdef HAVE_SYS_UTSNAME_H | |
| 648 | /* Set device info */ | |
| 15884 | 649 | f = purple_request_fields_get_field(fields, "device"); |
| 650 | if (f && purple_request_field_bool_get_value(f)) { | |
| 8849 | 651 | struct utsname u; |
| 652 | if (!uname(&u)) { | |
| 653 | dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; | |
| 654 | dev.version = u.release; | |
| 655 | dev.model = u.sysname; | |
| 656 | silc_client_attribute_add(client, conn, | |
| 657 | SILC_ATTRIBUTE_DEVICE_INFO, | |
| 658 | (void *)&dev, sizeof(dev)); | |
| 659 | } | |
| 660 | } | |
| 661 | #endif | |
| 662 | ||
| 663 | /* Set timezone */ | |
| 664 | val = NULL; | |
| 15884 | 665 | f = purple_request_fields_get_field(fields, "timezone"); |
| 8849 | 666 | if (f) |
| 15884 | 667 | val = purple_request_field_string_get_value(f); |
| 8849 | 668 | if (val && *val) |
| 669 | silc_client_attribute_add(client, conn, | |
| 670 | SILC_ATTRIBUTE_TIMEZONE, | |
| 671 | (void *)val, strlen(val)); | |
| 672 | } | |
| 673 | ||
| 674 | static void | |
| 15884 | 675 | silcpurple_attrs(PurplePluginAction *action) |
| 8849 | 676 | { |
| 15884 | 677 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 678 | SilcPurple sg = gc->proto_data; | |
| 8849 | 679 | SilcClient client = sg->client; |
| 680 | SilcClientConnection conn = sg->conn; | |
| 15884 | 681 | PurpleRequestFields *fields; |
| 682 | PurpleRequestFieldGroup *g; | |
| 683 | PurpleRequestField *f; | |
| 8849 | 684 | SilcHashTable attrs; |
| 685 | SilcAttributePayload attr; | |
| 686 | gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, | |
| 687 | mangry = FALSE, mjealous = FALSE, mashamed = FALSE, | |
| 688 | minvincible = FALSE, minlove = FALSE, msleepy = FALSE, | |
| 689 | mbored = FALSE, mexcited = FALSE, manxious = FALSE; | |
| 690 | gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, | |
| 691 | cmms = FALSE, cchat = TRUE, cvideo = FALSE; | |
| 692 | gboolean device = TRUE; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
693 | char status[1024], tz[16]; |
| 8849 | 694 | |
| 695 | sg = gc->proto_data; | |
| 696 | if (!sg) | |
| 697 | return; | |
| 698 | ||
| 699 | memset(status, 0, sizeof(status)); | |
| 700 | ||
| 701 | attrs = silc_client_attributes_get(client, conn); | |
| 702 | if (attrs) { | |
| 703 | if (silc_hash_table_find(attrs, | |
| 704 | SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), | |
| 705 | NULL, (void *)&attr)) { | |
| 706 | SilcUInt32 mood = 0; | |
| 707 | silc_attribute_get_object(attr, &mood, sizeof(mood)); | |
| 708 | mnormal = !mood; | |
| 709 | mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); | |
| 710 | msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); | |
| 711 | mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); | |
| 712 | mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); | |
| 713 | mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); | |
| 714 | minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); | |
| 715 | minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); | |
| 716 | msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); | |
| 717 | mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); | |
| 718 | mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); | |
| 719 | manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); | |
| 720 | } | |
| 721 | ||
| 722 | if (silc_hash_table_find(attrs, | |
| 723 | SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), | |
| 724 | NULL, (void *)&attr)) { | |
| 725 | SilcUInt32 contact = 0; | |
| 726 | silc_attribute_get_object(attr, &contact, sizeof(contact)); | |
| 727 | cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); | |
| 728 | ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); | |
| 729 | csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); | |
| 730 | cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); | |
| 731 | cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); | |
| 732 | cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); | |
| 733 | } | |
| 734 | ||
| 735 | if (silc_hash_table_find(attrs, | |
| 736 | SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), | |
| 737 | NULL, (void *)&attr)) | |
| 738 | silc_attribute_get_object(attr, &status, sizeof(status)); | |
| 739 | ||
| 740 | if (!silc_hash_table_find(attrs, | |
| 741 | SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), | |
| 742 | NULL, (void *)&attr)) | |
| 743 | device = FALSE; | |
| 744 | } | |
| 745 | ||
| 15884 | 746 | fields = purple_request_fields_new(); |
| 8849 | 747 | |
| 15884 | 748 | g = purple_request_field_group_new(NULL); |
| 749 | f = purple_request_field_label_new("l3", _("Your Current Mood")); | |
| 750 | purple_request_field_group_add_field(g, f); | |
| 751 | f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal); | |
| 752 | purple_request_field_group_add_field(g, f); | |
| 753 | f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy); | |
| 754 | purple_request_field_group_add_field(g, f); | |
| 755 | f = purple_request_field_bool_new("mood_sad", _("Sad"), msad); | |
| 756 | purple_request_field_group_add_field(g, f); | |
| 757 | f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry); | |
| 758 | purple_request_field_group_add_field(g, f); | |
| 759 | f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); | |
| 760 | purple_request_field_group_add_field(g, f); | |
| 761 | f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); | |
| 762 | purple_request_field_group_add_field(g, f); | |
| 763 | f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); | |
| 764 | purple_request_field_group_add_field(g, f); | |
| 765 | f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove); | |
| 766 | purple_request_field_group_add_field(g, f); | |
| 767 | f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); | |
| 768 | purple_request_field_group_add_field(g, f); | |
| 769 | f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored); | |
| 770 | purple_request_field_group_add_field(g, f); | |
| 771 | f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited); | |
| 772 | purple_request_field_group_add_field(g, f); | |
| 773 | f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious); | |
| 774 | purple_request_field_group_add_field(g, f); | |
| 8849 | 775 | |
| 15884 | 776 | f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); |
| 777 | purple_request_field_group_add_field(g, f); | |
| 778 | f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat); | |
| 779 | purple_request_field_group_add_field(g, f); | |
| 780 | f = purple_request_field_bool_new("contact_email", _("E-mail"), cemail); | |
| 781 | purple_request_field_group_add_field(g, f); | |
| 782 | f = purple_request_field_bool_new("contact_call", _("Phone"), ccall); | |
| 783 | purple_request_field_group_add_field(g, f); | |
| 784 | f = purple_request_field_bool_new("contact_sms", _("SMS"), csms); | |
| 785 | purple_request_field_group_add_field(g, f); | |
| 786 | f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms); | |
| 787 | purple_request_field_group_add_field(g, f); | |
| 788 | f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo); | |
| 789 | purple_request_field_group_add_field(g, f); | |
| 790 | purple_request_fields_add_group(fields, g); | |
| 8849 | 791 | |
| 15884 | 792 | g = purple_request_field_group_new(NULL); |
| 793 | f = purple_request_field_string_new("status_text", _("Your Current Status"), | |
| 8849 | 794 | status[0] ? status : NULL, TRUE); |
| 15884 | 795 | purple_request_field_group_add_field(g, f); |
| 796 | purple_request_fields_add_group(fields, g); | |
| 8849 | 797 | |
| 15884 | 798 | g = purple_request_field_group_new(NULL); |
| 8849 | 799 | #if 0 |
| 15884 | 800 | f = purple_request_field_label_new("l2", _("Online Services")); |
| 801 | purple_request_field_group_add_field(g, f); | |
| 802 | f = purple_request_field_bool_new("services", | |
| 8849 | 803 | _("Let others see what services you are using"), |
| 804 | TRUE); | |
| 15884 | 805 | purple_request_field_group_add_field(g, f); |
| 8849 | 806 | #endif |
| 807 | #ifdef HAVE_SYS_UTSNAME_H | |
| 15884 | 808 | f = purple_request_field_bool_new("device", |
| 8849 | 809 | _("Let others see what computer you are using"), |
| 810 | device); | |
| 15884 | 811 | purple_request_field_group_add_field(g, f); |
| 8849 | 812 | #endif |
| 15884 | 813 | purple_request_fields_add_group(fields, g); |
| 8849 | 814 | |
| 15884 | 815 | g = purple_request_field_group_new(NULL); |
| 816 | f = purple_request_field_string_new("vcard", _("Your VCard File"), | |
| 817 | purple_account_get_string(sg->account, "vcard", ""), | |
| 8849 | 818 | FALSE); |
| 15884 | 819 | 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
|
820 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
821 | 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
|
822 | f = purple_request_field_string_new("timezone", _("Timezone (UTC)"), tz, FALSE); |
| 15884 | 823 | purple_request_field_group_add_field(g, f); |
| 824 | purple_request_fields_add_group(fields, g); | |
| 8849 | 825 | |
| 15884 | 826 | purple_request_fields(gc, _("User Online Status Attributes"), |
| 8849 | 827 | _("User Online Status Attributes"), |
| 828 | _("You can let other users see your online status information " | |
| 829 | "and your personal information. Please fill the information " | |
| 830 | "you would like other users to see about yourself."), | |
| 831 | fields, | |
| 15884 | 832 | _("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
|
833 | _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), |
|
4f0dc2d16e55
Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
834 | gc->account, NULL, NULL, gc); |
| 8849 | 835 | } |
| 836 | ||
| 837 | static void | |
| 15884 | 838 | silcpurple_detach(PurplePluginAction *action) |
| 8849 | 839 | { |
| 15884 | 840 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 841 | SilcPurple sg; | |
| 8849 | 842 | |
| 843 | if (!gc) | |
| 844 | return; | |
| 845 | sg = gc->proto_data; | |
| 846 | if (!sg) | |
| 847 | return; | |
| 848 | ||
| 849 | /* Call DETACH */ | |
| 850 | silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
| 851 | sg->detaching = TRUE; | |
| 852 | } | |
| 853 | ||
| 854 | static void | |
| 15884 | 855 | silcpurple_view_motd(PurplePluginAction *action) |
| 8849 | 856 | { |
| 15884 | 857 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 858 | SilcPurple sg; | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
859 | char *tmp; |
| 8849 | 860 | |
| 861 | if (!gc) | |
| 862 | return; | |
| 863 | sg = gc->proto_data; | |
| 864 | if (!sg) | |
| 865 | return; | |
| 866 | ||
| 867 | if (!sg->motd) { | |
| 15884 | 868 | purple_notify_error( |
| 8849 | 869 | gc, _("Message of the Day"), _("No Message of the Day available"), |
| 870 | _("There is no Message of the Day associated with this connection")); | |
| 871 | return; | |
| 872 | } | |
| 873 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
874 | tmp = g_markup_escape_text(sg->motd, -1); |
| 15884 | 875 | purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
876 | tmp, NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
877 | g_free(tmp); |
| 8849 | 878 | } |
| 879 | ||
| 9272 | 880 | static void |
| 15884 | 881 | silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields) |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
882 | { |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
883 | /* Nothing */ |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
884 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
885 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
886 | static void |
| 15884 | 887 | silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
888 | { |
| 15884 | 889 | SilcPurple sg = gc->proto_data; |
| 890 | PurpleRequestField *f; | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
891 | const char *val, *pkfile = NULL, *prfile = NULL; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
892 | const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
893 | const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
894 | char *identifier; |
| 15884 | 895 | int keylen = SILCPURPLE_DEF_PKCS_LEN; |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
896 | SilcPublicKey public_key; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
897 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
898 | sg = gc->proto_data; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
899 | if (!sg) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
900 | return; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
901 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
902 | val = NULL; |
| 15884 | 903 | f = purple_request_fields_get_field(fields, "pass1"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
904 | if (f) |
| 15884 | 905 | val = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
906 | if (val && *val) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
907 | pass1 = val; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
908 | else |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
909 | pass1 = ""; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
910 | val = NULL; |
| 15884 | 911 | f = purple_request_fields_get_field(fields, "pass2"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
912 | if (f) |
| 15884 | 913 | val = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
914 | if (val && *val) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
915 | pass2 = val; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
916 | else |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
917 | pass2 = ""; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
918 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
919 | if (strcmp(pass1, pass2)) { |
| 15884 | 920 | purple_notify_error( |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
921 | gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
922 | return; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
923 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
924 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
925 | val = NULL; |
| 15884 | 926 | f = purple_request_fields_get_field(fields, "key"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
927 | if (f) |
| 15884 | 928 | val = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
929 | if (val && *val) |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
930 | keylen = atoi(val); |
| 15884 | 931 | f = purple_request_fields_get_field(fields, "pkfile"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
932 | if (f) |
| 15884 | 933 | pkfile = purple_request_field_string_get_value(f); |
| 934 | f = purple_request_fields_get_field(fields, "prfile"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
935 | if (f) |
| 15884 | 936 | prfile = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
937 | |
| 15884 | 938 | f = purple_request_fields_get_field(fields, "un"); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
939 | if (f) |
| 15884 | 940 | un = purple_request_field_string_get_value(f); |
| 941 | f = purple_request_fields_get_field(fields, "hn"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
942 | if (f) |
| 15884 | 943 | hn = purple_request_field_string_get_value(f); |
| 944 | f = purple_request_fields_get_field(fields, "rn"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
945 | if (f) |
| 15884 | 946 | rn = purple_request_field_string_get_value(f); |
| 947 | f = purple_request_fields_get_field(fields, "e"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
948 | if (f) |
| 15884 | 949 | e = purple_request_field_string_get_value(f); |
| 950 | f = purple_request_fields_get_field(fields, "o"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
951 | if (f) |
| 15884 | 952 | o = purple_request_field_string_get_value(f); |
| 953 | f = purple_request_fields_get_field(fields, "c"); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
954 | if (f) |
| 15884 | 955 | c = purple_request_field_string_get_value(f); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
956 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
957 | 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
|
958 | (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
|
959 | (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
|
960 | NULL); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
961 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
962 | /* Create the key pair */ |
| 15884 | 963 | 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
|
964 | identifier, pass1, &public_key, NULL, |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
965 | FALSE)) { |
| 15884 | 966 | purple_notify_error( |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
967 | gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
968 | return; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
969 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
970 | |
| 15884 | 971 | silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
972 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
973 | silc_pkcs_public_key_free(public_key); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
974 | silc_free(identifier); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
975 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
976 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
977 | static void |
| 15884 | 978 | silcpurple_create_keypair(PurplePluginAction *action) |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
979 | { |
| 15884 | 980 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 981 | SilcPurple sg = gc->proto_data; | |
| 982 | PurpleRequestFields *fields; | |
| 983 | PurpleRequestFieldGroup *g; | |
| 984 | PurpleRequestField *f; | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
985 | const char *username, *realname; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
986 | char *hostname, **u; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
987 | char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
988 | |
| 15884 | 989 | username = purple_account_get_username(sg->account); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
990 | u = g_strsplit(username, "@", 2); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
991 | username = u[0]; |
| 15884 | 992 | realname = purple_account_get_user_info(sg->account); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
993 | hostname = silc_net_localhost(); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
994 | g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
995 | |
| 15884 | 996 | g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); |
| 997 | 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
|
998 | g_snprintf(pkd, sizeof(pkd) - 1, "%s", |
| 15884 | 999 | purple_account_get_string(gc->account, "public-key", pkd2)); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1000 | g_snprintf(prd, sizeof(prd) - 1, "%s", |
| 15884 | 1001 | purple_account_get_string(gc->account, "private-key", prd2)); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1002 | |
| 15884 | 1003 | fields = purple_request_fields_new(); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1004 | |
| 15884 | 1005 | g = purple_request_field_group_new(NULL); |
| 1006 | f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); | |
| 1007 | purple_request_field_group_add_field(g, f); | |
| 1008 | f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE); | |
| 1009 | purple_request_field_group_add_field(g, f); | |
| 1010 | f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE); | |
| 1011 | purple_request_field_group_add_field(g, f); | |
| 1012 | purple_request_fields_add_group(fields, g); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1013 | |
| 15884 | 1014 | g = purple_request_field_group_new(NULL); |
| 1015 | f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE); | |
| 1016 | purple_request_field_group_add_field(g, f); | |
| 1017 | f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); | |
| 1018 | purple_request_field_group_add_field(g, f); | |
| 1019 | f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE); | |
| 1020 | purple_request_field_group_add_field(g, f); | |
| 1021 | f = purple_request_field_string_new("e", _("E-mail"), tmp, FALSE); | |
| 1022 | purple_request_field_group_add_field(g, f); | |
| 1023 | f = purple_request_field_string_new("o", _("Organization"), "", FALSE); | |
| 1024 | purple_request_field_group_add_field(g, f); | |
| 1025 | f = purple_request_field_string_new("c", _("Country"), "", FALSE); | |
| 1026 | purple_request_field_group_add_field(g, f); | |
| 1027 | purple_request_fields_add_group(fields, g); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1028 | |
| 15884 | 1029 | g = purple_request_field_group_new(NULL); |
| 1030 | f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE); | |
| 1031 | purple_request_field_string_set_masked(f, TRUE); | |
| 1032 | purple_request_field_group_add_field(g, f); | |
| 1033 | f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE); | |
| 1034 | purple_request_field_string_set_masked(f, TRUE); | |
| 1035 | purple_request_field_group_add_field(g, f); | |
| 1036 | purple_request_fields_add_group(fields, g); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1037 | |
| 15884 | 1038 | 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
|
1039 | _("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
|
1040 | _("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
|
1041 | _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1042 | gc->account, NULL, NULL, gc); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1043 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1044 | g_strfreev(u); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1045 | silc_free(hostname); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1046 | } |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1047 | |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1048 | static void |
| 15884 | 1049 | silcpurple_change_pass(PurplePluginAction *action) |
| 9272 | 1050 | { |
| 15884 | 1051 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 1052 | purple_account_request_change_password(purple_connection_get_account(gc)); | |
| 9272 | 1053 | } |
| 1054 | ||
| 1055 | static void | |
| 15884 | 1056 | silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) |
| 9272 | 1057 | { |
|
10825
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
1058 | char prd[256]; |
| 15884 | 1059 | g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); |
| 1060 | silc_change_private_key_passphrase(purple_account_get_string(gc->account, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1061 | "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
|
1062 | prd), old, new); |
| 9272 | 1063 | } |
| 1064 | ||
| 1065 | static void | |
| 15884 | 1066 | silcpurple_show_set_info(PurplePluginAction *action) |
| 9272 | 1067 | { |
| 15884 | 1068 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 1069 | purple_account_request_change_user_info(purple_connection_get_account(gc)); | |
| 9272 | 1070 | } |
| 1071 | ||
| 1072 | static void | |
| 15884 | 1073 | silcpurple_set_info(PurpleConnection *gc, const char *text) |
| 9272 | 1074 | { |
| 1075 | } | |
| 1076 | ||
| 8849 | 1077 | static GList * |
| 15884 | 1078 | silcpurple_actions(PurplePlugin *plugin, gpointer context) |
| 8849 | 1079 | { |
| 1080 | GList *list = NULL; | |
| 15884 | 1081 | PurplePluginAction *act; |
| 8849 | 1082 | |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
1083 | 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
|
1084 | silcpurple_attrs); |
|
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17675
diff
changeset
|
1085 | list = g_list_append(list, act); |
| 8849 | 1086 | |
| 15884 | 1087 | act = purple_plugin_action_new(_("Detach From Server"), |
| 1088 | silcpurple_detach); | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1089 | list = g_list_append(list, act); |
| 8849 | 1090 | |
| 15884 | 1091 | act = purple_plugin_action_new(_("View Message of the Day"), |
| 1092 | silcpurple_view_motd); | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
1093 | list = g_list_append(list, act); |
| 8849 | 1094 | |
| 15884 | 1095 | act = purple_plugin_action_new(_("Create SILC Key Pair..."), |
| 1096 | silcpurple_create_keypair); | |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1097 | list = g_list_append(list, act); |
|
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1098 | |
| 15884 | 1099 | act = purple_plugin_action_new(_("Change Password..."), |
| 1100 | silcpurple_change_pass); | |
| 9272 | 1101 | list = g_list_append(list, act); |
| 1102 | ||
| 15884 | 1103 | act = purple_plugin_action_new(_("Set User Info..."), |
| 1104 | silcpurple_show_set_info); | |
| 9272 | 1105 | list = g_list_append(list, act); |
| 1106 | ||
| 8849 | 1107 | return list; |
| 1108 | } | |
| 1109 | ||
| 1110 | ||
| 1111 | /******************************* IM Routines *********************************/ | |
| 1112 | ||
| 1113 | typedef struct { | |
| 1114 | char *nick; | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11257
diff
changeset
|
1115 | char *message; |
| 8849 | 1116 | SilcUInt32 message_len; |
| 1117 | SilcMessageFlags flags; | |
| 15884 | 1118 | PurpleMessageFlags gflags; |
| 1119 | } *SilcPurpleIM; | |
| 8849 | 1120 | |
| 1121 | static void | |
| 15884 | 1122 | 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
|
1123 | 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
|
1124 | 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
|
1125 | 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
|
1126 | void *context) |
| 8849 | 1127 | { |
| 15884 | 1128 | PurpleConnection *gc = client->application; |
| 1129 | SilcPurple sg = gc->proto_data; | |
| 1130 | SilcPurpleIM im = context; | |
| 1131 | 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
|
1132 | char tmp[256]; |
| 8849 | 1133 | SilcClientEntry client_entry; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1134 | SilcDList list; |
| 8849 | 1135 | |
| 15884 | 1136 | 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
|
1137 | sg->account); |
| 8849 | 1138 | if (!convo) |
| 1139 | return; | |
| 1140 | ||
| 1141 | if (!clients) | |
| 1142 | goto err; | |
| 1143 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1144 | if (silc_dlist_count(clients) > 1) { |
| 8849 | 1145 | /* Find the correct one. The im->nick might be a formatted nick |
| 1146 | so this will find the correct one. */ | |
| 1147 | 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
|
1148 | im->nick, FALSE); |
| 8849 | 1149 | if (!clients) |
| 1150 | goto err; | |
| 1151 | } | |
| 1152 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1153 | 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
|
1154 | 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
|
1155 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1156 | /* Check for images */ |
| 15884 | 1157 | if (im->gflags & PURPLE_MESSAGE_IMAGES) { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1158 | list = silcpurple_image_message(im->message, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1159 | (SilcUInt32 *)(void *)&im->flags); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1160 | if (list) { |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1161 | /* Send one or more MIME message. If more than one, they |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1162 | are MIME fragments due to over large message */ |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1163 | SilcBuffer buf; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1164 | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1165 | silc_dlist_start(list); |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1166 | while ((buf = silc_dlist_get(list)) != SILC_LIST_END) |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1167 | silc_client_send_private_message(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
|
1168 | client_entry, im->flags, NULL, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1169 | 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
|
1170 | silc_buffer_len(buf)); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1171 | silc_mime_partial_free(list); |
| 15884 | 1172 | 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
|
1173 | im->message, 0, time(NULL)); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1174 | goto out; |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1175 | } |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1176 | } |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1177 | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1178 | /* Send the message */ |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1179 | silc_client_send_private_message(client, conn, client_entry, im->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
|
1180 | NULL, (unsigned char *)im->message, im->message_len); |
| 15884 | 1181 | 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
|
1182 | im->message, 0, time(NULL)); |
| 8849 | 1183 | goto out; |
| 1184 | ||
| 1185 | err: | |
| 1186 | g_snprintf(tmp, sizeof(tmp), | |
| 1187 | _("User <I>%s</I> is not present in the network"), im->nick); | |
| 15884 | 1188 | purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8849 | 1189 | |
| 1190 | out: | |
| 1191 | g_free(im->nick); | |
| 1192 | g_free(im->message); | |
| 1193 | silc_free(im); | |
| 1194 | } | |
| 1195 | ||
| 1196 | static int | |
| 15884 | 1197 | 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
|
1198 | PurpleMessageFlags flags) |
| 8849 | 1199 | { |
| 15884 | 1200 | SilcPurple sg = gc->proto_data; |
| 8849 | 1201 | SilcClient client = sg->client; |
| 1202 | 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
|
1203 | 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
|
1204 | SilcClientEntry client_entry; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1205 | SilcUInt32 mflags; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1206 | char *msg, *tmp; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1207 | int ret = 0; |
| 15884 | 1208 | 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
|
1209 | SilcDList list; |
| 8849 | 1210 | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1211 | if (!who || !message) |
| 8849 | 1212 | return 0; |
| 1213 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1214 | mflags = SILC_MESSAGE_FLAG_UTF8; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1215 | |
| 15884 | 1216 | tmp = msg = purple_unescape_html(message); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1217 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1218 | if (!g_ascii_strncasecmp(msg, "/me ", 4)) { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1219 | msg += 4; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1220 | if (!*msg) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1221 | g_free(tmp); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1222 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1223 | } |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1224 | mflags |= SILC_MESSAGE_FLAG_ACTION; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1225 | } else if (strlen(msg) > 1 && msg[0] == '/') { |
| 8849 | 1226 | 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
|
1227 | 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
|
1228 | _("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
|
1229 | _("Unknown command")); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1230 | g_free(tmp); |
| 8849 | 1231 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1232 | } |
| 8849 | 1233 | |
| 1234 | if (sign) | |
| 1235 | mflags |= SILC_MESSAGE_FLAG_SIGNED; | |
| 1236 | ||
| 1237 | /* 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
|
1238 | clients = silc_client_get_clients_local(client, conn, who, FALSE); |
| 8849 | 1239 | if (!clients) { |
| 1240 | /* Resolve unknown user */ | |
| 15884 | 1241 | SilcPurpleIM im = silc_calloc(1, sizeof(*im)); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1242 | if (!im) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1243 | g_free(tmp); |
| 8849 | 1244 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1245 | } |
| 8849 | 1246 | im->nick = g_strdup(who); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1247 | im->message = g_strdup(message); |
| 8849 | 1248 | im->message_len = strlen(im->message); |
| 1249 | im->flags = mflags; | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1250 | 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
|
1251 | silc_client_get_clients(client, conn, who, NULL, |
| 15884 | 1252 | silcpurple_send_im_resolved, im); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1253 | g_free(tmp); |
| 8849 | 1254 | return 0; |
| 1255 | } | |
| 1256 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1257 | 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
|
1258 | 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
|
1259 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1260 | /* Check for images */ |
| 15884 | 1261 | if (flags & PURPLE_MESSAGE_IMAGES) { |
| 1262 | list = silcpurple_image_message(message, &mflags); | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1263 | if (list) { |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1264 | /* Send one or more MIME message. If more than one, they |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1265 | are MIME fragments due to over large message */ |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1266 | SilcBuffer buf; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1267 | |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1268 | silc_dlist_start(list); |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1269 | while ((buf = silc_dlist_get(list)) != SILC_LIST_END) |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1270 | ret = |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1271 | silc_client_send_private_message(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
|
1272 | client_entry, mflags, NULL, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1273 | 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
|
1274 | silc_buffer_len(buf)); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1275 | silc_mime_partial_free(list); |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1276 | 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
|
1277 | silc_client_list_free(client, conn, clients); |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1278 | return ret; |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1279 | } |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1280 | } |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1281 | |
|
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1282 | /* 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
|
1283 | ret = silc_client_send_private_message(client, conn, client_entry, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1284 | mflags, NULL, |
|
12303
f2b594862195
[gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents:
12217
diff
changeset
|
1285 | (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
|
1286 | strlen(msg)); |
| 8849 | 1287 | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1288 | 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
|
1289 | silc_client_list_free(client, conn, clients); |
| 8849 | 1290 | return ret; |
| 1291 | } | |
| 1292 | ||
| 1293 | ||
| 15884 | 1294 | static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) { |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1295 | /* split this single menu building function back into the two |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1296 | original: one for buddies and one for chats */ |
| 15884 | 1297 | if(PURPLE_BLIST_NODE_IS_CHAT(node)) { |
| 1298 | return silcpurple_chat_menu((PurpleChat *) node); | |
| 1299 | } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { | |
| 1300 | return silcpurple_buddy_menu((PurpleBuddy *) node); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1301 | } else { |
| 9038 | 1302 | g_return_val_if_reached(NULL); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1303 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1304 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1305 | |
| 9272 | 1306 | /********************************* Commands **********************************/ |
| 1307 | ||
| 15884 | 1308 | static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, |
| 9597 | 1309 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1310 | { |
| 15884 | 1311 | PurpleConnection *gc; |
| 1312 | PurpleConversation *convo = conv; | |
| 9272 | 1313 | int id = 0; |
| 1314 | ||
| 15884 | 1315 | gc = purple_conversation_get_gc(conv); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1316 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1317 | if (gc == NULL) |
| 15884 | 1318 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1319 | |
|
13636
7f3119845b45
[gaim-migrate @ 16033]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13546
diff
changeset
|
1320 | if(args && args[0]) |
| 15884 | 1321 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10225
diff
changeset
|
1322 | gc->account); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1323 | |
|
13636
7f3119845b45
[gaim-migrate @ 16033]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13546
diff
changeset
|
1324 | if (convo != NULL) |
| 15884 | 1325 | id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1326 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1327 | if (id == 0) |
| 15884 | 1328 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1329 | |
| 15884 | 1330 | silcpurple_chat_leave(gc, id); |
| 9272 | 1331 | |
| 15884 | 1332 | return PURPLE_CMD_RET_OK; |
| 9272 | 1333 | |
| 1334 | } | |
| 1335 | ||
| 15884 | 1336 | static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, |
| 9597 | 1337 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1338 | { |
| 15884 | 1339 | PurpleConnection *gc; |
| 9272 | 1340 | int id = 0; |
| 9762 | 1341 | char *buf, *tmp, *tmp2; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1342 | const char *topic; |
| 9272 | 1343 | |
| 15884 | 1344 | gc = purple_conversation_get_gc(conv); |
| 1345 | id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); | |
| 9272 | 1346 | |
| 1347 | if (gc == NULL || id == 0) | |
| 15884 | 1348 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1349 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1350 | if (!args || !args[0]) { |
| 15884 | 1351 | topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1352 | if (topic) { |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
1353 | tmp = g_markup_escape_text(topic, -1); |
| 15884 | 1354 | tmp2 = purple_markup_linkify(tmp); |
| 9762 | 1355 | buf = g_strdup_printf(_("current topic is: %s"), tmp2); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1356 | g_free(tmp); |
| 9762 | 1357 | g_free(tmp2); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1358 | } else |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1359 | buf = g_strdup(_("No topic is set")); |
| 15884 | 1360 | purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, |
| 1361 | PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1362 | g_free(buf); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1363 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1364 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1365 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1366 | if (args && args[0] && (strlen(args[0]) > 255)) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1367 | *error = g_strdup(_("Topic too long")); |
| 15884 | 1368 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1369 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1370 | |
| 15884 | 1371 | silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL); |
| 9272 | 1372 | |
| 15884 | 1373 | return PURPLE_CMD_RET_OK; |
| 9272 | 1374 | } |
| 1375 | ||
| 15884 | 1376 | static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, |
| 9597 | 1377 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1378 | { |
| 1379 | GHashTable *comp; | |
| 1380 | ||
| 1381 | if(!args || !args[0]) | |
| 15884 | 1382 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1383 | |
| 1384 | comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); | |
| 1385 | ||
| 1386 | g_hash_table_replace(comp, "channel", args[0]); | |
| 1387 | if(args[1]) | |
| 1388 | g_hash_table_replace(comp, "passphrase", args[1]); | |
| 1389 | ||
| 15884 | 1390 | silcpurple_chat_join(purple_conversation_get_gc(conv), comp); |
| 9272 | 1391 | |
| 1392 | g_hash_table_destroy(comp); | |
| 15884 | 1393 | return PURPLE_CMD_RET_OK; |
| 9272 | 1394 | } |
| 1395 | ||
| 15884 | 1396 | static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, |
| 9597 | 1397 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1398 | { |
| 15884 | 1399 | PurpleConnection *gc; |
| 1400 | gc = purple_conversation_get_gc(conv); | |
| 1401 | purple_roomlist_show_with_account(purple_connection_get_account(gc)); | |
| 1402 | return PURPLE_CMD_RET_OK; | |
| 9272 | 1403 | } |
| 1404 | ||
| 15884 | 1405 | static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, |
| 9597 | 1406 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1407 | { |
| 15884 | 1408 | PurpleConnection *gc; |
| 9272 | 1409 | |
| 15884 | 1410 | gc = purple_conversation_get_gc(conv); |
| 9272 | 1411 | |
| 1412 | if (gc == NULL) | |
| 15884 | 1413 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1414 | |
| 15884 | 1415 | silcpurple_get_info(gc, args[0]); |
| 9272 | 1416 | |
| 15884 | 1417 | return PURPLE_CMD_RET_OK; |
| 9272 | 1418 | } |
| 1419 | ||
| 15884 | 1420 | static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, |
| 9597 | 1421 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1422 | { |
| 1423 | int ret; | |
| 15884 | 1424 | PurpleConnection *gc; |
| 9272 | 1425 | |
| 15884 | 1426 | gc = purple_conversation_get_gc(conv); |
| 9272 | 1427 | |
| 1428 | if (gc == NULL) | |
| 15884 | 1429 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1430 | |
| 15884 | 1431 | ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); |
| 9272 | 1432 | |
| 1433 | if (ret) | |
| 15884 | 1434 | return PURPLE_CMD_RET_OK; |
| 9272 | 1435 | else |
| 15884 | 1436 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1437 | } |
| 1438 | ||
| 15884 | 1439 | static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, |
| 9597 | 1440 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1441 | { |
| 1442 | int ret = 1; | |
| 15884 | 1443 | PurpleConversation *convo; |
| 1444 | PurpleConnection *gc; | |
| 1445 | PurpleAccount *account; | |
| 9272 | 1446 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1447 | if (!args || !args[0]) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1448 | *error = g_strdup(_("You must specify a nick")); |
| 15884 | 1449 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1450 | } |
| 9272 | 1451 | |
| 15884 | 1452 | gc = purple_conversation_get_gc(conv); |
| 9272 | 1453 | |
| 1454 | if (gc == NULL) | |
| 15884 | 1455 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1456 | |
| 15884 | 1457 | account = purple_connection_get_account(gc); |
| 9272 | 1458 | |
| 15884 | 1459 | convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]); |
| 9272 | 1460 | |
| 1461 | if (args[1]) { | |
| 15884 | 1462 | ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); |
| 1463 | purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), | |
| 1464 | args[1], PURPLE_MESSAGE_SEND, time(NULL)); | |
| 9272 | 1465 | } |
| 1466 | ||
| 1467 | if (ret) | |
| 15884 | 1468 | return PURPLE_CMD_RET_OK; |
| 9272 | 1469 | else |
| 15884 | 1470 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1471 | } |
| 1472 | ||
| 15884 | 1473 | static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, |
| 9597 | 1474 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1475 | { |
| 15884 | 1476 | PurpleConnection *gc; |
| 1477 | SilcPurple sg; | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1478 | char *tmp; |
| 9272 | 1479 | |
| 15884 | 1480 | gc = purple_conversation_get_gc(conv); |
| 9272 | 1481 | |
| 1482 | if (gc == NULL) | |
| 15884 | 1483 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1484 | |
| 1485 | sg = gc->proto_data; | |
| 1486 | ||
| 1487 | if (sg == NULL) | |
| 15884 | 1488 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1489 | |
| 1490 | if (!sg->motd) { | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1491 | *error = g_strdup(_("There is no Message of the Day associated with this connection")); |
| 15884 | 1492 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1493 | } |
| 1494 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10547
diff
changeset
|
1495 | tmp = g_markup_escape_text(sg->motd, -1); |
| 15884 | 1496 | purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1497 | tmp, NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1498 | g_free(tmp); |
| 9272 | 1499 | |
| 15884 | 1500 | return PURPLE_CMD_RET_OK; |
| 9272 | 1501 | } |
| 1502 | ||
| 15884 | 1503 | static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, |
| 9597 | 1504 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1505 | { |
| 15884 | 1506 | PurpleConnection *gc; |
| 1507 | SilcPurple sg; | |
| 9272 | 1508 | |
| 15884 | 1509 | gc = purple_conversation_get_gc(conv); |
| 9272 | 1510 | |
| 1511 | if (gc == NULL) | |
| 15884 | 1512 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1513 | |
| 1514 | sg = gc->proto_data; | |
| 1515 | ||
| 1516 | if (sg == NULL) | |
| 15884 | 1517 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1518 | |
| 1519 | silc_client_command_call(sg->client, sg->conn, "DETACH"); | |
| 1520 | sg->detaching = TRUE; | |
| 1521 | ||
| 15884 | 1522 | return PURPLE_CMD_RET_OK; |
| 9272 | 1523 | } |
| 1524 | ||
| 15884 | 1525 | static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, |
| 9597 | 1526 | const char *cmd, char **args, char **error, void *data) |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1527 | { |
| 15884 | 1528 | PurpleConnection *gc; |
| 1529 | SilcPurple sg; | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1530 | SilcChannelEntry channel; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1531 | char *silccmd, *silcargs, *msg, tmp[256]; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1532 | const char *chname; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1533 | |
| 15884 | 1534 | gc = purple_conversation_get_gc(conv); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1535 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1536 | if (gc == NULL || !args || gc->proto_data == NULL) |
| 15884 | 1537 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1538 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1539 | sg = gc->proto_data; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1540 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1541 | if (args[0]) |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1542 | chname = args[0]; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1543 | else |
| 15884 | 1544 | chname = purple_conversation_get_name(conv); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1545 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1546 | if (!args[1]) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1547 | channel = silc_client_get_channel(sg->client, sg->conn, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1548 | (char *)chname); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1549 | if (!channel) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1550 | *error = g_strdup_printf(_("channel %s not found"), chname); |
| 15884 | 1551 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1552 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1553 | if (channel->mode) { |
| 15884 | 1554 | silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1555 | msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1556 | } else { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1557 | 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
|
1558 | } |
| 15884 | 1559 | purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", |
| 1560 | msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1561 | g_free(msg); |
| 15884 | 1562 | return PURPLE_CMD_RET_OK; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1563 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1564 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1565 | silcargs = g_strjoinv(" ", args); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1566 | silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1567 | g_free(silcargs); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1568 | if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1569 | g_free(silccmd); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1570 | *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); |
| 15884 | 1571 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1572 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1573 | g_free(silccmd); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1574 | |
| 15884 | 1575 | return PURPLE_CMD_RET_OK; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1576 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1577 | |
| 15884 | 1578 | static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, |
| 9597 | 1579 | const char *cmd, char **args, char **error, void *data) |
| 9272 | 1580 | { |
| 15884 | 1581 | PurpleConnection *gc; |
| 1582 | SilcPurple sg; | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1583 | char *silccmd, *silcargs; |
| 9272 | 1584 | |
| 15884 | 1585 | gc = purple_conversation_get_gc(conv); |
| 9272 | 1586 | |
| 1587 | if (gc == NULL) | |
| 15884 | 1588 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1589 | |
| 1590 | sg = gc->proto_data; | |
| 1591 | ||
| 1592 | if (sg == NULL) | |
| 15884 | 1593 | return PURPLE_CMD_RET_FAILED; |
| 9272 | 1594 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1595 | silcargs = g_strjoinv(" ", args); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1596 | silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1597 | g_free(silcargs); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1598 | if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1599 | 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
|
1600 | *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd); |
| 15884 | 1601 | return PURPLE_CMD_RET_FAILED; |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1602 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1603 | g_free(silccmd); |
| 9272 | 1604 | |
| 15884 | 1605 | return PURPLE_CMD_RET_OK; |
| 9272 | 1606 | } |
| 1607 | ||
| 15884 | 1608 | static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, |
| 9597 | 1609 | const char *cmd, char **args, char **error, void *data) |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1610 | { |
| 15884 | 1611 | PurpleConnection *gc; |
| 1612 | SilcPurple sg; | |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1613 | |
| 15884 | 1614 | gc = purple_conversation_get_gc(conv); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1615 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1616 | if (gc == NULL) |
| 15884 | 1617 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1618 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1619 | sg = gc->proto_data; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1620 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1621 | if (sg == NULL) |
| 15884 | 1622 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1623 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1624 | silc_client_command_call(sg->client, sg->conn, 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
|
1625 | "QUIT", (args && args[0]) ? args[0] : "Download Pidgin: " PURPLE_WEBSITE, NULL); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1626 | |
| 15884 | 1627 | return PURPLE_CMD_RET_OK; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1628 | } |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1629 | |
| 15884 | 1630 | static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, |
| 9597 | 1631 | const char *cmd, char **args, char **error, void *data) |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1632 | { |
| 15884 | 1633 | PurpleConnection *gc; |
| 1634 | SilcPurple sg; | |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1635 | |
| 15884 | 1636 | gc = purple_conversation_get_gc(conv); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1637 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1638 | if (gc == NULL) |
| 15884 | 1639 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1640 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1641 | sg = gc->proto_data; |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1642 | |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1643 | if (sg == NULL) |
| 15884 | 1644 | return PURPLE_CMD_RET_FAILED; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1645 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1646 | if (!silc_client_command_call(sg->client, sg->conn, args[0])) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1647 | *error = g_strdup_printf(_("Unknown command: %s"), args[0]); |
| 15884 | 1648 | return PURPLE_CMD_RET_FAILED; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1649 | } |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1650 | |
| 15884 | 1651 | return PURPLE_CMD_RET_OK; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1652 | } |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1653 | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9024
diff
changeset
|
1654 | |
| 8849 | 1655 | /************************** Plugin Initialization ****************************/ |
| 1656 | ||
| 9272 | 1657 | static void |
| 15884 | 1658 | silcpurple_register_commands(void) |
| 9272 | 1659 | { |
| 15884 | 1660 | purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL, |
| 1661 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 1662 | PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, | |
| 1663 | "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); | |
| 1664 | purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL, | |
| 1665 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 1666 | PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, | |
| 1667 | "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); | |
| 1668 | purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, | |
| 1669 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1670 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
| 1671 | silcpurple_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); | |
| 1672 | purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, | |
| 1673 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 1674 | PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, | |
| 1675 | "prpl-silc", silcpurple_cmd_chat_join, | |
| 9597 | 1676 | _("join <channel> [<password>]: Join a chat on this network"), NULL); |
| 15884 | 1677 | purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, |
| 1678 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1679 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", | |
| 1680 | silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL); | |
| 1681 | purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL, | |
| 1682 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 9272 | 1683 | "prpl-silc", |
| 15884 | 1684 | silcpurple_cmd_whois, _("whois <nick>: View nick's information"), NULL); |
| 1685 | purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, | |
| 1686 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1687 | "prpl-silc", silcpurple_cmd_msg, | |
| 9597 | 1688 | _("msg <nick> <message>: Send a private message to a user"), NULL); |
| 15884 | 1689 | purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL, |
| 1690 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1691 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query, | |
| 9597 | 1692 | _("query <nick> [<message>]: Send a private message to a user"), NULL); |
| 15884 | 1693 | purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL, |
| 1694 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1695 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd, | |
| 9597 | 1696 | _("motd: View the server's Message Of The Day"), NULL); |
| 15884 | 1697 | purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL, |
| 1698 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1699 | "prpl-silc", silcpurple_cmd_detach, | |
| 9597 | 1700 | _("detach: Detach this session"), NULL); |
| 15884 | 1701 | purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL, |
| 1702 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1703 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit, | |
| 9597 | 1704 | _("quit [message]: Disconnect from the server, with an optional message"), NULL); |
| 15884 | 1705 | purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL, |
| 1706 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1707 | "prpl-silc", silcpurple_cmd_call, | |
| 9597 | 1708 | _("call <command>: Call any silc client command"), NULL); |
| 1709 | /* These below just get passed through for the silc client library to deal | |
| 1710 | * with */ | |
| 15884 | 1711 | purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL, |
| 1712 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1713 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1714 | _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); |
| 15884 | 1715 | purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL, |
| 1716 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1717 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1718 | _("nick <newnick>: Change your nickname"), NULL); |
| 15884 | 1719 | purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL, |
| 1720 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1721 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1722 | _("whowas <nick>: View nick's information"), NULL); |
| 15884 | 1723 | purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL, |
| 1724 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1725 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode, | |
| 9597 | 1726 | _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); |
| 15884 | 1727 | purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL, |
| 1728 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1729 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1730 | _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); |
| 15884 | 1731 | purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL, |
| 1732 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1733 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1734 | _("umode <usermodes>: Set your modes in the network"), NULL); |
| 15884 | 1735 | purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL, |
| 1736 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1737 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1738 | _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); |
| 15884 | 1739 | purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, |
| 1740 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1741 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1742 | _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); |
| 15884 | 1743 | purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL, |
| 1744 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1745 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1746 | _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); |
| 15884 | 1747 | purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL, |
| 1748 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1749 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1750 | _("info [server]: View server administrative details"), NULL); |
| 15884 | 1751 | purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL, |
| 1752 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1753 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1754 | _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); |
| 15884 | 1755 | purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL, |
| 1756 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1757 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1758 | _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); |
| 15884 | 1759 | purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL, |
| 1760 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1761 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1762 | _("stats: View server and network statistics"), NULL); |
| 15884 | 1763 | purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL, |
| 1764 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1765 | "prpl-silc", silcpurple_cmd_generic, | |
| 9597 | 1766 | _("ping: Send PING to the connected server"), NULL); |
| 15884 | 1767 | #if 0 /* Purple doesn't handle these yet */ |
| 1768 | purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL, | |
| 1769 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 1770 | "prpl-silc", silcpurple_cmd_users, | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
1771 | _("users <channel>: List users in channel")); |
| 15884 | 1772 | purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL, |
| 1773 | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | | |
| 1774 | 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
|
1775 | _("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
|
1776 | #endif |
| 9272 | 1777 | } |
| 1778 | ||
| 15884 | 1779 | static PurpleWhiteboardPrplOps silcpurple_wb_ops = |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
1780 | { |
| 15884 | 1781 | silcpurple_wb_start, |
| 1782 | silcpurple_wb_end, | |
| 1783 | silcpurple_wb_get_dimensions, | |
| 1784 | silcpurple_wb_set_dimensions, | |
| 1785 | silcpurple_wb_get_brush, | |
| 1786 | silcpurple_wb_set_brush, | |
| 1787 | silcpurple_wb_send, | |
| 1788 | 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
|
1789 | |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
1790 | /* 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
|
1791 | 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
|
1792 | 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
|
1793 | 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
|
1794 | NULL |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
1795 | }; |
|
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11837
diff
changeset
|
1796 | |
| 15884 | 1797 | static PurplePluginProtocolInfo prpl_info = |
| 8849 | 1798 | { |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1799 | 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
|
1800 | 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
|
1801 | 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
|
1802 | 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
|
1803 | NULL, /* protocol_options */ |
| 15884 | 1804 | {"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
|
1805 | 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
|
1806 | 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
|
1807 | silcpurple_status_text, /* status_text */ |
| 15884 | 1808 | 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
|
1809 | 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
|
1810 | silcpurple_blist_node_menu, /* blist_node_menu */ |
| 15884 | 1811 | 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
|
1812 | 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
|
1813 | 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
|
1814 | silcpurple_close, /* close */ |
| 15884 | 1815 | silcpurple_send_im, /* send_im */ |
| 1816 | 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
|
1817 | NULL, /* send_typing */ |
| 15884 | 1818 | 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
|
1819 | silcpurple_set_status, /* set_status */ |
| 15884 | 1820 | silcpurple_idle_set, /* set_idle */ |
| 1821 | silcpurple_change_passwd, /* change_passwd */ | |
| 1822 | 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
|
1823 | NULL, /* add_buddies */ |
| 15884 | 1824 | 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
|
1825 | 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
|
1826 | 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
|
1827 | 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
|
1828 | 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
|
1829 | 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
|
1830 | NULL, /* set_permit_deny */ |
| 15884 | 1831 | 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
|
1832 | NULL, /* reject_chat */ |
| 15884 | 1833 | 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
|
1834 | 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
|
1835 | 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
|
1836 | NULL, /* chat_whisper */ |
| 15884 | 1837 | silcpurple_chat_send, /* chat_send */ |
| 1838 | 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
|
1839 | 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
|
1840 | 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
|
1841 | NULL, /* get_cb_away */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1842 | 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
|
1843 | 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
|
1844 | 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
|
1845 | 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
|
1846 | 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
|
1847 | 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
|
1848 | 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
|
1849 | 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
|
1850 | 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
|
1851 | 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
|
1852 | 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
|
1853 | 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
|
1854 | 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
|
1855 | 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
|
1856 | NULL, /* can_receive_file */ |
| 15884 | 1857 | silcpurple_ftp_send_file, /* send_file */ |
| 1858 | 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
|
1859 | NULL, /* offline_message */ |
| 15884 | 1860 | &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
|
1861 | 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
|
1862 | NULL, /* roomlist_room_serialize */ |
|
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
|
1863 | |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
1864 | /* 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
|
1865 | 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
|
1866 | 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
|
1867 | 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
|
1868 | NULL |
| 8849 | 1869 | }; |
| 1870 | ||
| 15884 | 1871 | static PurplePluginInfo info = |
| 8849 | 1872 | { |
| 15884 | 1873 | PURPLE_PLUGIN_MAGIC, |
| 1874 | PURPLE_MAJOR_VERSION, | |
| 1875 | 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
|
1876 | 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
|
1877 | 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
|
1878 | 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
|
1879 | 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
|
1880 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 8849 | 1881 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1882 | "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
|
1883 | "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
|
1884 | "1.1", /**< version */ |
| 8849 | 1885 | /** summary */ |
| 1886 | N_("SILC Protocol Plugin"), | |
| 1887 | /** description */ | |
| 1888 | 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
|
1889 | "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
|
1890 | "http://silcnet.org/", /**< homepage */ |
| 8849 | 1891 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1892 | 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
|
1893 | 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
|
1894 | NULL, /**< destroy */ |
| 8849 | 1895 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1896 | 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
|
1897 | &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
|
1898 | 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
|
1899 | 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
|
1900 | |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
16549
diff
changeset
|
1901 | /* 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
|
1902 | 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
|
1903 | 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
|
1904 | 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
|
1905 | NULL |
| 8849 | 1906 | }; |
| 1907 | ||
| 1908 | static void | |
| 15884 | 1909 | init_plugin(PurplePlugin *plugin) |
| 8849 | 1910 | { |
| 15884 | 1911 | PurpleAccountOption *option; |
| 1912 | PurpleAccountUserSplit *split; | |
| 8849 | 1913 | char tmp[256]; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1914 | int i; |
| 15884 | 1915 | PurpleKeyValuePair *kvp; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1916 | GList *list = NULL; |
| 8849 | 1917 | |
| 1918 | silc_plugin = plugin; | |
| 1919 | ||
| 15884 | 1920 | split = purple_account_user_split_new(_("Network"), "silcnet.org", '@'); |
|
10825
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
1921 | 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
|
1922 | |
| 8849 | 1923 | /* Account options */ |
| 15884 | 1924 | 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
|
1925 | "server", |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1926 | "silc.silcnet.org"); |
| 8849 | 1927 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 1928 | option = purple_account_option_int_new(_("Port"), "port", 706); |
| 8849 | 1929 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 1930 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); |
| 1931 | 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
|
1932 | "public-key", tmp); |
|
10825
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
1933 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 1934 | g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); |
| 1935 | 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
|
1936 | "private-key", tmp); |
|
10825
986d260851e8
[gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10802
diff
changeset
|
1937 | 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
|
1938 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1939 | for (i = 0; silc_default_ciphers[i].name; i++) { |
| 15884 | 1940 | kvp = g_new0(PurpleKeyValuePair, 1); |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1941 | kvp->key = g_strdup(silc_default_ciphers[i].name); |
|
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1942 | kvp->value = g_strdup(silc_default_ciphers[i].name); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1943 | list = g_list_append(list, kvp); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1944 | } |
| 15884 | 1945 | option = purple_account_option_list_new(_("Cipher"), "cipher", list); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1946 | 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
|
1947 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1948 | list = NULL; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1949 | for (i = 0; silc_default_hmacs[i].name; i++) { |
| 15884 | 1950 | kvp = g_new0(PurpleKeyValuePair, 1); |
|
15081
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1951 | kvp->key = g_strdup(silc_default_hmacs[i].name); |
|
7e978e8dc84a
[gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents:
14899
diff
changeset
|
1952 | kvp->value = g_strdup(silc_default_hmacs[i].name); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1953 | list = g_list_append(list, kvp); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1954 | } |
| 15884 | 1955 | option = purple_account_option_list_new(_("HMAC"), "hmac", list); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
1956 | 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
|
1957 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1958 | 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
|
1959 | "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
|
1960 | 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
|
1961 | |
| 15884 | 1962 | 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
|
1963 | "pubkey-auth", FALSE); |
| 8849 | 1964 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 1965 | 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
|
1966 | "block-ims", FALSE); |
| 8849 | 1967 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 1968 | 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
|
1969 | "block-wb", FALSE); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1970 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 1971 | 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
|
1972 | "open-wb", FALSE); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1973 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 15884 | 1974 | 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
|
1975 | "sign-verify", FALSE); |
|
12167
f3ad3170f09d
[gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents:
12149
diff
changeset
|
1976 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 8849 | 1977 | |
| 15884 | 1978 | purple_prefs_remove("/plugins/prpl/silc"); |
| 9272 | 1979 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1980 | silc_log_set_callback(SILC_LOG_ERROR, silcpurple_log_error, NULL); |
| 15884 | 1981 | silcpurple_register_commands(); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9308
diff
changeset
|
1982 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1983 | #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
|
1984 | 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
|
1985 | silc_log_set_debug_string("*client*"); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1986 | #endif |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17570
diff
changeset
|
1987 | |
| 8849 | 1988 | } |
| 1989 | ||
| 15884 | 1990 | PURPLE_INIT_PLUGIN(silc, init_plugin, info); |