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