Mercurial > pidgin
annotate libpurple/protocols/silc/chat.c @ 28224:f4ab1c919546
I don't see why the Public IP entry needs to be different and use a Table
instead of an HBox.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 06 Sep 2009 00:57:23 +0000 |
parents | 16734635febf |
children | f1437342cc0e 5391094529c6 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 |
15822 | 3 silcpurple_chat.c |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 Author: Pekka Riikonen <priikone@silcnet.org> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
7 Copyright (C) 2004 - 2007 Pekka Riikonen |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 the Free Software Foundation; version 2 of the License. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
20 #include "silc.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 #include "silcclient.h" |
15822 | 22 #include "silcpurple.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "wb.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 /***************************** Channel Routines ******************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
15822 | 27 GList *silcpurple_chat_info(PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 GList *ci = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 struct proto_chat_entry *pce; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 pce->label = _("_Channel:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 pce->identifier = "channel"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 pce->required = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 ci = g_list_append(ci, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 pce->label = _("_Passphrase:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 pce->identifier = "passphrase"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 pce->secret = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 ci = g_list_append(ci, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 return ci; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
15822 | 47 GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 GHashTable *defaults; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 if (chat_name != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 return defaults; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 static void |
15822 | 60 silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 static void |
15822 | 63 silcpurple_chat_getinfo_res(SilcClient client, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
64 SilcClientConnection conn, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
65 SilcStatus status, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
66 SilcDList channels, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
67 void *context) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 GHashTable *components = context; |
15822 | 70 PurpleConnection *gc = client->application; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 const char *chname; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 char tmp[256]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 chname = g_hash_table_lookup(components, "channel"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 if (!chname) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 if (!channels) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 g_snprintf(tmp, sizeof(tmp), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 _("Channel %s does not exist in the network"), chname); |
15822 | 81 purple_notify_error(gc, _("Channel Information"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 _("Cannot get channel information"), tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 |
15822 | 86 silcpurple_chat_getinfo(gc, components); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 static void |
15822 | 91 silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 { |
15822 | 93 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 const char *chname; |
22824
67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
95 char tmp[256], *tmp2; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 GString *s; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 SilcChannelEntry channel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 SilcHashTableList htl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 SilcChannelUser chu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 if (!components) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 chname = g_hash_table_lookup(components, "channel"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 if (!chname) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 channel = silc_client_get_channel(sg->client, sg->conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 (char *)chname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 if (!channel) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 silc_client_get_channel_resolve(sg->client, sg->conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 (char *)chname, |
15822 | 112 silcpurple_chat_getinfo_res, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 components); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 s = g_string_new(""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 tmp2 = g_markup_escape_text(channel->channel_name, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 g_string_append_printf(s, _("<b>Channel Name:</b> %s"), tmp2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 g_free(tmp2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 if (channel->user_list && silc_hash_table_count(channel->user_list)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 g_string_append_printf(s, _("<br><b>User Count:</b> %d"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 (int)silc_hash_table_count(channel->user_list)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 silc_hash_table_list(channel->user_list, &htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 tmp2 = g_markup_escape_text(chu->client->nickname, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 g_string_append_printf(s, _("<br><b>Channel Founder:</b> %s"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 tmp2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 g_free(tmp2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 silc_hash_table_list_reset(&htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
137 if (channel->cipher) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 g_string_append_printf(s, _("<br><b>Channel Cipher:</b> %s"), |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
139 channel->cipher); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
140 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 if (channel->hmac) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 /* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 g_string_append_printf(s, _("<br><b>Channel HMAC:</b> %s"), |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
144 channel->hmac); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 if (channel->topic) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 tmp2 = g_markup_escape_text(channel->topic, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 g_string_append_printf(s, _("<br><b>Channel Topic:</b><br>%s"), tmp2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 g_free(tmp2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 if (channel->mode) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 g_string_append_printf(s, _("<br><b>Channel Modes:</b> ")); |
15822 | 154 silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 g_string_append(s, tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 if (channel->founder_key) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 char *fingerprint, *babbleprint; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 unsigned char *pk; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 SilcUInt32 pk_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len); |
21044
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
163 if (pk) { |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
164 fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
165 babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 |
21044
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
167 g_string_append_printf(s, _("<br><b>Founder Key Fingerprint:</b><br>%s"), fingerprint); |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
168 g_string_append_printf(s, _("<br><b>Founder Key Babbleprint:</b><br>%s"), babbleprint); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 |
21044
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
170 silc_free(fingerprint); |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
171 silc_free(babbleprint); |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
172 silc_free(pk); |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
173 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 |
22824
67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
176 purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, s->str, NULL, NULL); |
67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
177 g_string_free(s, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 static void |
15822 | 182 silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 { |
15822 | 184 PurpleChat *chat = (PurpleChat *)node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
185 PurpleAccount *account = purple_chat_get_account(chat); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
186 silcpurple_chat_getinfo(purple_account_get_connection(account), |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
187 purple_chat_get_components(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 #if 0 /* XXX For now these are not implemented. We need better |
15822 | 192 listview dialog from Purple for these. */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 /************************** Channel Invite List ******************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 static void |
15822 | 196 silcpurple_chat_invitelist(PurpleBlistNode *node, gpointer data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 /**************************** Channel Ban List *******************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 static void |
15822 | 205 silcpurple_chat_banlist(PurpleBlistNode *node, gpointer data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 /************************* Channel Authentication ****************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 typedef struct { |
15822 | 215 SilcPurple sg; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 SilcChannelEntry channel; |
15822 | 217 PurpleChat *c; |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
218 SilcDList pubkeys; |
15822 | 219 } *SilcPurpleChauth; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 static void |
15822 | 222 silcpurple_chat_chpk_add(void *user_data, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 { |
15822 | 224 SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; |
225 SilcPurple sg = sgc->sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 SilcPublicKey public_key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 SilcBuffer chpks, pk, chidp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 unsigned char mode[4]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 SilcUInt32 m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 /* Load the public key */ |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
234 if (!silc_pkcs_load_public_key(name, &public_key)) { |
15822 | 235 silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
236 silc_dlist_uninit(sgc->pubkeys); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 silc_free(sgc); |
15822 | 238 purple_notify_error(client->application, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
239 _("Add Channel Public Key"), |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
240 _("Could not load public key"), NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
244 pk = silc_public_key_payload_encode(public_key); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 chpks = silc_buffer_alloc_size(2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 SILC_PUT16_MSB(1, chpks->head); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 chpks = silc_argument_payload_encode_one(chpks, pk->data, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
248 silc_buffer_len(pk), 0x00); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 silc_buffer_free(pk); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 m = sgc->channel->mode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 m |= SILC_CHANNEL_MODE_CHANNEL_AUTH; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 /* Send CMODE */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 SILC_PUT32_MSB(m, mode); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
256 chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 silc_client_command_send(client, conn, SILC_COMMAND_CMODE, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
258 silcpurple_command_reply, NULL, 3, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
259 1, chidp->data, silc_buffer_len(chidp), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 2, mode, sizeof(mode), |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
261 9, chpks->data, silc_buffer_len(chpks)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 silc_buffer_free(chpks); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 silc_buffer_free(chidp); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
264 if (sgc->pubkeys) { |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
265 silc_dlist_start(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
266 while ((public_key = silc_dlist_get(sgc->pubkeys))) |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
267 silc_pkcs_public_key_free(public_key); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
268 silc_dlist_uninit(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
269 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 silc_free(sgc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 static void |
15822 | 274 silcpurple_chat_chpk_cancel(void *user_data, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 { |
15822 | 276 SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
277 SilcPublicKey public_key; |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
278 |
15822 | 279 silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
280 |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
281 if (sgc->pubkeys) { |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
282 silc_dlist_start(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
283 while ((public_key = silc_dlist_get(sgc->pubkeys))) |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
284 silc_pkcs_public_key_free(public_key); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
285 silc_dlist_uninit(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
286 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 silc_free(sgc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 static void |
15822 | 291 silcpurple_chat_chpk_cb(SilcPurpleChauth sgc, PurpleRequestFields *fields) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 { |
15822 | 293 SilcPurple sg = sgc->sg; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 SilcClientConnection conn = sg->conn; |
15822 | 296 PurpleRequestField *f; |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
17573
diff
changeset
|
297 GList *list; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 SilcPublicKey public_key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 SilcBuffer chpks, pk, chidp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 SilcUInt16 c = 0, ct; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 unsigned char mode[4]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 SilcUInt32 m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 |
15822 | 304 f = purple_request_fields_get_field(fields, "list"); |
305 if (!purple_request_field_list_get_selected(f)) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 /* Add new public key */ |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
307 purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
308 G_CALLBACK(silcpurple_chat_chpk_add), |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
309 G_CALLBACK(silcpurple_chat_chpk_cancel), |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
310 purple_connection_get_account(sg->gc), NULL, NULL, sgc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 |
15822 | 314 list = purple_request_field_list_get_items(f); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 chpks = silc_buffer_alloc_size(2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 for (ct = 0; list; list = list->next, ct++) { |
15822 | 318 public_key = purple_request_field_list_get_data(f, list->data); |
319 if (purple_request_field_list_is_selected(f, list->data)) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 /* Delete this public key */ |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
321 pk = silc_public_key_payload_encode(public_key); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 chpks = silc_argument_payload_encode_one(chpks, pk->data, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
323 silc_buffer_len(pk), 0x01); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 silc_buffer_free(pk); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 c++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 if (!c) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 silc_buffer_free(chpks); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 SILC_PUT16_MSB(c, chpks->head); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 m = sgc->channel->mode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 if (ct == c) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 m &= ~SILC_CHANNEL_MODE_CHANNEL_AUTH; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 /* Send CMODE */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 SILC_PUT32_MSB(m, mode); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
340 chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 silc_client_command_send(client, conn, SILC_COMMAND_CMODE, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
342 silcpurple_command_reply, NULL, 3, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
343 1, chidp->data, silc_buffer_len(chidp), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 2, mode, sizeof(mode), |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
345 9, chpks->data, silc_buffer_len(chpks)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 silc_buffer_free(chpks); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 silc_buffer_free(chidp); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
348 if (sgc->pubkeys) { |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
349 silc_dlist_start(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
350 while ((public_key = silc_dlist_get(sgc->pubkeys))) |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
351 silc_pkcs_public_key_free(public_key); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
352 silc_dlist_uninit(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
353 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 silc_free(sgc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 static void |
15822 | 358 silcpurple_chat_chauth_ok(SilcPurpleChauth sgc, PurpleRequestFields *fields) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 { |
15822 | 360 SilcPurple sg = sgc->sg; |
361 PurpleRequestField *f; | |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
362 SilcPublicKey public_key; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 const char *curpass, *val; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 int set; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 |
15822 | 366 f = purple_request_fields_get_field(fields, "passphrase"); |
367 val = purple_request_field_string_get_value(f); | |
368 curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 if (!val && curpass) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 set = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 else if (val && !curpass) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 set = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 else if (val && curpass && strcmp(val, curpass)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 set = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 set = -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 if (set == 1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 sgc->channel->channel_name, "+a", val, NULL); |
15822 | 382 purple_blist_node_set_string((PurpleBlistNode *)sgc->c, "passphrase", val); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 } else if (set == 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 sgc->channel->channel_name, "-a", NULL); |
15822 | 386 purple_blist_node_remove_setting((PurpleBlistNode *)sgc->c, "passphrase"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
389 if (sgc->pubkeys) { |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
390 silc_dlist_start(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
391 while ((public_key = silc_dlist_get(sgc->pubkeys))) |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
392 silc_pkcs_public_key_free(public_key); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
393 silc_dlist_uninit(sgc->pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
394 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 silc_free(sgc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
15822 | 398 void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
399 SilcDList channel_pubkeys) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 { |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
401 SilcPublicKey public_key; |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
402 SilcSILCPublicKey silc_pubkey; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 unsigned char *pk; |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
404 SilcUInt32 pk_len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 char *fingerprint, *babbleprint; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 SilcPublicKeyIdentifier ident; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 char tmp2[1024], t[512]; |
15822 | 408 PurpleRequestFields *fields; |
409 PurpleRequestFieldGroup *g; | |
410 PurpleRequestField *f; | |
411 SilcPurpleChauth sgc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 const char *curpass = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 sgc = silc_calloc(1, sizeof(*sgc)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 if (!sgc) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 sgc->sg = sg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 sgc->channel = channel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 |
15822 | 420 fields = purple_request_fields_new(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 if (sgc->c) |
15822 | 423 curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 |
15822 | 425 g = purple_request_field_group_new(NULL); |
426 f = purple_request_field_string_new("passphrase", _("Channel Passphrase"), | |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
427 curpass, FALSE); |
15822 | 428 purple_request_field_string_set_masked(f, TRUE); |
429 purple_request_field_group_add_field(g, f); | |
430 purple_request_fields_add_group(fields, g); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 |
15822 | 432 g = purple_request_field_group_new(NULL); |
433 f = purple_request_field_label_new("l1", _("Channel Public Keys List")); | |
434 purple_request_field_group_add_field(g, f); | |
435 purple_request_fields_add_group(fields, g); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 g_snprintf(t, sizeof(t), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 _("Channel authentication is used to secure the channel from " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 "unauthorized access. The authentication may be based on " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 "passphrase and digital signatures. If passphrase is set, it " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 "is required to be able to join. If channel public keys are set " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 "then only users whose public keys are listed are able to join.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
444 if (!channel_pubkeys || !silc_dlist_count(channel_pubkeys)) { |
15822 | 445 f = purple_request_field_list_new("list", NULL); |
446 purple_request_field_group_add_field(g, f); | |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
447 purple_request_fields(sg->gc, _("Channel Authentication"), |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
448 _("Channel Authentication"), t, fields, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
449 _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
450 _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
451 purple_connection_get_account(sg->gc), NULL, NULL, sgc); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
452 if (channel_pubkeys) |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
453 silc_dlist_uninit(channel_pubkeys); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 } |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
456 sgc->pubkeys = channel_pubkeys; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 |
15822 | 458 g = purple_request_field_group_new(NULL); |
459 f = purple_request_field_list_new("list", NULL); | |
460 purple_request_field_group_add_field(g, f); | |
461 purple_request_fields_add_group(fields, g); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
463 silc_dlist_start(channel_pubkeys); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
464 while ((public_key = silc_dlist_get(channel_pubkeys))) { |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
465 pk = silc_pkcs_public_key_encode(public_key, &pk_len); |
21044
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
466 if (!pk) |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
467 continue; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 fingerprint = silc_hash_fingerprint(NULL, pk + 4, pk_len - 4); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 babbleprint = silc_hash_babbleprint(NULL, pk + 4, pk_len - 4); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
470 |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
471 silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
472 ident = &silc_pubkey->identifier; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 g_snprintf(tmp2, sizeof(tmp2), "%s\n %s\n %s", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 ident->realname ? ident->realname : ident->username ? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 ident->username : "", fingerprint, babbleprint); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
477 purple_request_field_list_add(f, tmp2, public_key); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 silc_free(fingerprint); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 silc_free(babbleprint); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 |
15822 | 483 purple_request_field_list_set_multi_select(f, FALSE); |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
484 purple_request_fields(sg->gc, _("Channel Authentication"), |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
485 _("Channel Authentication"), t, fields, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
486 _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
487 _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
488 purple_connection_get_account(sg->gc), NULL, NULL, sgc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 static void |
15822 | 492 silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 { |
15822 | 494 PurpleChat *chat; |
495 PurpleConnection *gc; | |
496 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 |
15822 | 498 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 |
15822 | 500 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
501 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
505 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 "+C", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 /************************** Channel Private Groups **************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 /* Private groups are "virtual" channels. They are groups inside a channel. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 This is implemented by using channel private keys. By knowing a channel |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 private key user becomes part of that group and is able to talk on that |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 group. Other users, on the same channel, won't be able to see the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 messages of that group. It is possible to have multiple groups inside |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 a channel - and thus having multiple private keys on the channel. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 typedef struct { |
15822 | 520 SilcPurple sg; |
521 PurpleChat *c; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 const char *channel; |
15822 | 523 } *SilcPurpleCharPrv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 static void |
15822 | 526 silcpurple_chat_prv_add(SilcPurpleCharPrv p, PurpleRequestFields *fields) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 { |
15822 | 528 SilcPurple sg = p->sg; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 char tmp[512]; |
15822 | 530 PurpleRequestField *f; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 const char *name, *passphrase, *alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 GHashTable *comp; |
15822 | 533 PurpleGroup *g; |
534 PurpleChat *cn; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 |
15822 | 536 f = purple_request_fields_get_field(fields, "name"); |
537 name = purple_request_field_string_get_value(f); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 if (!name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 silc_free(p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 } |
15822 | 542 f = purple_request_fields_get_field(fields, "passphrase"); |
543 passphrase = purple_request_field_string_get_value(f); | |
544 f = purple_request_fields_get_field(fields, "alias"); | |
545 alias = purple_request_field_string_get_value(f); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 /* Add private group to buddy list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 g_snprintf(tmp, sizeof(tmp), "%s [Private Group]", name); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
549 comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
550 g_hash_table_replace(comp, "channel", g_strdup(tmp)); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
551 g_hash_table_replace(comp, "passphrase", g_strdup(passphrase)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 |
15822 | 553 cn = purple_chat_new(sg->account, alias, comp); |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
554 g = purple_chat_get_group(p->c); |
15822 | 555 purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 /* Associate to a real channel */ |
15822 | 558 purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 /* Join the group */ |
15822 | 561 silcpurple_chat_join(sg->gc, comp); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 silc_free(p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 static void |
15822 | 567 silcpurple_chat_prv_cancel(SilcPurpleCharPrv p, PurpleRequestFields *fields) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 silc_free(p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 static void |
15822 | 573 silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 { |
15822 | 575 PurpleChat *chat; |
576 PurpleConnection *gc; | |
577 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 |
15822 | 579 SilcPurpleCharPrv p; |
580 PurpleRequestFields *fields; | |
581 PurpleRequestFieldGroup *g; | |
582 PurpleRequestField *f; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 char tmp[512]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 |
15822 | 585 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 |
15822 | 587 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
588 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 p = silc_calloc(1, sizeof(*p)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 if (!p) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 p->sg = sg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
596 p->channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); |
15822 | 597 p->c = purple_blist_find_chat(sg->account, p->channel); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 |
15822 | 599 fields = purple_request_fields_new(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 |
15822 | 601 g = purple_request_field_group_new(NULL); |
602 f = purple_request_field_string_new("name", _("Group Name"), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 NULL, FALSE); |
15822 | 604 purple_request_field_group_add_field(g, f); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 |
15822 | 606 f = purple_request_field_string_new("passphrase", _("Passphrase"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 NULL, FALSE); |
15822 | 608 purple_request_field_string_set_masked(f, TRUE); |
609 purple_request_field_group_add_field(g, f); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
15822 | 611 f = purple_request_field_string_new("alias", _("Alias"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 NULL, FALSE); |
15822 | 613 purple_request_field_group_add_field(g, f); |
614 purple_request_fields_add_group(fields, g); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 g_snprintf(tmp, sizeof(tmp), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 _("Please enter the %s channel private group name and passphrase."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 p->channel); |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
619 purple_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
620 _("Add"), G_CALLBACK(silcpurple_chat_prv_add), |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
621 _("Cancel"), G_CALLBACK(silcpurple_chat_prv_cancel), |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
622 purple_connection_get_account(gc), NULL, NULL, p); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 /****************************** Channel Modes ********************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 static void |
15822 | 629 silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 { |
15822 | 631 PurpleChat *chat; |
632 PurpleConnection *gc; | |
633 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 |
15822 | 635 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 |
15822 | 637 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
638 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
642 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 "-f", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 static void |
15822 | 647 silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 { |
15822 | 649 PurpleChat *chat; |
650 PurpleConnection *gc; | |
651 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 const char *channel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 |
15822 | 654 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 |
15822 | 656 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
657 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 if (!sg->conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 /* XXX we should have ability to define which founder |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 key to use. Now we use the user's own public key |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 (default key). */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 /* Call CMODE */ |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
668 channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 "+f", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 typedef struct { |
15822 | 674 SilcPurple sg; |
22848
29235834c692
g_strdup'ed strings aren't const char*. This fixes a couple of compile
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22824
diff
changeset
|
675 char *channel; |
15822 | 676 } *SilcPurpleChatInput; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 static void |
15822 | 679 silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 SilcChannelEntry channel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 int ulimit = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 channel = silc_client_get_channel(s->sg->client, s->sg->conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 (char *)s->channel); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 if (!channel) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 if (limit) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 ulimit = atoi(limit); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 if (!limit || !(*limit) || *limit == '0') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 if (limit && ulimit == channel->user_limit) { |
22824
67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
693 g_free(s->channel); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 silc_free(s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 s->channel, "-l", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 |
22824
67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
700 g_free(s->channel); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 silc_free(s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 if (ulimit == channel->user_limit) { |
22824
67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
706 g_free(s->channel); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 silc_free(s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 /* Call CMODE */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 s->channel, "+l", limit, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 |
22824
67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
715 g_free(s->channel); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 silc_free(s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 static void |
15822 | 720 silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 { |
15822 | 722 PurpleChat *chat; |
723 PurpleConnection *gc; | |
724 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 |
15822 | 726 SilcPurpleChatInput s; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 SilcChannelEntry channel; |
22848
29235834c692
g_strdup'ed strings aren't const char*. This fixes a couple of compile
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22824
diff
changeset
|
728 char *ch; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 char tmp[32]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 |
15822 | 731 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 |
15822 | 733 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
734 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 if (!sg->conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
740 ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 if (!channel) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 s = silc_calloc(1, sizeof(*s)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 if (!s) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 s->channel = ch; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 s->sg = sg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit); |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
751 purple_request_input(gc, _("User Limit"), NULL, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 _("Set user limit on channel. Set to zero to reset user limit."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 tmp, FALSE, FALSE, NULL, |
15822 | 754 _("OK"), G_CALLBACK(silcpurple_chat_ulimit_cb), |
16442
a5176db228b7
Update SILC to match resent request API changes
Stu Tomlinson <stu@nosnilmot.com>
parents:
15822
diff
changeset
|
755 _("Cancel"), G_CALLBACK(silcpurple_chat_ulimit_cb), |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
756 purple_connection_get_account(gc), NULL, NULL, s); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 static void |
15822 | 760 silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 { |
15822 | 762 PurpleChat *chat; |
763 PurpleConnection *gc; | |
764 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 |
15822 | 766 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 |
15822 | 768 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
769 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
773 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 "-t", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 static void |
15822 | 778 silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 { |
15822 | 780 PurpleChat *chat; |
781 PurpleConnection *gc; | |
782 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 |
15822 | 784 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 |
15822 | 786 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
787 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
791 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 "+t", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 static void |
15822 | 796 silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 { |
15822 | 798 PurpleChat *chat; |
799 PurpleConnection *gc; | |
800 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 |
15822 | 802 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 |
15822 | 804 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
805 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
809 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 "-p", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 static void |
15822 | 814 silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 { |
15822 | 816 PurpleChat *chat; |
817 PurpleConnection *gc; | |
818 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 |
15822 | 820 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 |
15822 | 822 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
823 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
827 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 "+p", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 static void |
15822 | 832 silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 { |
15822 | 834 PurpleChat *chat; |
835 PurpleConnection *gc; | |
836 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 |
15822 | 838 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 |
15822 | 840 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
841 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
845 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 "-s", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 static void |
15822 | 850 silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 { |
15822 | 852 PurpleChat *chat; |
853 PurpleConnection *gc; | |
854 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 |
15822 | 856 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 |
15822 | 858 chat = (PurpleChat *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
859 gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
863 g_hash_table_lookup(purple_chat_get_components(chat), "channel"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 "+s", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 typedef struct { |
15822 | 868 SilcPurple sg; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 SilcChannelEntry channel; |
15822 | 870 } *SilcPurpleChatWb; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 static void |
15822 | 873 silcpurple_chat_wb(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 { |
15822 | 875 SilcPurpleChatWb wb = data; |
876 silcpurple_wb_init_ch(wb->sg, wb->channel); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 silc_free(wb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 |
15822 | 880 GList *silcpurple_chat_menu(PurpleChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 { |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
882 GHashTable *components = purple_chat_get_components(chat); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23152
diff
changeset
|
883 PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); |
15822 | 884 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
886 const char *chname = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 SilcChannelEntry channel = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 SilcChannelUser chu = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 SilcUInt32 mode = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 GList *m = NULL; |
15822 | 892 PurpleMenuAction *act; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 if (components) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 chname = g_hash_table_lookup(components, "channel"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 if (chname) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 channel = silc_client_get_channel(sg->client, sg->conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 (char *)chname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 if (channel) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 chu = silc_client_on_channel(channel, conn->local_entry); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 if (chu) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 mode = chu->mode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 if (strstr(chname, "[Private Group]")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 |
15822 | 908 act = purple_menu_action_new(_("Get Info"), |
909 PURPLE_CALLBACK(silcpurple_chat_getinfo_menu), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 #if 0 /* XXX For now these are not implemented. We need better |
15822 | 914 listview dialog from Purple for these. */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 if (mode & SILC_CHANNEL_UMODE_CHANOP) { |
15822 | 916 act = purple_menu_action_new(_("Invite List"), |
917 PURPLE_CALLBACK(silcpurple_chat_invitelist), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 |
15822 | 921 act = purple_menu_action_new(_("Ban List"), |
922 PURPLE_CALLBACK(silcpurple_chat_banlist), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 if (chu) { |
15822 | 929 act = purple_menu_action_new(_("Add Private Group"), |
930 PURPLE_CALLBACK(silcpurple_chat_prv), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
935 if (chu && mode & SILC_CHANNEL_UMODE_CHANFO) { |
15822 | 936 act = purple_menu_action_new(_("Channel Authentication"), |
937 PURPLE_CALLBACK(silcpurple_chat_chauth), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 if (channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) { |
15822 | 942 act = purple_menu_action_new(_("Reset Permanent"), |
943 PURPLE_CALLBACK(silcpurple_chat_permanent_reset), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 } else { |
15822 | 947 act = purple_menu_action_new(_("Set Permanent"), |
948 PURPLE_CALLBACK(silcpurple_chat_permanent), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
954 if (chu && mode & SILC_CHANNEL_UMODE_CHANOP) { |
15822 | 955 act = purple_menu_action_new(_("Set User Limit"), |
956 PURPLE_CALLBACK(silcpurple_chat_ulimit), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 if (channel->mode & SILC_CHANNEL_MODE_TOPIC) { |
15822 | 961 act = purple_menu_action_new(_("Reset Topic Restriction"), |
962 PURPLE_CALLBACK(silcpurple_chat_resettopic), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 } else { |
15822 | 966 act = purple_menu_action_new(_("Set Topic Restriction"), |
967 PURPLE_CALLBACK(silcpurple_chat_settopic), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 if (channel->mode & SILC_CHANNEL_MODE_PRIVATE) { |
15822 | 973 act = purple_menu_action_new(_("Reset Private Channel"), |
974 PURPLE_CALLBACK(silcpurple_chat_resetprivate), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 } else { |
15822 | 978 act = purple_menu_action_new(_("Set Private Channel"), |
979 PURPLE_CALLBACK(silcpurple_chat_setprivate), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 if (channel->mode & SILC_CHANNEL_MODE_SECRET) { |
15822 | 985 act = purple_menu_action_new(_("Reset Secret Channel"), |
986 PURPLE_CALLBACK(silcpurple_chat_resetsecret), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 } else { |
15822 | 990 act = purple_menu_action_new(_("Set Secret Channel"), |
991 PURPLE_CALLBACK(silcpurple_chat_setsecret), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
997 if (chu && channel) { |
15822 | 998 SilcPurpleChatWb wb; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 wb = silc_calloc(1, sizeof(*wb)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 wb->sg = sg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 wb->channel = channel; |
15822 | 1002 act = purple_menu_action_new(_("Draw On Whiteboard"), |
1003 PURPLE_CALLBACK(silcpurple_chat_wb), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1004 (void *)wb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1009 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1010 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 /******************************* Joining Etc. ********************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 |
15822 | 1014 char *silcpurple_get_chat_name(GHashTable *data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 return g_strdup(g_hash_table_lookup(data, "channel")); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1017 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 |
15822 | 1019 void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 { |
15822 | 1021 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1023 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 const char *channel, *passphrase, *parentch; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 if (!conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1028 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 channel = g_hash_table_lookup(data, "channel"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1030 passphrase = g_hash_table_lookup(data, "passphrase"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 /* Check if we are joining a private group. Handle it |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 purely locally as it's not a real channel */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 if (strstr(channel, "[Private Group]")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 SilcChannelEntry channel_entry; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 SilcChannelPrivateKey key; |
15822 | 1037 PurpleChat *c; |
1038 SilcPurplePrvgrp grp; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 |
15822 | 1040 c = purple_blist_find_chat(sg->account, channel); |
1041 parentch = purple_blist_node_get_string((PurpleBlistNode *)c, "parentch"); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 if (!parentch) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 channel_entry = silc_client_get_channel(sg->client, sg->conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 (char *)parentch); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 if (!channel_entry || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 !silc_client_on_channel(channel_entry, sg->conn->local_entry)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 char tmp[512]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 g_snprintf(tmp, sizeof(tmp), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 _("You have to join the %s channel before you are " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 "able to join the private group"), parentch); |
15822 | 1053 purple_notify_error(gc, _("Join Private Group"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 _("Cannot join private group"), tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 /* Add channel private key */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 if (!silc_client_add_channel_private_key(client, conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 channel_entry, channel, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 NULL, NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 (unsigned char *)passphrase, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 strlen(passphrase), &key)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 /* Join the group */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 grp = silc_calloc(1, sizeof(*grp)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 if (!grp) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 return; |
15822 | 1070 grp->id = ++sg->channel_ids + SILCPURPLE_PRVGRP; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 grp->chid = SILC_PTR_TO_32(channel_entry->context); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 grp->parentch = parentch; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 grp->channel = channel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 grp->key = key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 sg->grps = g_list_append(sg->grps, grp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 serv_got_joined_chat(gc, grp->id, channel); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1078 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1079 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 /* XXX We should have other properties here as well: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 1. whether to try to authenticate to the channel |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 1a. with default key, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 1b. with specific key. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 2. whether to try to authenticate to become founder. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 2a. with default key, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 2b. with specific key. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 Since now such variety is not possible in the join dialog |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 we always use -founder and -auth options, which try to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 do both 1 and 2 with default keys. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 /* Call JOIN */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 if ((passphrase != NULL) && (*passphrase != '\0')) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 silc_client_command_call(client, conn, NULL, "JOIN", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 channel, passphrase, "-auth", "-founder", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 silc_client_command_call(client, conn, NULL, "JOIN", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 channel, "-auth", "-founder", NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 |
15822 | 1101 void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1102 const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 { |
15822 | 1104 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 SilcHashTableList htl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 SilcChannelUser chu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 gboolean found = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 if (!conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1112 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 /* See if we are inviting on a private group. Invite |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 to the actual channel */ |
15822 | 1116 if (id > SILCPURPLE_PRVGRP) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1117 GList *l; |
15822 | 1118 SilcPurplePrvgrp prv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1119 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1120 for (l = sg->grps; l; l = l->next) |
15822 | 1121 if (((SilcPurplePrvgrp)l->data)->id == id) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1122 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 if (!l) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1124 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 prv = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1126 id = prv->chid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1129 /* Find channel by id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 silc_hash_table_list(conn->local_entry->channels, &htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1131 while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1132 if (SILC_PTR_TO_32(chu->channel->context) == id ) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 found = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1137 silc_hash_table_list_reset(&htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 if (!found) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 /* Call INVITE */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 silc_client_command_call(client, conn, NULL, "INVITE", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 chu->channel->channel_name, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 name, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1145 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 |
15822 | 1147 void silcpurple_chat_leave(PurpleConnection *gc, int id) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 { |
15822 | 1149 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1152 SilcHashTableList htl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 SilcChannelUser chu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 gboolean found = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 GList *l; |
15822 | 1156 SilcPurplePrvgrp prv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1158 if (!conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1161 /* See if we are leaving a private group */ |
15822 | 1162 if (id > SILCPURPLE_PRVGRP) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1163 SilcChannelEntry channel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 for (l = sg->grps; l; l = l->next) |
15822 | 1166 if (((SilcPurplePrvgrp)l->data)->id == id) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 if (!l) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1170 prv = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 channel = silc_client_get_channel(sg->client, sg->conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 (char *)prv->parentch); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 if (!channel) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 silc_client_del_channel_private_key(client, conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 channel, prv->key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 silc_free(prv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 sg->grps = g_list_remove(sg->grps, prv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 serv_got_chat_left(gc, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 /* Find channel by id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 silc_hash_table_list(conn->local_entry->channels, &htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 if (SILC_PTR_TO_32(chu->channel->context) == id ) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 found = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1188 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1190 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 silc_hash_table_list_reset(&htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 if (!found) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 /* Call LEAVE */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 silc_client_command_call(client, conn, NULL, "LEAVE", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 chu->channel->channel_name, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 serv_got_chat_left(gc, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 /* Leave from private groups on this channel as well */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 for (l = sg->grps; l; l = l->next) |
15822 | 1203 if (((SilcPurplePrvgrp)l->data)->chid == id) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 prv = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 silc_client_del_channel_private_key(client, conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 chu->channel, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 prv->key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1208 serv_got_chat_left(gc, prv->id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1209 silc_free(prv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 sg->grps = g_list_remove(sg->grps, prv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 if (!sg->grps) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1213 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1215 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1216 int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1217 PurpleMessageFlags msgflags) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 { |
15822 | 1219 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 SilcHashTableList htl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 SilcChannelUser chu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 SilcChannelEntry channel = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 SilcChannelPrivateKey key = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1226 SilcUInt32 flags; |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1227 int ret = 0; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 char *msg2, *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1229 gboolean found = FALSE; |
15822 | 1230 gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1231 SilcDList list; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1233 if (!msg || !conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1234 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 flags = SILC_MESSAGE_FLAG_UTF8; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 |
15822 | 1238 tmp = msg2 = purple_unescape_html(msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 if (!g_ascii_strncasecmp(msg2, "/me ", 4)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 msg2 += 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 if (!*msg2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 flags |= SILC_MESSAGE_FLAG_ACTION; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 } else if (strlen(msg) > 1 && msg[0] == '/') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 if (!silc_client_command_call(client, conn, msg + 1)) |
15822 | 1250 purple_notify_error(gc, _("Call Command"), _("Cannot call command"), |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1251 _("Unknown command")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 if (sign) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 flags |= SILC_MESSAGE_FLAG_SIGNED; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1260 /* Get the channel private key if we are sending on |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 private group */ |
15822 | 1262 if (id > SILCPURPLE_PRVGRP) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 GList *l; |
15822 | 1264 SilcPurplePrvgrp prv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 for (l = sg->grps; l; l = l->next) |
15822 | 1267 if (((SilcPurplePrvgrp)l->data)->id == id) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1268 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 if (!l) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1270 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1271 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 prv = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1274 channel = silc_client_get_channel(sg->client, sg->conn, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1275 (char *)prv->parentch); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 if (!channel) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1278 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1279 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1280 key = prv->key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1281 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1282 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 if (!channel) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1284 /* Find channel by id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1285 silc_hash_table_list(conn->local_entry->channels, &htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1286 while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1287 if (SILC_PTR_TO_32(chu->channel->context) == id ) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1288 found = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1289 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1290 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1291 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 silc_hash_table_list_reset(&htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1293 if (!found) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1294 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1295 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1296 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 channel = chu->channel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1299 |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1300 /* Check for images */ |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1301 if (msgflags & PURPLE_MESSAGE_IMAGES) { |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1302 list = silcpurple_image_message(msg, &flags); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1303 if (list) { |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1304 /* Send one or more MIME message. If more than one, they |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1305 are MIME fragments due to over large message */ |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1306 SilcBuffer buf; |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1307 |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1308 silc_dlist_start(list); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1309 while ((buf = silc_dlist_get(list)) != SILC_LIST_END) |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1310 ret = |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1311 silc_client_send_channel_message(client, conn, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1312 channel, key, |
21044
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
1313 flags, sg->sha1hash, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1314 buf->data, |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1315 silc_buffer_len(buf)); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1316 silc_mime_partial_free(list); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1317 g_free(tmp); |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1318 |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1319 if (ret) |
23152
caa533b62902
When calling serv_got_chat_in() after sending a group chat message (to let
Evan Schoenberg <evan.s@dreskin.net>
parents:
22848
diff
changeset
|
1320 serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, time(NULL)); |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1321 return ret; |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1322 } |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1323 } |
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1324 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1325 /* Send channel message */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1326 ret = silc_client_send_channel_message(client, conn, channel, key, |
21044
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
1327 flags, sg->sha1hash, |
6b02dba5bf41
Patch from Pekka Riikone to fix various SILC issues.
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
1328 (unsigned char *)msg2, |
17568
980a104267da
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <stu@nosnilmot.com>
parents:
16442
diff
changeset
|
1329 strlen(msg2)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1330 if (ret) { |
23152
caa533b62902
When calling serv_got_chat_in() after sending a group chat message (to let
Evan Schoenberg <evan.s@dreskin.net>
parents:
22848
diff
changeset
|
1331 serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 time(NULL)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1335 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1337 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1338 |
15822 | 1339 void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1340 { |
15822 | 1341 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1343 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 SilcHashTableList htl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1345 SilcChannelUser chu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1346 gboolean found = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1347 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1348 if (!conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1349 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1350 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1351 /* See if setting topic on private group. Set it |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1352 on the actual channel */ |
15822 | 1353 if (id > SILCPURPLE_PRVGRP) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 GList *l; |
15822 | 1355 SilcPurplePrvgrp prv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1356 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 for (l = sg->grps; l; l = l->next) |
15822 | 1358 if (((SilcPurplePrvgrp)l->data)->id == id) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1359 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1360 if (!l) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 prv = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1363 id = prv->chid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1364 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 /* Find channel by id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1367 silc_hash_table_list(conn->local_entry->channels, &htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1368 while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1369 if (SILC_PTR_TO_32(chu->channel->context) == id ) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1370 found = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1371 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1372 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1373 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1374 silc_hash_table_list_reset(&htl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1375 if (!found) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1376 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1377 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1378 /* Call TOPIC */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1379 silc_client_command_call(client, conn, NULL, "TOPIC", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1380 chu->channel->channel_name, topic, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1382 |
15822 | 1383 PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1384 { |
15822 | 1385 SilcPurple sg = gc->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 SilcClient client = sg->client; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1387 SilcClientConnection conn = sg->conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1388 GList *fields = NULL; |
15822 | 1389 PurpleRoomlistField *f; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1391 if (!conn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1392 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1393 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1394 if (sg->roomlist) |
15822 | 1395 purple_roomlist_unref(sg->roomlist); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1396 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 sg->roomlist_canceled = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1398 |
15822 | 1399 sg->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); |
1400 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1401 fields = g_list_append(fields, f); |
15822 | 1402 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1403 _("Users"), "users", FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1404 fields = g_list_append(fields, f); |
15822 | 1405 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1406 _("Topic"), "topic", FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1407 fields = g_list_append(fields, f); |
15822 | 1408 purple_roomlist_set_fields(sg->roomlist, fields); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1409 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1410 /* Call LIST */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1411 silc_client_command_call(client, conn, "LIST"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1412 |
15822 | 1413 purple_roomlist_set_in_progress(sg->roomlist, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1414 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1415 return sg->roomlist; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1416 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1417 |
15822 | 1418 void silcpurple_roomlist_cancel(PurpleRoomlist *list) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 { |
15822 | 1420 PurpleConnection *gc = purple_account_get_connection(list->account); |
1421 SilcPurple sg; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1423 if (!gc) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1424 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1425 sg = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1426 |
15822 | 1427 purple_roomlist_set_in_progress(list, FALSE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 if (sg->roomlist == list) { |
15822 | 1429 purple_roomlist_unref(sg->roomlist); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 sg->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 sg->roomlist_canceled = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1432 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 } |