Fri, 20 May 2022 02:55:51 -0500
Update purple_core_init to take a PurpleUiInfo instance
Added an `id` property to `PurpleUiInfo`
Testing Done:
Ran the unit tests and verified I could run Pidgin and connect an account.
Reviewed at https://reviews.imfreedom.org/r/1456/
| 8849 | 1 | /* |
| 2 | ||
| 15884 | 3 | silcpurple_chat.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:
16492
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 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
20 | #include <glib/gi18n-lib.h> |
|
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
21 | |
| 15884 | 22 | #include "silcpurple.h" |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
23 | #include "wb.h" |
| 8849 | 24 | |
| 25 | /***************************** Channel Routines ******************************/ | |
| 26 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
27 | GList *silcpurple_chat_info(PurpleProtocolChat *protocol_chat, PurpleConnection *gc) |
| 8849 | 28 | { |
| 29 | GList *ci = NULL; | |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
30 | PurpleProtocolChatEntry *pce; |
| 8849 | 31 | |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
32 | pce = g_new0(PurpleProtocolChatEntry, 1); |
| 8849 | 33 | pce->label = _("_Channel:"); |
| 34 | pce->identifier = "channel"; | |
|
10519
80801a34a246
[gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10246
diff
changeset
|
35 | pce->required = TRUE; |
| 8849 | 36 | ci = g_list_append(ci, pce); |
| 37 | ||
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
38 | pce = g_new0(PurpleProtocolChatEntry, 1); |
| 8849 | 39 | pce->label = _("_Passphrase:"); |
| 40 | pce->identifier = "passphrase"; | |
| 41 | pce->secret = TRUE; | |
| 42 | ci = g_list_append(ci, pce); | |
| 43 | ||
| 44 | return ci; | |
| 45 | } | |
| 46 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
47 | GHashTable *silcpurple_chat_info_defaults(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, const char *chat_name) |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
48 | { |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
49 | GHashTable *defaults; |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
50 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
51 | defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
52 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
53 | if (chat_name != NULL) |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
54 | g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
55 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
56 | return defaults; |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
57 | } |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9554
diff
changeset
|
58 | |
| 8849 | 59 | static void |
| 15884 | 60 | silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components); |
| 8849 | 61 | |
| 62 | static void | |
| 15884 | 63 | silcpurple_chat_getinfo_res(SilcClient client, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
64 | SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
65 | SilcStatus status, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
66 | SilcDList channels, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
67 | void *context) |
| 8849 | 68 | { |
| 69 | GHashTable *components = context; | |
| 15884 | 70 | PurpleConnection *gc = client->application; |
| 8849 | 71 | const char *chname; |
| 72 | char tmp[256]; | |
| 73 | ||
| 74 | chname = g_hash_table_lookup(components, "channel"); | |
| 75 | if (!chname) | |
| 76 | return; | |
| 77 | ||
| 78 | if (!channels) { | |
| 79 | g_snprintf(tmp, sizeof(tmp), | |
| 80 | _("Channel %s does not exist in the network"), chname); | |
| 15884 | 81 | purple_notify_error(gc, _("Channel Information"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
82 | _("Cannot get channel information"), tmp, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
83 | purple_request_cpar_from_connection(gc)); |
| 8849 | 84 | return; |
| 85 | } | |
| 86 | ||
| 15884 | 87 | silcpurple_chat_getinfo(gc, components); |
| 8849 | 88 | } |
| 89 | ||
| 9038 | 90 | |
| 8849 | 91 | static void |
| 15884 | 92 | silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) |
| 8849 | 93 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
94 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 95 | const char *chname; |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
96 | char tmp[256], *tmp2; |
| 8849 | 97 | GString *s; |
| 98 | SilcChannelEntry channel; | |
| 99 | SilcHashTableList htl; | |
| 100 | SilcChannelUser chu; | |
| 101 | ||
| 9038 | 102 | if (!components) |
| 103 | return; | |
| 8849 | 104 | |
| 9038 | 105 | chname = g_hash_table_lookup(components, "channel"); |
| 8849 | 106 | if (!chname) |
| 107 | return; | |
| 108 | channel = silc_client_get_channel(sg->client, sg->conn, | |
| 109 | (char *)chname); | |
| 110 | if (!channel) { | |
| 111 | silc_client_get_channel_resolve(sg->client, sg->conn, | |
| 112 | (char *)chname, | |
| 15884 | 113 | silcpurple_chat_getinfo_res, |
| 9038 | 114 | components); |
| 8849 | 115 | return; |
| 116 | } | |
| 117 | ||
| 118 | s = g_string_new(""); | |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10662
diff
changeset
|
119 | tmp2 = g_markup_escape_text(channel->channel_name, -1); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
120 | g_string_append_printf(s, _("<b>Channel Name:</b> %s"), tmp2); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
121 | g_free(tmp2); |
| 8849 | 122 | if (channel->user_list && silc_hash_table_count(channel->user_list)) |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
123 | g_string_append_printf(s, _("<br><b>User Count:</b> %d"), |
| 8849 | 124 | (int)silc_hash_table_count(channel->user_list)); |
| 125 | ||
| 126 | silc_hash_table_list(channel->user_list, &htl); | |
| 127 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
| 128 | if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { | |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10662
diff
changeset
|
129 | tmp2 = g_markup_escape_text(chu->client->nickname, -1); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
130 | g_string_append_printf(s, _("<br><b>Channel Founder:</b> %s"), |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
131 | tmp2); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
132 | g_free(tmp2); |
| 8849 | 133 | break; |
| 134 | } | |
| 135 | } | |
| 136 | silc_hash_table_list_reset(&htl); | |
| 137 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
138 | if (channel->cipher) |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
139 | g_string_append_printf(s, _("<br><b>Channel Cipher:</b> %s"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
140 | channel->cipher); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
141 | |
| 8849 | 142 | if (channel->hmac) |
|
13702
35310965f38a
[gaim-migrate @ 16103]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
143 | /* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */ |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
144 | g_string_append_printf(s, _("<br><b>Channel HMAC:</b> %s"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
145 | channel->hmac); |
| 8849 | 146 | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
147 | if (channel->topic) { |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10662
diff
changeset
|
148 | tmp2 = g_markup_escape_text(channel->topic, -1); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
149 | g_string_append_printf(s, _("<br><b>Channel Topic:</b><br>%s"), tmp2); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
150 | g_free(tmp2); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
151 | } |
| 8849 | 152 | |
| 153 | if (channel->mode) { | |
|
33798
ab26d8e3da97
silc: Use appropriate datatype for SilcMessageFlags
Daniel Atallah <datallah@pidgin.im>
parents:
31798
diff
changeset
|
154 | g_string_append(s, _("<br><b>Channel Modes:</b> ")); |
| 15884 | 155 | silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); |
|
12317
3a2f08276e58
[gaim-migrate @ 14621]
Richard Laager <rlaager@pidgin.im>
parents:
12216
diff
changeset
|
156 | g_string_append(s, tmp); |
| 8849 | 157 | } |
| 158 | ||
| 159 | if (channel->founder_key) { | |
| 160 | char *fingerprint, *babbleprint; | |
| 161 | unsigned char *pk; | |
| 162 | SilcUInt32 pk_len; | |
| 163 | pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
164 | if (pk) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
165 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
166 | babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); |
| 8849 | 167 | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
168 | g_string_append_printf(s, _("<br><b>Founder Key Fingerprint:</b><br>%s"), fingerprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
169 | g_string_append_printf(s, _("<br><b>Founder Key Babbleprint:</b><br>%s"), babbleprint); |
| 8849 | 170 | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
171 | silc_free(fingerprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
172 | silc_free(babbleprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
173 | silc_free(pk); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
174 | } |
| 8849 | 175 | } |
| 176 | ||
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
177 | purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, s->str, NULL, NULL); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
178 | g_string_free(s, TRUE); |
| 8849 | 179 | } |
| 180 | ||
| 181 | ||
| 9038 | 182 | static void |
| 15884 | 183 | silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) |
| 9038 | 184 | { |
| 15884 | 185 | PurpleChat *chat = (PurpleChat *)node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
186 | PurpleAccount *account = purple_chat_get_account(chat); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
187 | silcpurple_chat_getinfo(purple_account_get_connection(account), |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
188 | purple_chat_get_components(chat)); |
| 9038 | 189 | } |
| 190 | ||
| 191 | ||
| 8849 | 192 | /************************* Channel Authentication ****************************/ |
| 193 | ||
| 194 | typedef struct { | |
| 15884 | 195 | SilcPurple sg; |
| 8849 | 196 | SilcChannelEntry channel; |
| 15884 | 197 | PurpleChat *c; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
198 | SilcDList pubkeys; |
| 15884 | 199 | } *SilcPurpleChauth; |
| 8849 | 200 | |
| 201 | static void | |
| 15884 | 202 | silcpurple_chat_chpk_add(void *user_data, const char *name) |
| 8849 | 203 | { |
| 15884 | 204 | SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; |
| 205 | SilcPurple sg = sgc->sg; | |
| 8849 | 206 | SilcClient client = sg->client; |
| 207 | SilcClientConnection conn = sg->conn; | |
| 208 | SilcPublicKey public_key; | |
| 209 | SilcBuffer chpks, pk, chidp; | |
| 210 | unsigned char mode[4]; | |
| 211 | SilcUInt32 m; | |
| 212 | ||
| 213 | /* Load the public key */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
214 | if (!silc_pkcs_load_public_key(name, &public_key)) { |
| 15884 | 215 | silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
216 | silc_dlist_uninit(sgc->pubkeys); |
| 8849 | 217 | silc_free(sgc); |
| 15884 | 218 | purple_notify_error(client->application, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
219 | _("Add Channel Public Key"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
220 | _("Could not load public key"), NULL, NULL); |
| 8849 | 221 | return; |
| 222 | } | |
| 223 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
224 | pk = silc_public_key_payload_encode(public_key); |
| 8849 | 225 | chpks = silc_buffer_alloc_size(2); |
| 226 | SILC_PUT16_MSB(1, chpks->head); | |
| 227 | chpks = silc_argument_payload_encode_one(chpks, pk->data, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
228 | silc_buffer_len(pk), 0x00); |
| 8849 | 229 | silc_buffer_free(pk); |
| 230 | ||
| 231 | m = sgc->channel->mode; | |
| 232 | m |= SILC_CHANNEL_MODE_CHANNEL_AUTH; | |
| 233 | ||
| 234 | /* Send CMODE */ | |
| 235 | SILC_PUT32_MSB(m, mode); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
236 | chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); |
| 8849 | 237 | silc_client_command_send(client, conn, SILC_COMMAND_CMODE, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
238 | silcpurple_command_reply, NULL, 3, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
239 | 1, chidp->data, silc_buffer_len(chidp), |
| 8849 | 240 | 2, mode, sizeof(mode), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
241 | 9, chpks->data, silc_buffer_len(chpks)); |
| 8849 | 242 | silc_buffer_free(chpks); |
| 243 | silc_buffer_free(chidp); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
244 | if (sgc->pubkeys) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
245 | silc_dlist_start(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
246 | while ((public_key = silc_dlist_get(sgc->pubkeys))) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
247 | silc_pkcs_public_key_free(public_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
248 | silc_dlist_uninit(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
249 | } |
| 8849 | 250 | silc_free(sgc); |
| 251 | } | |
| 252 | ||
| 253 | static void | |
| 15884 | 254 | silcpurple_chat_chpk_cancel(void *user_data, const char *name) |
| 8849 | 255 | { |
| 15884 | 256 | SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
257 | SilcPublicKey public_key; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
258 | |
| 15884 | 259 | silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
260 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
261 | if (sgc->pubkeys) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
262 | silc_dlist_start(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
263 | while ((public_key = silc_dlist_get(sgc->pubkeys))) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
264 | silc_pkcs_public_key_free(public_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
265 | silc_dlist_uninit(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
266 | } |
| 8849 | 267 | silc_free(sgc); |
| 268 | } | |
| 269 | ||
| 270 | static void | |
| 15884 | 271 | silcpurple_chat_chpk_cb(SilcPurpleChauth sgc, PurpleRequestFields *fields) |
| 8849 | 272 | { |
| 15884 | 273 | SilcPurple sg = sgc->sg; |
| 8849 | 274 | SilcClient client = sg->client; |
| 275 | SilcClientConnection conn = sg->conn; | |
| 15884 | 276 | PurpleRequestField *f; |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
17680
diff
changeset
|
277 | GList *list; |
| 8849 | 278 | SilcPublicKey public_key; |
| 279 | SilcBuffer chpks, pk, chidp; | |
| 280 | SilcUInt16 c = 0, ct; | |
| 281 | unsigned char mode[4]; | |
| 282 | SilcUInt32 m; | |
| 283 | ||
| 15884 | 284 | f = purple_request_fields_get_field(fields, "list"); |
| 285 | if (!purple_request_field_list_get_selected(f)) { | |
| 8849 | 286 | /* Add new public key */ |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
287 | purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
288 | G_CALLBACK(silcpurple_chat_chpk_add), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
289 | G_CALLBACK(silcpurple_chat_chpk_cancel), |
|
34333
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
290 | purple_request_cpar_from_connection(sg->gc), sgc); |
| 8849 | 291 | return; |
| 292 | } | |
| 293 | ||
| 15884 | 294 | list = purple_request_field_list_get_items(f); |
| 8849 | 295 | chpks = silc_buffer_alloc_size(2); |
| 296 | ||
| 297 | for (ct = 0; list; list = list->next, ct++) { | |
|
40836
b5eccef8404e
Avoid manual handling of icons in request field list items
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40788
diff
changeset
|
298 | PurpleKeyValuePair *item = list->data; |
|
b5eccef8404e
Avoid manual handling of icons in request field list items
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40788
diff
changeset
|
299 | |
|
b5eccef8404e
Avoid manual handling of icons in request field list items
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40788
diff
changeset
|
300 | public_key = purple_request_field_list_get_data(f, item->key); |
|
b5eccef8404e
Avoid manual handling of icons in request field list items
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40788
diff
changeset
|
301 | if (purple_request_field_list_is_selected(f, item->key)) { |
| 8849 | 302 | /* Delete this public key */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
303 | pk = silc_public_key_payload_encode(public_key); |
| 8849 | 304 | chpks = silc_argument_payload_encode_one(chpks, pk->data, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
305 | silc_buffer_len(pk), 0x01); |
| 8849 | 306 | silc_buffer_free(pk); |
| 307 | c++; | |
| 308 | } | |
| 309 | } | |
| 310 | if (!c) { | |
| 311 | silc_buffer_free(chpks); | |
| 312 | return; | |
| 313 | } | |
| 314 | SILC_PUT16_MSB(c, chpks->head); | |
| 315 | ||
| 316 | m = sgc->channel->mode; | |
| 317 | if (ct == c) | |
| 318 | m &= ~SILC_CHANNEL_MODE_CHANNEL_AUTH; | |
| 319 | ||
| 320 | /* Send CMODE */ | |
| 321 | SILC_PUT32_MSB(m, mode); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
322 | chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); |
| 8849 | 323 | silc_client_command_send(client, conn, SILC_COMMAND_CMODE, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
324 | silcpurple_command_reply, NULL, 3, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
325 | 1, chidp->data, silc_buffer_len(chidp), |
| 8849 | 326 | 2, mode, sizeof(mode), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
327 | 9, chpks->data, silc_buffer_len(chpks)); |
| 8849 | 328 | silc_buffer_free(chpks); |
| 329 | silc_buffer_free(chidp); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
330 | if (sgc->pubkeys) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
331 | silc_dlist_start(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
332 | while ((public_key = silc_dlist_get(sgc->pubkeys))) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
333 | silc_pkcs_public_key_free(public_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
334 | silc_dlist_uninit(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
335 | } |
| 8849 | 336 | silc_free(sgc); |
| 337 | } | |
| 338 | ||
| 339 | static void | |
| 15884 | 340 | silcpurple_chat_chauth_ok(SilcPurpleChauth sgc, PurpleRequestFields *fields) |
| 8849 | 341 | { |
| 15884 | 342 | SilcPurple sg = sgc->sg; |
| 343 | PurpleRequestField *f; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
344 | SilcPublicKey public_key; |
| 8849 | 345 | const char *curpass, *val; |
| 346 | int set; | |
| 347 | ||
| 15884 | 348 | f = purple_request_fields_get_field(fields, "passphrase"); |
| 349 | val = purple_request_field_string_get_value(f); | |
| 350 | curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); | |
| 8849 | 351 | |
| 352 | if (!val && curpass) | |
| 353 | set = 0; | |
| 354 | else if (val && !curpass) | |
| 355 | set = 1; | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
36256
diff
changeset
|
356 | else if (val && curpass && !purple_strequal(val, curpass)) |
| 8849 | 357 | set = 1; |
| 358 | else | |
| 359 | set = -1; | |
| 360 | ||
| 361 | if (set == 1) { | |
| 362 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | |
| 363 | sgc->channel->channel_name, "+a", val, NULL); | |
| 15884 | 364 | purple_blist_node_set_string((PurpleBlistNode *)sgc->c, "passphrase", val); |
| 8849 | 365 | } else if (set == 0) { |
| 366 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", | |
| 367 | sgc->channel->channel_name, "-a", NULL); | |
| 15884 | 368 | purple_blist_node_remove_setting((PurpleBlistNode *)sgc->c, "passphrase"); |
| 8849 | 369 | } |
| 370 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
371 | if (sgc->pubkeys) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
372 | silc_dlist_start(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
373 | while ((public_key = silc_dlist_get(sgc->pubkeys))) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
374 | silc_pkcs_public_key_free(public_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
375 | silc_dlist_uninit(sgc->pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
376 | } |
| 8849 | 377 | silc_free(sgc); |
| 378 | } | |
| 379 | ||
| 15884 | 380 | void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
381 | SilcDList channel_pubkeys) |
| 8849 | 382 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
383 | SilcPublicKey public_key; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
384 | SilcSILCPublicKey silc_pubkey; |
| 8849 | 385 | unsigned char *pk; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
386 | SilcUInt32 pk_len; |
| 8849 | 387 | char *fingerprint, *babbleprint; |
| 388 | SilcPublicKeyIdentifier ident; | |
|
39492
83e50cb13644
Remove unnecessary g_snprintf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39491
diff
changeset
|
389 | char tmp2[1024]; |
|
83e50cb13644
Remove unnecessary g_snprintf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39491
diff
changeset
|
390 | const gchar *t; |
| 15884 | 391 | PurpleRequestFields *fields; |
| 392 | PurpleRequestFieldGroup *g; | |
| 393 | PurpleRequestField *f; | |
| 394 | SilcPurpleChauth sgc; | |
| 8849 | 395 | const char *curpass = NULL; |
| 396 | ||
| 397 | sgc = silc_calloc(1, sizeof(*sgc)); | |
| 398 | if (!sgc) | |
| 399 | return; | |
| 400 | sgc->sg = sg; | |
| 401 | sgc->channel = channel; | |
| 402 | ||
| 15884 | 403 | fields = purple_request_fields_new(); |
| 8849 | 404 | |
| 405 | if (sgc->c) | |
| 15884 | 406 | curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); |
| 8849 | 407 | |
| 15884 | 408 | g = purple_request_field_group_new(NULL); |
| 409 | f = purple_request_field_string_new("passphrase", _("Channel Passphrase"), | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
410 | curpass, FALSE); |
| 15884 | 411 | purple_request_field_string_set_masked(f, TRUE); |
| 412 | purple_request_field_group_add_field(g, f); | |
| 413 | purple_request_fields_add_group(fields, g); | |
| 8849 | 414 | |
| 15884 | 415 | g = purple_request_field_group_new(NULL); |
| 416 | f = purple_request_field_label_new("l1", _("Channel Public Keys List")); | |
| 417 | purple_request_field_group_add_field(g, f); | |
| 418 | purple_request_fields_add_group(fields, g); | |
| 8849 | 419 | |
|
39492
83e50cb13644
Remove unnecessary g_snprintf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39491
diff
changeset
|
420 | t = _("Channel authentication is used to secure the channel from " |
|
83e50cb13644
Remove unnecessary g_snprintf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39491
diff
changeset
|
421 | "unauthorized access. The authentication may be based on " |
|
83e50cb13644
Remove unnecessary g_snprintf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39491
diff
changeset
|
422 | "passphrase and digital signatures. If passphrase is set, it " |
|
83e50cb13644
Remove unnecessary g_snprintf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39491
diff
changeset
|
423 | "is required to be able to join. If channel public keys are set " |
|
83e50cb13644
Remove unnecessary g_snprintf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39491
diff
changeset
|
424 | "then only users whose public keys are listed are able to join."); |
| 8849 | 425 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
426 | if (!channel_pubkeys || !silc_dlist_count(channel_pubkeys)) { |
| 15884 | 427 | f = purple_request_field_list_new("list", NULL); |
| 428 | purple_request_field_group_add_field(g, f); | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
429 | purple_request_fields(sg->gc, _("Channel Authentication"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
430 | _("Channel Authentication"), t, fields, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
431 | _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
432 | _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
433 | purple_request_cpar_from_connection(sg->gc), sgc); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
434 | if (channel_pubkeys) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
435 | silc_dlist_uninit(channel_pubkeys); |
| 8849 | 436 | return; |
| 437 | } | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
438 | sgc->pubkeys = channel_pubkeys; |
| 8849 | 439 | |
| 15884 | 440 | g = purple_request_field_group_new(NULL); |
| 441 | f = purple_request_field_list_new("list", NULL); | |
| 442 | purple_request_field_group_add_field(g, f); | |
| 443 | purple_request_fields_add_group(fields, g); | |
| 8849 | 444 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
445 | silc_dlist_start(channel_pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
446 | while ((public_key = silc_dlist_get(channel_pubkeys))) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
447 | pk = silc_pkcs_public_key_encode(public_key, &pk_len); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
448 | if (!pk) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
449 | continue; |
| 8849 | 450 | fingerprint = silc_hash_fingerprint(NULL, pk + 4, pk_len - 4); |
| 451 | babbleprint = silc_hash_babbleprint(NULL, pk + 4, pk_len - 4); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
452 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
453 | silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
454 | ident = &silc_pubkey->identifier; |
| 8849 | 455 | |
| 456 | g_snprintf(tmp2, sizeof(tmp2), "%s\n %s\n %s", | |
| 457 | ident->realname ? ident->realname : ident->username ? | |
| 458 | ident->username : "", fingerprint, babbleprint); | |
|
24900
a19d983918c2
Deprecate purple_request_field_list_add()
Richard Laager <rlaager@pidgin.im>
parents:
23295
diff
changeset
|
459 | purple_request_field_list_add_icon(f, tmp2, NULL, public_key); |
| 8849 | 460 | |
| 461 | silc_free(fingerprint); | |
| 462 | silc_free(babbleprint); | |
| 463 | } | |
| 464 | ||
| 15884 | 465 | purple_request_field_list_set_multi_select(f, FALSE); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
466 | purple_request_fields(sg->gc, _("Channel Authentication"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
467 | _("Channel Authentication"), t, fields, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
468 | _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
469 | _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
470 | purple_request_cpar_from_connection(sg->gc), sgc); |
| 8849 | 471 | } |
| 472 | ||
| 473 | static void | |
| 15884 | 474 | silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) |
| 8849 | 475 | { |
| 15884 | 476 | PurpleChat *chat; |
| 477 | PurpleConnection *gc; | |
| 478 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
479 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
480 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
481 | |
| 15884 | 482 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
483 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
484 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
485 | |
| 8849 | 486 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
487 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 488 | "+C", NULL); |
| 489 | } | |
| 490 | ||
| 491 | ||
| 492 | /************************** Channel Private Groups **************************/ | |
| 493 | ||
| 494 | /* Private groups are "virtual" channels. They are groups inside a channel. | |
| 495 | This is implemented by using channel private keys. By knowing a channel | |
| 496 | private key user becomes part of that group and is able to talk on that | |
| 497 | group. Other users, on the same channel, won't be able to see the | |
| 498 | messages of that group. It is possible to have multiple groups inside | |
| 499 | a channel - and thus having multiple private keys on the channel. */ | |
| 500 | ||
| 501 | typedef struct { | |
| 15884 | 502 | SilcPurple sg; |
| 503 | PurpleChat *c; | |
| 8849 | 504 | const char *channel; |
| 15884 | 505 | } *SilcPurpleCharPrv; |
| 8849 | 506 | |
| 507 | static void | |
| 15884 | 508 | silcpurple_chat_prv_add(SilcPurpleCharPrv p, PurpleRequestFields *fields) |
| 8849 | 509 | { |
| 15884 | 510 | SilcPurple sg = p->sg; |
|
39491
0dfac00d800e
Replace g_snprintf+g_strdup by g_strdup_printf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
511 | gchar *tmp; |
| 15884 | 512 | PurpleRequestField *f; |
| 8849 | 513 | const char *name, *passphrase, *alias; |
| 514 | GHashTable *comp; | |
| 15884 | 515 | PurpleGroup *g; |
| 516 | PurpleChat *cn; | |
| 8849 | 517 | |
| 15884 | 518 | f = purple_request_fields_get_field(fields, "name"); |
| 519 | name = purple_request_field_string_get_value(f); | |
| 8849 | 520 | if (!name) { |
| 521 | silc_free(p); | |
| 522 | return; | |
| 523 | } | |
| 15884 | 524 | f = purple_request_fields_get_field(fields, "passphrase"); |
| 525 | passphrase = purple_request_field_string_get_value(f); | |
| 526 | f = purple_request_fields_get_field(fields, "alias"); | |
| 527 | alias = purple_request_field_string_get_value(f); | |
| 8849 | 528 | |
| 529 | /* Add private group to buddy list */ | |
|
39491
0dfac00d800e
Replace g_snprintf+g_strdup by g_strdup_printf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
530 | tmp = g_strdup_printf("%s [Private Group]", name); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
531 | comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
|
39491
0dfac00d800e
Replace g_snprintf+g_strdup by g_strdup_printf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
532 | g_hash_table_replace(comp, "channel", tmp); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
533 | g_hash_table_replace(comp, "passphrase", g_strdup(passphrase)); |
| 8849 | 534 | |
| 15884 | 535 | cn = purple_chat_new(sg->account, alias, comp); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
536 | g = purple_chat_get_group(p->c); |
| 15884 | 537 | purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); |
| 8849 | 538 | |
| 539 | /* Associate to a real channel */ | |
| 15884 | 540 | purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel); |
| 8849 | 541 | |
| 542 | /* Join the group */ | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
543 | silcpurple_chat_join(NULL, sg->gc, comp); |
| 8849 | 544 | |
| 545 | silc_free(p); | |
| 546 | } | |
| 547 | ||
| 548 | static void | |
| 15884 | 549 | silcpurple_chat_prv_cancel(SilcPurpleCharPrv p, PurpleRequestFields *fields) |
| 8849 | 550 | { |
| 551 | silc_free(p); | |
| 552 | } | |
| 553 | ||
| 554 | static void | |
| 15884 | 555 | silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) |
| 8849 | 556 | { |
| 15884 | 557 | PurpleChat *chat; |
| 558 | PurpleConnection *gc; | |
| 559 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
560 | |
| 15884 | 561 | SilcPurpleCharPrv p; |
| 562 | PurpleRequestFields *fields; | |
| 563 | PurpleRequestFieldGroup *g; | |
| 564 | PurpleRequestField *f; | |
| 8849 | 565 | char tmp[512]; |
| 566 | ||
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
567 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
568 | |
| 15884 | 569 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
570 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
571 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
572 | |
| 8849 | 573 | p = silc_calloc(1, sizeof(*p)); |
| 574 | if (!p) | |
| 575 | return; | |
| 576 | p->sg = sg; | |
| 577 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
578 | p->channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); |
| 15884 | 579 | p->c = purple_blist_find_chat(sg->account, p->channel); |
| 8849 | 580 | |
| 15884 | 581 | fields = purple_request_fields_new(); |
| 8849 | 582 | |
| 15884 | 583 | g = purple_request_field_group_new(NULL); |
| 584 | f = purple_request_field_string_new("name", _("Group Name"), | |
| 8849 | 585 | NULL, FALSE); |
| 15884 | 586 | purple_request_field_group_add_field(g, f); |
| 8849 | 587 | |
| 15884 | 588 | f = purple_request_field_string_new("passphrase", _("Passphrase"), |
| 8849 | 589 | NULL, FALSE); |
| 15884 | 590 | purple_request_field_string_set_masked(f, TRUE); |
| 591 | purple_request_field_group_add_field(g, f); | |
| 8849 | 592 | |
| 15884 | 593 | f = purple_request_field_string_new("alias", _("Alias"), |
| 8849 | 594 | NULL, FALSE); |
| 15884 | 595 | purple_request_field_group_add_field(g, f); |
| 596 | purple_request_fields_add_group(fields, g); | |
| 8849 | 597 | |
| 598 | g_snprintf(tmp, sizeof(tmp), | |
| 599 | _("Please enter the %s channel private group name and passphrase."), | |
| 600 | p->channel); | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
601 | purple_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
602 | _("Add"), G_CALLBACK(silcpurple_chat_prv_add), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
603 | _("Cancel"), G_CALLBACK(silcpurple_chat_prv_cancel), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
604 | purple_request_cpar_from_connection(gc), p); |
| 8849 | 605 | } |
| 606 | ||
| 607 | ||
| 608 | /****************************** Channel Modes ********************************/ | |
| 609 | ||
| 610 | static void | |
| 15884 | 611 | silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) |
| 8849 | 612 | { |
| 15884 | 613 | PurpleChat *chat; |
| 614 | PurpleConnection *gc; | |
| 615 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
616 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
617 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
618 | |
| 15884 | 619 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
620 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
621 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
622 | |
| 8849 | 623 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
624 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 625 | "-f", NULL); |
| 626 | } | |
| 627 | ||
| 628 | static void | |
| 15884 | 629 | silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) |
| 8849 | 630 | { |
| 15884 | 631 | PurpleChat *chat; |
| 632 | PurpleConnection *gc; | |
| 633 | SilcPurple sg; | |
| 8849 | 634 | const char *channel; |
| 635 | ||
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
636 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
637 | |
| 15884 | 638 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
639 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
640 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
641 | |
| 8849 | 642 | if (!sg->conn) |
| 643 | return; | |
| 644 | ||
| 645 | /* XXX we should have ability to define which founder | |
| 646 | key to use. Now we use the user's own public key | |
| 647 | (default key). */ | |
| 648 | ||
| 649 | /* Call CMODE */ | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
650 | channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); |
| 8849 | 651 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, |
| 652 | "+f", NULL); | |
| 653 | } | |
| 654 | ||
| 655 | static void | |
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
656 | silcpurple_chat_ulimit_cb(PurpleKeyValuePair *s, const char *limit) |
| 8849 | 657 | { |
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
658 | SilcPurple sg = s->value; |
| 8849 | 659 | SilcChannelEntry channel; |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
660 | guint ulimit = 0; |
| 8849 | 661 | |
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
662 | channel = silc_client_get_channel(sg->client, sg->conn, s->key); |
| 8849 | 663 | if (!channel) |
| 664 | return; | |
| 665 | if (limit) | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
666 | ulimit = strtoul(limit, NULL, 10); |
| 8849 | 667 | |
| 668 | if (!limit || !(*limit) || *limit == '0') { | |
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
669 | if (!limit || ulimit != channel->user_limit) { |
|
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
670 | silc_client_command_call(sg->client, sg->conn, NULL, |
|
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
671 | "CMODE", s->key, "-l", NULL); |
| 8849 | 672 | } |
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
673 | } else if (ulimit != channel->user_limit) { |
|
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
674 | /* Call CMODE */ |
|
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
675 | silc_client_command_call(sg->client, sg->conn, NULL, |
|
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
676 | "CMODE", s->key, "+l", limit, NULL); |
| 8849 | 677 | } |
| 678 | ||
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
679 | purple_key_value_pair_free(s); |
| 8849 | 680 | } |
| 681 | ||
| 682 | static void | |
| 15884 | 683 | silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) |
| 8849 | 684 | { |
| 15884 | 685 | PurpleChat *chat; |
| 686 | PurpleConnection *gc; | |
| 687 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
688 | |
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
689 | PurpleKeyValuePair *s; |
| 8849 | 690 | SilcChannelEntry channel; |
|
23002
a2c1f33b5bc4
g_strdup'ed strings aren't const char*. This fixes a couple of compile
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22972
diff
changeset
|
691 | char *ch; |
| 8849 | 692 | char tmp[32]; |
| 693 | ||
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
694 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
695 | |
| 15884 | 696 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
697 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
698 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
699 | |
| 8849 | 700 | if (!sg->conn) |
| 701 | return; | |
| 702 | ||
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
703 | ch = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); |
|
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
704 | channel = silc_client_get_channel(sg->client, sg->conn, ch); |
| 8849 | 705 | if (!channel) |
| 706 | return; | |
| 707 | ||
|
40788
f435aea25461
Replace SilcPurpleChatInput with PurpleKeyValuePair
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40769
diff
changeset
|
708 | s = purple_key_value_pair_new(ch, sg); |
| 8849 | 709 | g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
710 | purple_request_input(gc, _("User Limit"), NULL, |
| 8849 | 711 | _("Set user limit on channel. Set to zero to reset user limit."), |
| 712 | tmp, FALSE, FALSE, NULL, | |
| 15884 | 713 | _("OK"), G_CALLBACK(silcpurple_chat_ulimit_cb), |
|
16492
4f0dc2d16e55
Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
714 | _("Cancel"), G_CALLBACK(silcpurple_chat_ulimit_cb), |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
715 | purple_request_cpar_from_connection(gc), s); |
| 8849 | 716 | } |
| 717 | ||
| 718 | static void | |
| 15884 | 719 | silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) |
| 8849 | 720 | { |
| 15884 | 721 | PurpleChat *chat; |
| 722 | PurpleConnection *gc; | |
| 723 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
724 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
725 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
726 | |
| 15884 | 727 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
728 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
729 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
730 | |
| 8849 | 731 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
732 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 733 | "-t", NULL); |
| 734 | } | |
| 735 | ||
| 736 | static void | |
| 15884 | 737 | silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) |
| 8849 | 738 | { |
| 15884 | 739 | PurpleChat *chat; |
| 740 | PurpleConnection *gc; | |
| 741 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
742 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
743 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
744 | |
| 15884 | 745 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
746 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
747 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
748 | |
| 8849 | 749 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
750 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 751 | "+t", NULL); |
| 752 | } | |
| 753 | ||
| 754 | static void | |
| 15884 | 755 | silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) |
| 8849 | 756 | { |
| 15884 | 757 | PurpleChat *chat; |
| 758 | PurpleConnection *gc; | |
| 759 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
760 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
761 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
762 | |
| 15884 | 763 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
764 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
765 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
766 | |
| 8849 | 767 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
768 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 769 | "-p", NULL); |
| 770 | } | |
| 771 | ||
| 772 | static void | |
| 15884 | 773 | silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) |
| 8849 | 774 | { |
| 15884 | 775 | PurpleChat *chat; |
| 776 | PurpleConnection *gc; | |
| 777 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
778 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
779 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
780 | |
| 15884 | 781 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
782 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
783 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
784 | |
| 8849 | 785 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
786 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 787 | "+p", NULL); |
| 788 | } | |
| 789 | ||
| 790 | static void | |
| 15884 | 791 | silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) |
| 8849 | 792 | { |
| 15884 | 793 | PurpleChat *chat; |
| 794 | PurpleConnection *gc; | |
| 795 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
796 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
797 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
798 | |
| 15884 | 799 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
800 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
801 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
802 | |
| 8849 | 803 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
804 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 805 | "-s", NULL); |
| 806 | } | |
| 807 | ||
| 808 | static void | |
| 15884 | 809 | silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) |
| 8849 | 810 | { |
| 15884 | 811 | PurpleChat *chat; |
| 812 | PurpleConnection *gc; | |
| 813 | SilcPurple sg; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
814 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
815 | g_return_if_fail(PURPLE_IS_CHAT(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
816 | |
| 15884 | 817 | chat = (PurpleChat *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
818 | gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
819 | sg = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
820 | |
| 8849 | 821 | silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
822 | g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
| 8849 | 823 | "+s", NULL); |
| 824 | } | |
| 825 | ||
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
826 | typedef struct { |
| 15884 | 827 | SilcPurple sg; |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
828 | SilcChannelEntry channel; |
| 15884 | 829 | } *SilcPurpleChatWb; |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
830 | |
|
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
831 | static void |
| 15884 | 832 | silcpurple_chat_wb(PurpleBlistNode *node, gpointer data) |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
833 | { |
| 15884 | 834 | SilcPurpleChatWb wb = data; |
| 835 | silcpurple_wb_init_ch(wb->sg, wb->channel); | |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
836 | silc_free(wb); |
|
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
837 | } |
|
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
838 | |
| 15884 | 839 | GList *silcpurple_chat_menu(PurpleChat *chat) |
| 8849 | 840 | { |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
841 | GHashTable *components = purple_chat_get_components(chat); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23295
diff
changeset
|
842 | PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
843 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 844 | SilcClientConnection conn = sg->conn; |
| 845 | const char *chname = NULL; | |
| 846 | SilcChannelEntry channel = NULL; | |
| 847 | SilcChannelUser chu = NULL; | |
| 848 | SilcUInt32 mode = 0; | |
| 849 | ||
| 9038 | 850 | GList *m = NULL; |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
38854
diff
changeset
|
851 | PurpleActionMenu *act; |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
852 | |
| 8849 | 853 | if (components) |
| 854 | chname = g_hash_table_lookup(components, "channel"); | |
|
31798
f615f176ce58
silc: Avoid calling strstr(NULL, ...) if chname isn't set.
Paul Aurich <darkrain42@pidgin.im>
parents:
30708
diff
changeset
|
855 | if (!chname) |
|
f615f176ce58
silc: Avoid calling strstr(NULL, ...) if chname isn't set.
Paul Aurich <darkrain42@pidgin.im>
parents:
30708
diff
changeset
|
856 | return NULL; |
|
f615f176ce58
silc: Avoid calling strstr(NULL, ...) if chname isn't set.
Paul Aurich <darkrain42@pidgin.im>
parents:
30708
diff
changeset
|
857 | channel = silc_client_get_channel(sg->client, sg->conn, |
|
f615f176ce58
silc: Avoid calling strstr(NULL, ...) if chname isn't set.
Paul Aurich <darkrain42@pidgin.im>
parents:
30708
diff
changeset
|
858 | (char *)chname); |
| 8849 | 859 | if (channel) { |
| 860 | chu = silc_client_on_channel(channel, conn->local_entry); | |
| 861 | if (chu) | |
| 862 | mode = chu->mode; | |
| 863 | } | |
| 864 | ||
| 865 | if (strstr(chname, "[Private Group]")) | |
| 866 | return NULL; | |
| 867 | ||
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
868 | act = purple_action_menu_new(_("Get Info"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
869 | G_CALLBACK(silcpurple_chat_getinfo_menu), |
| 12919 | 870 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
871 | m = g_list_append(m, act); |
| 8849 | 872 | |
| 873 | if (chu) { | |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
874 | act = purple_action_menu_new(_("Add Private Group"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
875 | G_CALLBACK(silcpurple_chat_prv), |
| 12919 | 876 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
877 | m = g_list_append(m, act); |
| 8849 | 878 | } |
| 879 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
880 | if (chu && mode & SILC_CHANNEL_UMODE_CHANFO) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
881 | act = purple_action_menu_new(_("Channel Authentication"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
882 | G_CALLBACK(silcpurple_chat_chauth), |
| 12919 | 883 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
884 | m = g_list_append(m, act); |
| 8849 | 885 | |
| 886 | if (channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) { | |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
887 | act = purple_action_menu_new(_("Reset Permanent"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
888 | G_CALLBACK(silcpurple_chat_permanent_reset), |
| 12919 | 889 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
890 | m = g_list_append(m, act); |
| 8849 | 891 | } else { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
892 | act = purple_action_menu_new(_("Set Permanent"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
893 | G_CALLBACK(silcpurple_chat_permanent), |
| 12919 | 894 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
895 | m = g_list_append(m, act); |
| 8849 | 896 | } |
| 897 | } | |
| 898 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
899 | if (chu && mode & SILC_CHANNEL_UMODE_CHANOP) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
900 | act = purple_action_menu_new(_("Set User Limit"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
901 | G_CALLBACK(silcpurple_chat_ulimit), |
| 12919 | 902 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
903 | m = g_list_append(m, act); |
| 8849 | 904 | |
| 905 | if (channel->mode & SILC_CHANNEL_MODE_TOPIC) { | |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
906 | act = purple_action_menu_new(_("Reset Topic Restriction"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
907 | G_CALLBACK(silcpurple_chat_resettopic), |
| 12919 | 908 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
909 | m = g_list_append(m, act); |
| 8849 | 910 | } else { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
911 | act = purple_action_menu_new(_("Set Topic Restriction"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
912 | G_CALLBACK(silcpurple_chat_settopic), |
| 12919 | 913 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
914 | m = g_list_append(m, act); |
| 8849 | 915 | } |
| 916 | ||
| 917 | if (channel->mode & SILC_CHANNEL_MODE_PRIVATE) { | |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
918 | act = purple_action_menu_new(_("Reset Private Channel"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
919 | G_CALLBACK(silcpurple_chat_resetprivate), |
| 12919 | 920 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
921 | m = g_list_append(m, act); |
| 8849 | 922 | } else { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
923 | act = purple_action_menu_new(_("Set Private Channel"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
924 | G_CALLBACK(silcpurple_chat_setprivate), |
| 12919 | 925 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
926 | m = g_list_append(m, act); |
| 8849 | 927 | } |
| 928 | ||
| 929 | if (channel->mode & SILC_CHANNEL_MODE_SECRET) { | |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
930 | act = purple_action_menu_new(_("Reset Secret Channel"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
931 | G_CALLBACK(silcpurple_chat_resetsecret), |
| 12919 | 932 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
933 | m = g_list_append(m, act); |
| 8849 | 934 | } else { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
935 | act = purple_action_menu_new(_("Set Secret Channel"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
936 | G_CALLBACK(silcpurple_chat_setsecret), |
| 12919 | 937 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
8891
diff
changeset
|
938 | m = g_list_append(m, act); |
| 8849 | 939 | } |
| 940 | } | |
| 941 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
942 | if (chu && channel) { |
| 15884 | 943 | SilcPurpleChatWb wb; |
| 12919 | 944 | wb = silc_calloc(1, sizeof(*wb)); |
| 945 | wb->sg = sg; | |
| 946 | wb->channel = channel; | |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
947 | act = purple_action_menu_new(_("Draw On Whiteboard"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41028
diff
changeset
|
948 | G_CALLBACK(silcpurple_chat_wb), |
| 12919 | 949 | (void *)wb, NULL); |
| 950 | m = g_list_append(m, act); | |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
951 | } |
|
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11454
diff
changeset
|
952 | |
| 8849 | 953 | return m; |
| 954 | } | |
| 955 | ||
| 956 | ||
| 957 | /******************************* Joining Etc. ********************************/ | |
| 958 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
959 | char *silcpurple_get_chat_name(PurpleProtocolChat *protocol_chat, GHashTable *data) |
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
960 | { |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
961 | return g_strdup(g_hash_table_lookup(data, "channel")); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
962 | } |
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
963 | |
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
964 | void silcpurple_chat_join(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, GHashTable *data) |
| 8849 | 965 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
966 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 967 | SilcClient client = sg->client; |
| 968 | SilcClientConnection conn = sg->conn; | |
| 969 | const char *channel, *passphrase, *parentch; | |
| 970 | ||
| 971 | if (!conn) | |
| 972 | return; | |
| 973 | ||
| 974 | channel = g_hash_table_lookup(data, "channel"); | |
| 975 | passphrase = g_hash_table_lookup(data, "passphrase"); | |
| 976 | ||
| 977 | /* Check if we are joining a private group. Handle it | |
| 978 | purely locally as it's not a real channel */ | |
| 979 | if (strstr(channel, "[Private Group]")) { | |
| 980 | SilcChannelEntry channel_entry; | |
| 981 | SilcChannelPrivateKey key; | |
| 15884 | 982 | PurpleChat *c; |
| 983 | SilcPurplePrvgrp grp; | |
| 8849 | 984 | |
| 15884 | 985 | c = purple_blist_find_chat(sg->account, channel); |
| 986 | parentch = purple_blist_node_get_string((PurpleBlistNode *)c, "parentch"); | |
| 8849 | 987 | if (!parentch) |
| 988 | return; | |
| 989 | ||
| 990 | channel_entry = silc_client_get_channel(sg->client, sg->conn, | |
| 991 | (char *)parentch); | |
| 992 | if (!channel_entry || | |
| 993 | !silc_client_on_channel(channel_entry, sg->conn->local_entry)) { | |
| 994 | char tmp[512]; | |
| 995 | g_snprintf(tmp, sizeof(tmp), | |
| 996 | _("You have to join the %s channel before you are " | |
| 997 | "able to join the private group"), parentch); | |
| 15884 | 998 | purple_notify_error(gc, _("Join Private Group"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
999 | _("Cannot join private group"), tmp, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1000 | purple_request_cpar_from_connection(gc)); |
| 8849 | 1001 | return; |
| 1002 | } | |
| 1003 | ||
| 1004 | /* Add channel private key */ | |
| 1005 | if (!silc_client_add_channel_private_key(client, conn, | |
| 1006 | channel_entry, channel, | |
| 1007 | NULL, NULL, | |
| 1008 | (unsigned char *)passphrase, | |
| 1009 | strlen(passphrase), &key)) | |
| 1010 | return; | |
| 1011 | ||
| 1012 | /* Join the group */ | |
| 1013 | grp = silc_calloc(1, sizeof(*grp)); | |
| 1014 | if (!grp) | |
| 1015 | return; | |
| 15884 | 1016 | grp->id = ++sg->channel_ids + SILCPURPLE_PRVGRP; |
| 8849 | 1017 | grp->chid = SILC_PTR_TO_32(channel_entry->context); |
| 1018 | grp->parentch = parentch; | |
| 1019 | grp->channel = channel; | |
| 1020 | grp->key = key; | |
| 1021 | sg->grps = g_list_append(sg->grps, grp); | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1022 | purple_serv_got_joined_chat(gc, grp->id, channel); |
| 8849 | 1023 | return; |
| 1024 | } | |
| 1025 | ||
| 1026 | /* XXX We should have other properties here as well: | |
| 1027 | 1. whether to try to authenticate to the channel | |
| 1028 | 1a. with default key, | |
| 1029 | 1b. with specific key. | |
| 1030 | 2. whether to try to authenticate to become founder. | |
| 1031 | 2a. with default key, | |
| 1032 | 2b. with specific key. | |
| 1033 | ||
| 1034 | Since now such variety is not possible in the join dialog | |
| 1035 | we always use -founder and -auth options, which try to | |
| 1036 | do both 1 and 2 with default keys. */ | |
| 1037 | ||
| 1038 | /* Call JOIN */ | |
|
9172
2e04033bc831
[gaim-migrate @ 9957]
Mark Doliner <markdoliner@pidgin.im>
parents:
9168
diff
changeset
|
1039 | if ((passphrase != NULL) && (*passphrase != '\0')) |
| 8849 | 1040 | silc_client_command_call(client, conn, NULL, "JOIN", |
| 1041 | channel, passphrase, "-auth", "-founder", NULL); | |
| 1042 | else | |
| 1043 | silc_client_command_call(client, conn, NULL, "JOIN", | |
| 1044 | channel, "-auth", "-founder", NULL); | |
| 1045 | } | |
| 1046 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
1047 | void silcpurple_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id, const char *msg, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1048 | const char *name) |
| 8849 | 1049 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
1050 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1051 | SilcClient client = sg->client; |
| 1052 | SilcClientConnection conn = sg->conn; | |
| 1053 | SilcHashTableList htl; | |
| 1054 | SilcChannelUser chu; | |
| 1055 | gboolean found = FALSE; | |
| 1056 | ||
| 1057 | if (!conn) | |
| 1058 | return; | |
| 1059 | ||
| 1060 | /* See if we are inviting on a private group. Invite | |
| 1061 | to the actual channel */ | |
| 15884 | 1062 | if (id > SILCPURPLE_PRVGRP) { |
| 8849 | 1063 | GList *l; |
| 15884 | 1064 | SilcPurplePrvgrp prv; |
| 8849 | 1065 | |
| 1066 | for (l = sg->grps; l; l = l->next) | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1067 | if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) |
| 8849 | 1068 | break; |
| 1069 | if (!l) | |
| 1070 | return; | |
| 1071 | prv = l->data; | |
| 1072 | id = prv->chid; | |
| 1073 | } | |
| 1074 | ||
| 1075 | /* Find channel by id */ | |
| 1076 | silc_hash_table_list(conn->local_entry->channels, &htl); | |
| 1077 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1078 | if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { |
| 8849 | 1079 | found = TRUE; |
| 1080 | break; | |
| 1081 | } | |
| 1082 | } | |
| 1083 | silc_hash_table_list_reset(&htl); | |
| 1084 | if (!found) | |
| 1085 | return; | |
| 1086 | ||
| 1087 | /* Call INVITE */ | |
| 1088 | silc_client_command_call(client, conn, NULL, "INVITE", | |
| 1089 | chu->channel->channel_name, | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1090 | name, NULL); |
| 8849 | 1091 | } |
| 1092 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
1093 | void silcpurple_chat_leave(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id) |
| 8849 | 1094 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
1095 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1096 | SilcClient client = sg->client; |
| 1097 | SilcClientConnection conn = sg->conn; | |
| 1098 | SilcHashTableList htl; | |
| 1099 | SilcChannelUser chu; | |
| 1100 | gboolean found = FALSE; | |
| 1101 | GList *l; | |
| 15884 | 1102 | SilcPurplePrvgrp prv; |
| 8849 | 1103 | |
| 1104 | if (!conn) | |
| 1105 | return; | |
| 1106 | ||
| 1107 | /* See if we are leaving a private group */ | |
| 15884 | 1108 | if (id > SILCPURPLE_PRVGRP) { |
| 8849 | 1109 | SilcChannelEntry channel; |
| 1110 | ||
| 1111 | for (l = sg->grps; l; l = l->next) | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1112 | if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) |
| 8849 | 1113 | break; |
| 1114 | if (!l) | |
| 1115 | return; | |
| 1116 | prv = l->data; | |
| 1117 | channel = silc_client_get_channel(sg->client, sg->conn, | |
| 1118 | (char *)prv->parentch); | |
| 1119 | if (!channel) | |
| 1120 | return; | |
| 1121 | silc_client_del_channel_private_key(client, conn, | |
| 1122 | channel, prv->key); | |
| 1123 | silc_free(prv); | |
|
40079
a37a1e349491
Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39493
diff
changeset
|
1124 | sg->grps = g_list_delete_link(sg->grps, l); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1125 | purple_serv_got_chat_left(gc, id); |
| 8849 | 1126 | return; |
| 1127 | } | |
| 1128 | ||
| 1129 | /* Find channel by id */ | |
| 1130 | silc_hash_table_list(conn->local_entry->channels, &htl); | |
| 1131 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1132 | if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { |
| 8849 | 1133 | found = TRUE; |
| 1134 | break; | |
| 1135 | } | |
| 1136 | } | |
| 1137 | silc_hash_table_list_reset(&htl); | |
| 1138 | if (!found) | |
| 1139 | return; | |
| 1140 | ||
| 1141 | /* Call LEAVE */ | |
| 1142 | silc_client_command_call(client, conn, NULL, "LEAVE", | |
| 1143 | chu->channel->channel_name, NULL); | |
| 1144 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1145 | purple_serv_got_chat_left(gc, id); |
| 8849 | 1146 | |
| 1147 | /* Leave from private groups on this channel as well */ | |
| 1148 | for (l = sg->grps; l; l = l->next) | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1149 | if (((SilcPurplePrvgrp)l->data)->chid == (gulong)id) { |
| 8849 | 1150 | prv = l->data; |
| 1151 | silc_client_del_channel_private_key(client, conn, | |
| 1152 | chu->channel, | |
| 1153 | prv->key); | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1154 | purple_serv_got_chat_left(gc, prv->id); |
| 8849 | 1155 | silc_free(prv); |
|
40079
a37a1e349491
Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39493
diff
changeset
|
1156 | sg->grps = g_list_delete_link(sg->grps, l); |
| 8849 | 1157 | if (!sg->grps) |
| 1158 | break; | |
| 1159 | } | |
| 1160 | } | |
| 1161 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
1162 | int silcpurple_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id, PurpleMessage *pmsg) |
| 8849 | 1163 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
1164 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1165 | SilcClient client = sg->client; |
| 1166 | SilcClientConnection conn = sg->conn; | |
| 1167 | SilcHashTableList htl; | |
| 1168 | SilcChannelUser chu; | |
| 1169 | SilcChannelEntry channel = NULL; | |
| 1170 | SilcChannelPrivateKey key = NULL; | |
|
33798
ab26d8e3da97
silc: Use appropriate datatype for SilcMessageFlags
Daniel Atallah <datallah@pidgin.im>
parents:
31798
diff
changeset
|
1171 | SilcMessageFlags flags; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1172 | int ret = 0; |
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35681
diff
changeset
|
1173 | const gchar *msg = purple_message_get_contents(pmsg); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1174 | char *msg2, *tmp; |
| 8849 | 1175 | gboolean found = FALSE; |
| 15884 | 1176 | gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1177 | SilcDList list; |
|
36077
b7328f4317c7
Switch purple_serv_chat_send to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35681
diff
changeset
|
1178 | PurpleMessageFlags msgflags = purple_message_get_flags(pmsg); |
| 8849 | 1179 | |
| 1180 | if (!msg || !conn) | |
| 1181 | return 0; | |
| 1182 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1183 | flags = SILC_MESSAGE_FLAG_UTF8; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1184 | |
| 15884 | 1185 | tmp = msg2 = purple_unescape_html(msg); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1186 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1187 | if (!g_ascii_strncasecmp(msg2, "/me ", 4)) |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1188 | { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1189 | msg2 += 4; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1190 | if (!*msg2) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1191 | g_free(tmp); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1192 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1193 | } |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1194 | flags |= SILC_MESSAGE_FLAG_ACTION; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1195 | } else if (strlen(msg) > 1 && msg[0] == '/') { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1196 | if (!silc_client_command_call(client, conn, msg + 1)) { |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1197 | purple_notify_error(gc, _("Call Command"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1198 | _("Cannot call command"), _("Unknown command"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1199 | purple_request_cpar_from_connection(gc)); |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
1200 | } |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1201 | g_free(tmp); |
| 8849 | 1202 | return 0; |
| 1203 | } | |
| 1204 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1205 | |
| 8849 | 1206 | if (sign) |
| 1207 | flags |= SILC_MESSAGE_FLAG_SIGNED; | |
| 1208 | ||
| 1209 | /* Get the channel private key if we are sending on | |
| 1210 | private group */ | |
| 15884 | 1211 | if (id > SILCPURPLE_PRVGRP) { |
| 8849 | 1212 | GList *l; |
| 15884 | 1213 | SilcPurplePrvgrp prv; |
| 8849 | 1214 | |
| 1215 | for (l = sg->grps; l; l = l->next) | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1216 | if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) |
| 8849 | 1217 | break; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1218 | if (!l) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1219 | g_free(tmp); |
| 8849 | 1220 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1221 | } |
| 8849 | 1222 | prv = l->data; |
| 1223 | channel = silc_client_get_channel(sg->client, sg->conn, | |
| 1224 | (char *)prv->parentch); | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1225 | if (!channel) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1226 | g_free(tmp); |
| 8849 | 1227 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1228 | } |
| 8849 | 1229 | key = prv->key; |
| 1230 | } | |
| 1231 | ||
| 1232 | if (!channel) { | |
| 1233 | /* Find channel by id */ | |
| 1234 | silc_hash_table_list(conn->local_entry->channels, &htl); | |
| 1235 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1236 | if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { |
| 8849 | 1237 | found = TRUE; |
| 1238 | break; | |
| 1239 | } | |
| 1240 | } | |
| 1241 | silc_hash_table_list_reset(&htl); | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1242 | if (!found) { |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1243 | g_free(tmp); |
| 8849 | 1244 | return 0; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1245 | } |
| 8849 | 1246 | channel = chu->channel; |
| 1247 | } | |
| 1248 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1249 | /* Check for images */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1250 | if (msgflags & PURPLE_MESSAGE_IMAGES) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1251 | list = silcpurple_image_message(msg, &flags); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1252 | if (list) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1253 | /* Send one or more MIME message. If more than one, they |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1254 | are MIME fragments due to over large message */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1255 | SilcBuffer buf; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1256 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1257 | silc_dlist_start(list); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1258 | while ((buf = silc_dlist_get(list)) != SILC_LIST_END) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1259 | ret = |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1260 | silc_client_send_channel_message(client, conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1261 | channel, key, |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
1262 | flags, sg->sha1hash, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1263 | buf->data, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1264 | silc_buffer_len(buf)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1265 | silc_mime_partial_free(list); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1266 | g_free(tmp); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1267 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1268 | if (ret) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1269 | purple_serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, time(NULL)); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1270 | return ret; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1271 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1272 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1273 | |
| 8849 | 1274 | /* Send channel message */ |
| 1275 | ret = silc_client_send_channel_message(client, conn, channel, key, | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
1276 | flags, sg->sha1hash, |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18190
diff
changeset
|
1277 | (unsigned char *)msg2, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
1278 | strlen(msg2)); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1279 | if (ret) { |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1280 | purple_serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, |
| 8849 | 1281 | time(NULL)); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
1282 | } |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12167
diff
changeset
|
1283 | g_free(tmp); |
| 8849 | 1284 | |
| 1285 | return ret; | |
| 1286 | } | |
| 1287 | ||
|
40769
2214cc7b95ca
Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40079
diff
changeset
|
1288 | void silcpurple_chat_set_topic(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id, const char *topic) |
| 8849 | 1289 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
1290 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1291 | SilcClient client = sg->client; |
| 1292 | SilcClientConnection conn = sg->conn; | |
| 1293 | SilcHashTableList htl; | |
| 1294 | SilcChannelUser chu; | |
| 1295 | gboolean found = FALSE; | |
| 1296 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9295
diff
changeset
|
1297 | if (!conn) |
| 8849 | 1298 | return; |
| 1299 | ||
| 1300 | /* See if setting topic on private group. Set it | |
| 1301 | on the actual channel */ | |
| 15884 | 1302 | if (id > SILCPURPLE_PRVGRP) { |
| 8849 | 1303 | GList *l; |
| 15884 | 1304 | SilcPurplePrvgrp prv; |
| 8849 | 1305 | |
| 1306 | for (l = sg->grps; l; l = l->next) | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1307 | if (((SilcPurplePrvgrp)l->data)->id == (gulong)id) |
| 8849 | 1308 | break; |
| 1309 | if (!l) | |
| 1310 | return; | |
| 1311 | prv = l->data; | |
| 1312 | id = prv->chid; | |
| 1313 | } | |
| 1314 | ||
| 1315 | /* Find channel by id */ | |
| 1316 | silc_hash_table_list(conn->local_entry->channels, &htl); | |
| 1317 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33798
diff
changeset
|
1318 | if (SILC_PTR_TO_32(chu->channel->context) == (gulong)id ) { |
| 8849 | 1319 | found = TRUE; |
| 1320 | break; | |
| 1321 | } | |
| 1322 | } | |
| 1323 | silc_hash_table_list_reset(&htl); | |
| 1324 | if (!found) | |
| 1325 | return; | |
| 1326 | ||
| 1327 | /* Call TOPIC */ | |
| 1328 | silc_client_command_call(client, conn, NULL, "TOPIC", | |
| 1329 | chu->channel->channel_name, topic, NULL); | |
| 1330 | } | |
| 1331 | ||
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40836
diff
changeset
|
1332 | PurpleRoomlist * |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40836
diff
changeset
|
1333 | silcpurple_roomlist_get_list(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40836
diff
changeset
|
1334 | PurpleConnection *gc) |
| 8849 | 1335 | { |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
1336 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1337 | SilcClient client = sg->client; |
| 1338 | SilcClientConnection conn = sg->conn; | |
| 1339 | ||
| 1340 | if (!conn) | |
| 1341 | return NULL; | |
| 1342 | ||
| 1343 | if (sg->roomlist) | |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1344 | g_object_unref(sg->roomlist); |
| 8849 | 1345 | |
|
30708
535bec1e66fb
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29304
diff
changeset
|
1346 | sg->roomlist_cancelled = FALSE; |
| 8849 | 1347 | |
| 15884 | 1348 | sg->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); |
| 8849 | 1349 | |
| 1350 | /* Call LIST */ | |
| 1351 | silc_client_command_call(client, conn, "LIST"); | |
| 1352 | ||
| 15884 | 1353 | purple_roomlist_set_in_progress(sg->roomlist, TRUE); |
| 8849 | 1354 | |
| 1355 | return sg->roomlist; | |
| 1356 | } | |
| 1357 | ||
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40836
diff
changeset
|
1358 | void |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40836
diff
changeset
|
1359 | silcpurple_roomlist_cancel(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40836
diff
changeset
|
1360 | PurpleRoomlist *list) |
| 8849 | 1361 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31798
diff
changeset
|
1362 | PurpleAccount *account = purple_roomlist_get_account(list); |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31798
diff
changeset
|
1363 | PurpleConnection *gc = purple_account_get_connection(account); |
| 15884 | 1364 | SilcPurple sg; |
| 8849 | 1365 | |
| 1366 | if (!gc) | |
| 1367 | return; | |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
1368 | sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1369 | |
| 15884 | 1370 | purple_roomlist_set_in_progress(list, FALSE); |
| 8849 | 1371 | if (sg->roomlist == list) { |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1372 | g_object_unref(sg->roomlist); |
| 8849 | 1373 | sg->roomlist = NULL; |
|
30708
535bec1e66fb
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29304
diff
changeset
|
1374 | sg->roomlist_cancelled = TRUE; |
| 8849 | 1375 | } |
| 1376 | } |