libpurple/protocols/silc10/chat.c

Fri, 16 Nov 2007 23:01:12 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Fri, 16 Nov 2007 23:01:12 +0000
changeset 21234
bb34c0fd67c3
parent 21233
e75de8db4f2b
child 21351
4c83d3121e8b
permissions
-rw-r--r--

disapproval of revision 'e75de8db4f2ba437cba75f5ff9d917c4c9135f09'

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

mercurial