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