Sat, 17 Nov 2007 17:27:48 +0000
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
and 'ae28614769da3aab10870461ea63f2d923b9d07a'
|
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_ops.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 "imgstore.h" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
24 | #include "wb.h" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
25 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
26 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
27 | silc_channel_message(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
28 | SilcClientEntry sender, SilcChannelEntry channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
29 | SilcMessagePayload payload, SilcChannelPrivateKey key, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
30 | SilcMessageFlags flags, const unsigned char *message, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
31 | SilcUInt32 message_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
32 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
33 | silc_private_message(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
34 | SilcClientEntry sender, SilcMessagePayload payload, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
35 | SilcMessageFlags flags, const unsigned char *message, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
36 | SilcUInt32 message_len); |
|
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 | /* Message sent to the application by library. `conn' associates the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
39 | message to a specific connection. `conn', however, may be NULL. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
40 | The `type' indicates the type of the message sent by the library. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
41 | The application can for example filter the message according the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
42 | type. */ |
|
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 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
45 | silc_say(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
46 | SilcClientMessageType type, char *msg, ...) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
47 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
48 | /* Nothing */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
49 | } |
|
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 | #ifdef HAVE_SILCMIME_H |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
52 | /* Processes incoming MIME message. Can be private message or channel |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
53 | message. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
54 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
55 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
56 | silcpurple_mime_message(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
57 | SilcClientEntry sender, SilcChannelEntry channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
58 | SilcMessagePayload payload, SilcChannelPrivateKey key, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
59 | SilcMessageFlags flags, SilcMime mime, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
60 | gboolean recursive) |
|
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 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
63 | 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
|
64 | const char *type; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
65 | const unsigned char *data; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
66 | SilcUInt32 data_len; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
67 | PurpleMessageFlags cflags = 0; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
68 | PurpleConversation *convo = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
69 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
70 | if (!mime) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
71 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
72 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
73 | /* Check for fragmented MIME message */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
74 | if (silc_mime_is_partial(mime)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
75 | if (!sg->mimeass) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
76 | sg->mimeass = silc_mime_assembler_alloc(); |
|
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 | /* Defragment */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
79 | mime = silc_mime_assemble(sg->mimeass, mime); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
80 | if (!mime) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
81 | /* More fragments to come */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
82 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
83 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
84 | /* Process the complete message */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
85 | silcpurple_mime_message(client, conn, sender, channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
86 | payload, key, flags, mime, FALSE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
87 | return; |
|
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 | /* Check for multipart message */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
91 | if (silc_mime_is_multipart(mime)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
92 | SilcMime p; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
93 | const char *mtype; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
94 | SilcDList parts = silc_mime_get_multiparts(mime, &mtype); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
95 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
96 | /* Only "mixed" type supported */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
97 | if (strcmp(mtype, "mixed")) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
98 | goto out; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
99 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
100 | silc_dlist_start(parts); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
101 | while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
102 | /* Recursively process parts */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
103 | silcpurple_mime_message(client, conn, sender, channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
104 | payload, key, flags, p, TRUE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
105 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
106 | goto out; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
107 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
108 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
109 | /* Get content type and MIME data */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
110 | type = silc_mime_get_field(mime, "Content-Type"); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
111 | if (!type) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
112 | goto out; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
113 | data = silc_mime_get_data(mime, &data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
114 | if (!data) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
115 | goto out; |
|
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 | /* Process according to content type */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
118 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
119 | /* Plain text */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
120 | if (strstr(type, "text/plain")) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
121 | /* Default is UTF-8, don't check for other charsets */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
122 | if (!strstr(type, "utf-8")) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
123 | goto out; |
|
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 | if (channel) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
126 | silc_channel_message(client, conn, sender, channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
127 | payload, key, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
128 | SILC_MESSAGE_FLAG_UTF8, data, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
129 | data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
130 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
131 | silc_private_message(client, conn, sender, payload, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
132 | SILC_MESSAGE_FLAG_UTF8, data, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
133 | data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
134 | goto out; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
135 | } |
|
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 | /* Image */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
138 | if (strstr(type, "image/png") || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
139 | strstr(type, "image/jpeg") || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
140 | strstr(type, "image/gif") || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
141 | strstr(type, "image/tiff")) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
142 | char tmp[32]; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
143 | int imgid; |
|
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 | /* Get channel convo (if message is for channel) */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
146 | if (key && channel) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
147 | GList *l; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
148 | SilcPurplePrvgrp prv; |
|
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 | 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
|
151 | if (((SilcPurplePrvgrp)l->data)->key == key) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
152 | prv = l->data; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
153 | 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
|
154 | prv->channel, sg->account); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
155 | break; |
|
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 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
158 | if (channel && !convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
159 | 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
|
160 | 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
|
161 | if (channel && !convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
162 | goto out; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
163 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
164 | imgid = purple_imgstore_add_with_id(g_memdup(data, data_len), data_len, ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
165 | if (imgid) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
166 | cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
167 | g_snprintf(tmp, sizeof(tmp), "<IMG ID=\"%d\">", imgid); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
168 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
169 | if (channel) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
170 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
171 | sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
172 | sender->nickname : |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
173 | "<unknown>", cflags, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
174 | tmp, time(NULL)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
175 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
176 | serv_got_im(gc, sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
177 | sender->nickname : "<unknown>", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
178 | tmp, cflags, time(NULL)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
179 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
180 | purple_imgstore_unref_by_id(imgid); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
181 | cflags = 0; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
182 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
183 | goto out; |
|
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 | /* Whiteboard message */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
187 | if (strstr(type, "application/x-wb") && |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
188 | !purple_account_get_bool(sg->account, "block-wb", FALSE)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
189 | if (channel) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
190 | silcpurple_wb_receive_ch(client, conn, sender, channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
191 | payload, flags, data, data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
192 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
193 | silcpurple_wb_receive(client, conn, sender, payload, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
194 | flags, data, data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
195 | goto out; |
|
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 | out: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
199 | if (!recursive) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
200 | silc_mime_free(mime); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
201 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
202 | #endif /* HAVE_SILCMIME_H */ |
|
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 | /* Message for a channel. The `sender' is the sender of the message |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
205 | The `channel' is the channel. The `message' is the message. Note |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
206 | that `message' maybe NULL. The `flags' indicates message flags |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
207 | and it is used to determine how the message can be interpreted |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
208 | (like it may tell the message is multimedia message). */ |
|
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 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
211 | silc_channel_message(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
212 | SilcClientEntry sender, SilcChannelEntry channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
213 | SilcMessagePayload payload, SilcChannelPrivateKey key, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
214 | SilcMessageFlags flags, const unsigned char *message, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
215 | SilcUInt32 message_len) |
|
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 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
218 | 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
|
219 | PurpleConversation *convo = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
220 | char *msg, *tmp; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
221 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
222 | if (!message) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
223 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
224 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
225 | if (key) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
226 | GList *l; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
227 | SilcPurplePrvgrp prv; |
|
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 | 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
|
230 | if (((SilcPurplePrvgrp)l->data)->key == key) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
231 | prv = l->data; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
232 | 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
|
233 | prv->channel, sg->account); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
234 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
235 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
236 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
237 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
238 | 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
|
239 | 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
|
240 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
241 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
242 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
243 | if (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
|
244 | 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
|
245 | /* XXX */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
246 | } |
|
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 | if (flags & SILC_MESSAGE_FLAG_DATA) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
249 | /* Process MIME message */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
250 | #ifdef HAVE_SILCMIME_H |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
251 | SilcMime mime; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
252 | mime = silc_mime_decode(message, message_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
253 | silcpurple_mime_message(client, conn, sender, channel, payload, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
254 | key, flags, mime, FALSE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
255 | #else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
256 | char type[128], enc[128]; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
257 | unsigned char *data; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
258 | SilcUInt32 data_len; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
259 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
260 | memset(type, 0, sizeof(type)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
261 | memset(enc, 0, sizeof(enc)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
262 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
263 | if (!silc_mime_parse(message, message_len, NULL, 0, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
264 | type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
265 | &data_len)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
266 | return; |
|
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 | if (!strcmp(type, "application/x-wb") && |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
269 | !strcmp(enc, "binary") && |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
270 | !purple_account_get_bool(sg->account, "block-wb", FALSE)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
271 | silcpurple_wb_receive_ch(client, conn, sender, channel, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
272 | payload, flags, data, data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
273 | #endif |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
274 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
275 | } |
|
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 | if (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
|
278 | msg = g_strdup_printf("/me %s", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
279 | (const char *)message); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
280 | if (!msg) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
281 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
282 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
283 | tmp = g_markup_escape_text(msg, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
284 | /* Send to Purple */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
285 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
286 | sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
287 | sender->nickname : "<unknown>", 0, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
288 | tmp, time(NULL)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
289 | g_free(tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
290 | g_free(msg); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
291 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
292 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
293 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
294 | if (flags & SILC_MESSAGE_FLAG_NOTICE) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
295 | msg = g_strdup_printf("(notice) <I>%s</I> %s", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
296 | sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
297 | sender->nickname : "<unknown>", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
298 | (const char *)message); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
299 | if (!msg) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
300 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
301 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
302 | /* Send to Purple */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
303 | purple_conversation_write(convo, NULL, (const char *)msg, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
304 | 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
|
305 | g_free(msg); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
306 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
307 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
308 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
309 | if (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
|
310 | tmp = g_markup_escape_text((const char *)message, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
311 | /* Send to Purple */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
312 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
313 | sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
314 | sender->nickname : "<unknown>", 0, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
315 | tmp, time(NULL)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
316 | g_free(tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
317 | } |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
320 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
321 | /* Private message to the client. The `sender' is the sender of the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
322 | message. The message is `message'and maybe NULL. The `flags' |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
323 | indicates message flags and it is used to determine how the message |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
324 | can be interpreted (like it may tell the message is multimedia |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
325 | message). */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
326 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
327 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
328 | silc_private_message(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
329 | SilcClientEntry sender, SilcMessagePayload payload, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
330 | SilcMessageFlags flags, const unsigned char *message, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
331 | SilcUInt32 message_len) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
332 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
333 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
334 | 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
|
335 | PurpleConversation *convo = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
336 | char *msg, *tmp; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
337 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
338 | if (!message) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
339 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
340 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
341 | if (sender->nickname) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
342 | /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
343 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
344 | sender->nickname, sg->account); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
345 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
346 | if (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
|
347 | 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
|
348 | /* XXX */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
349 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
350 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
351 | if (flags & SILC_MESSAGE_FLAG_DATA) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
352 | #ifdef HAVE_SILCMIME_H |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
353 | /* Process MIME message */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
354 | SilcMime mime; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
355 | mime = silc_mime_decode(message, message_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
356 | silcpurple_mime_message(client, conn, sender, NULL, payload, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
357 | NULL, flags, mime, FALSE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
358 | #else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
359 | char type[128], enc[128]; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
360 | unsigned char *data; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
361 | SilcUInt32 data_len; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
362 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
363 | memset(type, 0, sizeof(type)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
364 | memset(enc, 0, sizeof(enc)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
365 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
366 | if (!silc_mime_parse(message, message_len, NULL, 0, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
367 | type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
368 | &data_len)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
369 | return; |
|
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 | if (!strcmp(type, "application/x-wb") && |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
372 | !strcmp(enc, "binary") && |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
373 | !purple_account_get_bool(sg->account, "block-wb", FALSE)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
374 | silcpurple_wb_receive(client, conn, sender, payload, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
375 | flags, data, data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
376 | #endif |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
377 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
378 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
379 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
380 | if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
381 | msg = g_strdup_printf("/me %s", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
382 | (const char *)message); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
383 | if (!msg) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
384 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
385 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
386 | tmp = g_markup_escape_text(msg, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
387 | /* Send to Purple */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
388 | serv_got_im(gc, sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
389 | sender->nickname : "<unknown>", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
390 | tmp, 0, time(NULL)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
391 | g_free(msg); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
392 | g_free(tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
393 | return; |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
396 | if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
397 | msg = g_strdup_printf("(notice) <I>%s</I> %s", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
398 | sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
399 | sender->nickname : "<unknown>", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
400 | (const char *)message); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
401 | if (!msg) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
402 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
403 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
404 | /* Send to Purple */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
405 | purple_conversation_write(convo, NULL, (const char *)msg, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
406 | 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
|
407 | g_free(msg); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
408 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
409 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
410 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
411 | if (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
|
412 | tmp = g_markup_escape_text((const char *)message, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
413 | /* Send to Purple */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
414 | serv_got_im(gc, sender->nickname ? |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
415 | sender->nickname : "<unknown>", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
416 | tmp, 0, time(NULL)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
417 | g_free(tmp); |
|
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 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
420 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
421 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
422 | /* Notify message to the client. The notify arguments are sent in the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
423 | same order as servers sends them. The arguments are same as received |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
424 | from the server except for ID's. If ID is received application receives |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
425 | the corresponding entry to the ID. For example, if Client ID is received |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
426 | application receives SilcClientEntry. Also, if the notify type is |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
427 | for channel the channel entry is sent to application (even if server |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
428 | does not send it because client library gets the channel entry from |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
429 | the Channel ID in the packet's header). */ |
|
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 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
432 | silc_notify(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
433 | SilcNotifyType type, ...) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
434 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
435 | va_list va; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
436 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
437 | 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
|
438 | PurpleConversation *convo; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
439 | SilcClientEntry client_entry, client_entry2; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
440 | SilcChannelEntry channel; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
441 | SilcServerEntry server_entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
442 | SilcIdType idtype; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
443 | void *entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
444 | SilcUInt32 mode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
445 | SilcHashTableList htl; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
446 | SilcChannelUser chu; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
447 | char buf[512], buf2[512], *tmp, *name; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
448 | SilcNotifyType notify; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
449 | PurpleBuddy *b; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
450 | int i; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
451 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
452 | va_start(va, type); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
453 | memset(buf, 0, sizeof(buf)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
454 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
455 | switch (type) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
456 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
457 | case SILC_NOTIFY_TYPE_NONE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
458 | break; |
|
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 | case SILC_NOTIFY_TYPE_INVITE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
461 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
462 | GHashTable *components; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
463 | va_arg(va, SilcChannelEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
464 | name = va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
465 | client_entry = va_arg(va, SilcClientEntry); |
|
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 | components = 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
|
468 | g_hash_table_insert(components, strdup("channel"), strdup(name)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
469 | serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
470 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
471 | break; |
|
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 | case SILC_NOTIFY_TYPE_JOIN: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
474 | client_entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
475 | channel = va_arg(va, SilcChannelEntry); |
|
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 | /* If we joined channel, do nothing */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
478 | if (client_entry == conn->local_entry) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
479 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
480 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
481 | 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
|
482 | 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
|
483 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
484 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
485 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
486 | /* Join user to channel */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
487 | g_snprintf(buf, sizeof(buf), "%s@%s", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
488 | client_entry->username, client_entry->hostname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
489 | purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
490 | g_strdup(client_entry->nickname), buf, PURPLE_CBFLAGS_NONE, TRUE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
491 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
492 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
493 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
494 | case SILC_NOTIFY_TYPE_LEAVE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
495 | client_entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
496 | channel = va_arg(va, SilcChannelEntry); |
|
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 | 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
|
499 | 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
|
500 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
501 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
502 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
503 | /* Remove user from channel */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
504 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
505 | client_entry->nickname, NULL); |
|
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 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
508 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
509 | case SILC_NOTIFY_TYPE_SIGNOFF: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
510 | client_entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
511 | tmp = va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
512 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
513 | if (!client_entry->nickname) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
514 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
515 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
516 | /* Remove from all channels */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
517 | silc_hash_table_list(client_entry->channels, &htl); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
518 | 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
|
519 | 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
|
520 | chu->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
|
521 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
522 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
523 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
524 | client_entry->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
525 | tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
526 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
527 | 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
|
528 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
529 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
530 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
531 | case SILC_NOTIFY_TYPE_TOPIC_SET: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
532 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
533 | char *esc, *tmp2; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
534 | idtype = va_arg(va, int); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
535 | entry = va_arg(va, void *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
536 | tmp = va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
537 | channel = va_arg(va, SilcChannelEntry); |
|
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 | 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
|
540 | 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
|
541 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
542 | break; |
|
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 | if (!tmp) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
545 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
546 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
547 | esc = g_markup_escape_text(tmp, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
548 | tmp2 = purple_markup_linkify(esc); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
549 | g_free(esc); |
|
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 | if (idtype == SILC_ID_CLIENT) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
552 | client_entry = (SilcClientEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
553 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
554 | _("%s has changed the topic of <I>%s</I> to: %s"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
555 | client_entry->nickname, channel->channel_name, tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
556 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
557 | buf, 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
|
558 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
559 | client_entry->nickname, tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
560 | } else if (idtype == SILC_ID_SERVER) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
561 | server_entry = (SilcServerEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
562 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
563 | _("%s has changed the topic of <I>%s</I> to: %s"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
564 | server_entry->server_name, channel->channel_name, tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
565 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), server_entry->server_name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
566 | buf, 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
|
567 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
568 | server_entry->server_name, tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
569 | } else if (idtype == SILC_ID_CHANNEL) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
570 | channel = (SilcChannelEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
571 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
572 | _("%s has changed the topic of <I>%s</I> to: %s"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
573 | channel->channel_name, channel->channel_name, tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
574 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
575 | buf, 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
|
576 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
577 | channel->channel_name, tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
578 | } else { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
579 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
580 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
581 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
582 | g_free(tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
583 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
584 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
585 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
586 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
587 | case SILC_NOTIFY_TYPE_NICK_CHANGE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
588 | client_entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
589 | client_entry2 = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
590 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
591 | if (!strcmp(client_entry->nickname, client_entry2->nickname)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
592 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
593 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
594 | /* Change nick on all channels */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
595 | silc_hash_table_list(client_entry2->channels, &htl); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
596 | 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
|
597 | 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
|
598 | chu->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
|
599 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
600 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
601 | if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), client_entry->nickname)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
602 | purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
603 | client_entry->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
604 | client_entry2->nickname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
605 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
606 | 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
|
607 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
608 | break; |
|
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 | case SILC_NOTIFY_TYPE_CMODE_CHANGE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
611 | idtype = va_arg(va, int); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
612 | entry = va_arg(va, void *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
613 | mode = va_arg(va, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
614 | (void)va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
615 | (void)va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
616 | (void)va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
617 | (void)va_arg(va, SilcPublicKey); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
618 | (void)va_arg(va, SilcBuffer); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
619 | channel = va_arg(va, SilcChannelEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
620 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
621 | 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
|
622 | 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
|
623 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
624 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
625 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
626 | if (idtype == SILC_ID_CLIENT) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
627 | name = ((SilcClientEntry)entry)->nickname; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
628 | else if (idtype == SILC_ID_SERVER) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
629 | name = ((SilcServerEntry)entry)->server_name; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
630 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
631 | name = ((SilcChannelEntry)entry)->channel_name; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
632 | if (!name) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
633 | break; |
|
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 | if (mode) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
636 | silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
637 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
638 | _("<I>%s</I> set channel <I>%s</I> modes to: %s"), name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
639 | channel->channel_name, buf2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
640 | } else { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
641 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
642 | _("<I>%s</I> removed all channel <I>%s</I> modes"), name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
643 | channel->channel_name); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
644 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
645 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
646 | buf, 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
|
647 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
648 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
649 | case SILC_NOTIFY_TYPE_CUMODE_CHANGE: |
|
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 | PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
652 | idtype = va_arg(va, int); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
653 | entry = va_arg(va, void *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
654 | mode = va_arg(va, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
655 | client_entry2 = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
656 | channel = va_arg(va, SilcChannelEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
657 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
658 | 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
|
659 | 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
|
660 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
661 | break; |
|
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 | if (idtype == SILC_ID_CLIENT) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
664 | name = ((SilcClientEntry)entry)->nickname; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
665 | else if (idtype == SILC_ID_SERVER) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
666 | name = ((SilcServerEntry)entry)->server_name; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
667 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
668 | name = ((SilcChannelEntry)entry)->channel_name; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
669 | if (!name) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
670 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
671 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
672 | if (mode) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
673 | silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
674 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
675 | _("<I>%s</I> set <I>%s's</I> modes to: %s"), name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
676 | client_entry2->nickname, buf2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
677 | 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
|
678 | flags |= PURPLE_CBFLAGS_FOUNDER; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
679 | 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
|
680 | flags |= PURPLE_CBFLAGS_OP; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
681 | } else { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
682 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
683 | _("<I>%s</I> removed all <I>%s's</I> modes"), name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
684 | client_entry2->nickname); |
|
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 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
687 | buf, 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
|
688 | purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), client_entry2->nickname, flags); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
689 | break; |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
692 | case SILC_NOTIFY_TYPE_MOTD: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
693 | tmp = va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
694 | silc_free(sg->motd); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
695 | sg->motd = silc_memdup(tmp, strlen(tmp)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
696 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
697 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
698 | case SILC_NOTIFY_TYPE_KICKED: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
699 | client_entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
700 | tmp = va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
701 | client_entry2 = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
702 | channel = va_arg(va, SilcChannelEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
703 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
704 | 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
|
705 | 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
|
706 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
707 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
708 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
709 | if (client_entry == conn->local_entry) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
710 | /* Remove us from channel */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
711 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
712 | _("You have been kicked off <I>%s</I> by <I>%s</I> (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
713 | channel->channel_name, client_entry2->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
714 | tmp ? tmp : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
715 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
716 | buf, 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
|
717 | serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
718 | } else { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
719 | /* Remove user from channel */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
720 | g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
721 | client_entry2->nickname, tmp ? tmp : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
722 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
723 | client_entry->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
724 | buf); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
725 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
726 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
727 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
728 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
729 | case SILC_NOTIFY_TYPE_KILLED: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
730 | client_entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
731 | tmp = va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
732 | idtype = va_arg(va, int); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
733 | entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
734 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
735 | if (!client_entry->nickname) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
736 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
737 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
738 | if (client_entry == conn->local_entry) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
739 | if (idtype == SILC_ID_CLIENT) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
740 | client_entry2 = (SilcClientEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
741 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
742 | _("You have been killed by %s (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
743 | client_entry2->nickname, tmp ? tmp : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
744 | } else if (idtype == SILC_ID_SERVER) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
745 | server_entry = (SilcServerEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
746 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
747 | _("You have been killed by %s (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
748 | server_entry->server_name, tmp ? tmp : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
749 | } else if (idtype == SILC_ID_CHANNEL) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
750 | channel = (SilcChannelEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
751 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
752 | _("You have been killed by %s (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
753 | channel->channel_name, tmp ? tmp : ""); |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
756 | /* Remove us from all channels */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
757 | silc_hash_table_list(client_entry->channels, &htl); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
758 | 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
|
759 | 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
|
760 | chu->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
|
761 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
762 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
763 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
764 | buf, 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
|
765 | serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
766 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
767 | 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
|
768 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
769 | } else { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
770 | if (idtype == SILC_ID_CLIENT) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
771 | client_entry2 = (SilcClientEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
772 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
773 | _("Killed by %s (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
774 | client_entry2->nickname, tmp ? tmp : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
775 | } else if (idtype == SILC_ID_SERVER) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
776 | server_entry = (SilcServerEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
777 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
778 | _("Killed by %s (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
779 | server_entry->server_name, tmp ? tmp : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
780 | } else if (idtype == SILC_ID_CHANNEL) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
781 | channel = (SilcChannelEntry)entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
782 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
783 | _("Killed by %s (%s)"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
784 | channel->channel_name, tmp ? tmp : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
785 | } |
|
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 | /* Remove user from all channels */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
788 | silc_hash_table_list(client_entry->channels, &htl); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
789 | 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
|
790 | 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
|
791 | chu->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
|
792 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
793 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
794 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
795 | client_entry->nickname, tmp); |
|
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 | 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
|
798 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
799 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
800 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
801 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
802 | case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
803 | break; |
|
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 | case SILC_NOTIFY_TYPE_SERVER_SIGNOFF: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
806 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
807 | int i; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
808 | SilcClientEntry *clients; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
809 | SilcUInt32 clients_count; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
810 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
811 | (void)va_arg(va, void *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
812 | clients = va_arg(va, SilcClientEntry *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
813 | clients_count = va_arg(va, SilcUInt32); |
|
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 | for (i = 0; i < clients_count; i++) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
816 | if (!clients[i]->nickname) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
817 | break; |
|
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 | /* Remove from all channels */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
820 | silc_hash_table_list(clients[i]->channels, &htl); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
821 | 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
|
822 | convo = |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
823 | 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
|
824 | chu->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
|
825 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
826 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
827 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
828 | clients[i]->nickname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
829 | _("Server signoff")); |
|
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 | 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
|
832 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
833 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
834 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
835 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
836 | case SILC_NOTIFY_TYPE_ERROR: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
837 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
838 | SilcStatus error = va_arg(va, int); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
839 | purple_notify_error(gc, "Error Notify", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
840 | silc_get_status_message(error), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
841 | NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
842 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
843 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
844 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
845 | case SILC_NOTIFY_TYPE_WATCH: |
|
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 | SilcPublicKey public_key; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
848 | unsigned char *pk; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
849 | SilcUInt32 pk_len; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
850 | char *fingerprint; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
851 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
852 | client_entry = va_arg(va, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
853 | (void)va_arg(va, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
854 | mode = va_arg(va, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
855 | notify = va_arg(va, int); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
856 | public_key = va_arg(va, SilcPublicKey); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
857 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
858 | b = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
859 | if (public_key) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
860 | PurpleBlistNode *gnode, *cnode, *bnode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
861 | const char *f; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
862 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
863 | pk = silc_pkcs_public_key_encode(public_key, &pk_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
864 | if (!pk) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
865 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
866 | 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
|
867 | for (i = 0; i < strlen(fingerprint); i++) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
868 | if (fingerprint[i] == ' ') |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
869 | fingerprint[i] = '_'; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
870 | g_snprintf(buf, sizeof(buf) - 1, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
871 | "%s" G_DIR_SEPARATOR_S "clientkeys" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
872 | G_DIR_SEPARATOR_S "clientkey_%s.pub", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
873 | silcpurple_silcdir(), fingerprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
874 | silc_free(fingerprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
875 | silc_free(pk); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
876 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
877 | /* Find buddy by associated public key */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
878 | for (gnode = purple_get_blist()->root; gnode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
879 | gnode = gnode->next) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
880 | if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
881 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
882 | for (cnode = gnode->child; cnode; cnode = cnode->next) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
883 | if( !PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
884 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
885 | for (bnode = cnode->child; bnode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
886 | bnode = bnode->next) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
887 | if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
888 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
889 | b = (PurpleBuddy *)bnode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
890 | if (b->account != gc->account) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
891 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
892 | f = purple_blist_node_get_string(bnode, "public-key"); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
893 | if (f && !strcmp(f, buf)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
894 | goto cont; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
895 | b = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
896 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
897 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
898 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
899 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
900 | cont: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
901 | if (!b) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
902 | /* Find buddy by nickname */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
903 | b = purple_find_buddy(sg->account, client_entry->nickname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
904 | if (!b) { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17677
diff
changeset
|
905 | purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", |
|
17674
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
906 | client_entry->nickname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
907 | break; |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
911 | silc_free(b->proto_data); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
912 | b->proto_data = silc_memdup(client_entry->id, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
913 | sizeof(*client_entry->id)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
914 | if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
915 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
916 | } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
917 | /* See if client was away and is now present */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
918 | if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
919 | SILC_UMODE_BUSY | SILC_UMODE_PAGE | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
920 | SILC_UMODE_DETACHED)) && |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
921 | (client_entry->mode & SILC_UMODE_GONE || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
922 | client_entry->mode & SILC_UMODE_INDISPOSED || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
923 | client_entry->mode & SILC_UMODE_BUSY || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
924 | client_entry->mode & SILC_UMODE_PAGE || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
925 | client_entry->mode & SILC_UMODE_DETACHED)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
926 | client_entry->mode = mode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
927 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); |
|
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 | else if ((mode & SILC_UMODE_GONE) || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
930 | (mode & SILC_UMODE_INDISPOSED) || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
931 | (mode & SILC_UMODE_BUSY) || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
932 | (mode & SILC_UMODE_PAGE) || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
933 | (mode & SILC_UMODE_DETACHED)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
934 | client_entry->mode = mode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
935 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
936 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
937 | } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
938 | notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
939 | notify == SILC_NOTIFY_TYPE_KILLED) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
940 | client_entry->mode = mode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
941 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
942 | } else if (notify == SILC_NOTIFY_TYPE_NONE) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
943 | client_entry->mode = mode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
944 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); |
|
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 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
948 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
949 | default: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
950 | purple_debug_info("silc", "Unhandled notification: %d\n", type); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
951 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
952 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
953 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
954 | va_end(va); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
955 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
956 | |
|
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 | /* Command handler. This function is called always in the command function. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
959 | If error occurs it will be called as well. `conn' is the associated |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
960 | client connection. `cmd_context' is the command context that was |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
961 | originally sent to the command. `success' is FALSE if error occurred |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
962 | during command. `command' is the command being processed. It must be |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
963 | noted that this is not reply from server. This is merely called just |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
964 | after application has called the command. Just to tell application |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
965 | that the command really was processed. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
966 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
967 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
968 | silc_command(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
969 | SilcClientCommandContext cmd_context, bool success, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
970 | SilcCommand command, SilcStatus status) |
|
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 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
973 | 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
|
974 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
975 | switch (command) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
976 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
977 | case SILC_COMMAND_CMODE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
978 | if (cmd_context->argc == 3 && |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
979 | !strcmp((char *)cmd_context->argv[2], "+C")) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
980 | sg->chpk = TRUE; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
981 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
982 | sg->chpk = FALSE; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
983 | break; |
|
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 | default: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
986 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
987 | } |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
990 | #if 0 |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
991 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
992 | silcpurple_whois_more(SilcClientEntry client_entry, gint id) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
993 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
994 | SilcAttributePayload attr; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
995 | SilcAttribute attribute; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
996 | char *buf; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
997 | GString *s; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
998 | SilcVCardStruct vcard; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
999 | int i; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1000 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1001 | if (id != 0) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1002 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1003 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1004 | memset(&vcard, 0, sizeof(vcard)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1005 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1006 | s = g_string_new(""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1007 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1008 | silc_dlist_start(client_entry->attrs); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1009 | while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1010 | attribute = silc_attribute_get_attribute(attr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1011 | switch (attribute) { |
|
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 | case SILC_ATTRIBUTE_USER_INFO: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1014 | if (!silc_attribute_get_object(attr, (void *)&vcard, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1015 | sizeof(vcard))) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1016 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1017 | g_string_append_printf(s, "%s:\n\n", _("Personal Information")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1018 | if (vcard.full_name) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1019 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1020 | _("Full Name"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1021 | vcard.full_name); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1022 | if (vcard.first_name) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1023 | g_string_append_printf(s, "%s:\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1024 | _("First Name"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1025 | vcard.first_name); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1026 | if (vcard.middle_names) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1027 | g_string_append_printf(s, "%s:\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1028 | _("Middle Name"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1029 | vcard.middle_names); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1030 | if (vcard.family_name) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1031 | g_string_append_printf(s, "%s:\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1032 | _("Family Name"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1033 | vcard.family_name); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1034 | if (vcard.nickname) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1035 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1036 | _("Nickname"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1037 | vcard.nickname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1038 | if (vcard.bday) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1039 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1040 | _("Birth Day"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1041 | vcard.bday); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1042 | if (vcard.title) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1043 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1044 | _("Job Title"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1045 | vcard.title); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1046 | if (vcard.role) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1047 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1048 | _("Job Role"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1049 | vcard.role); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1050 | if (vcard.org_name) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1051 | g_string_append_printf(s, "%s:\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1052 | _("Organization"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1053 | vcard.org_name); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1054 | if (vcard.org_unit) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1055 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1056 | _("Unit"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1057 | vcard.org_unit); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1058 | if (vcard.url) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1059 | g_string_append_printf(s, "%s:\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1060 | _("Homepage"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1061 | vcard.url); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1062 | if (vcard.label) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1063 | g_string_append_printf(s, "%s:\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1064 | _("Address"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1065 | vcard.label); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1066 | for (i = 0; i < vcard.num_tels; i++) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1067 | if (vcard.tels[i].telnum) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1068 | g_string_append_printf(s, "%s:\t\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1069 | _("Phone"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1070 | vcard.tels[i].telnum); |
|
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 | for (i = 0; i < vcard.num_emails; i++) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1073 | if (vcard.emails[i].address) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1074 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1075 | _("E-Mail"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1076 | vcard.emails[i].address); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1077 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1078 | if (vcard.note) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1079 | g_string_append_printf(s, "\n%s:\t\t%s\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1080 | _("Note"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1081 | vcard.note); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1082 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1083 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1084 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1085 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1086 | 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
|
1087 | purple_notify_info(NULL, _("User Information"), _("User Information"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1088 | buf); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1089 | g_free(buf); |
|
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 | #endif |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1092 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1093 | /* Command reply handler. This function is called always in the command reply |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1094 | function. If error occurs it will be called as well. Normal scenario |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1095 | is that it will be called after the received command data has been parsed |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1096 | and processed. The function is used to pass the received command data to |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1097 | the application. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1098 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1099 | `conn' is the associated client connection. `cmd_payload' is the command |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1100 | payload data received from server and it can be ignored. It is provided |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1101 | if the application would like to re-parse the received command data, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1102 | however, it must be noted that the data is parsed already by the library |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1103 | thus the payload can be ignored. `success' is FALSE if error occurred. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1104 | In this case arguments are not sent to the application. The `status' is |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1105 | the command reply status server returned. The `command' is the command |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1106 | reply being processed. The function has variable argument list and each |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1107 | command defines the number and type of arguments it passes to the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1108 | application (on error they are not sent). */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1109 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1110 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1111 | silc_command_reply(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1112 | SilcCommandPayload cmd_payload, bool success, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1113 | SilcCommand command, SilcStatus status, ...) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1114 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1115 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1116 | 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
|
1117 | PurpleConversation *convo; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1118 | va_list vp; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1119 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1120 | va_start(vp, status); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1121 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1122 | switch (command) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1123 | case SILC_COMMAND_JOIN: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1124 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1125 | SilcChannelEntry channel_entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1126 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1127 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1128 | purple_notify_error(gc, _("Join Chat"), _("Cannot join channel"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1129 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1130 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1131 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1132 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1133 | (void)va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1134 | channel_entry = va_arg(vp, SilcChannelEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1135 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1136 | /* Resolve users on channel */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1137 | silc_client_get_clients_by_channel(client, conn, channel_entry, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1138 | silcpurple_chat_join_done, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1139 | channel_entry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1140 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1141 | break; |
|
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 | case SILC_COMMAND_LEAVE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1144 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1145 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1146 | case SILC_COMMAND_USERS: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1147 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1148 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1149 | case SILC_COMMAND_WHOIS: |
|
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 | SilcUInt32 idle, mode; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1152 | SilcBuffer channels, user_modes; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1153 | SilcClientEntry client_entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1154 | char tmp[1024], *tmp2; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1155 | char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1156 | PurpleNotifyUserInfo *user_info; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1157 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1158 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1159 | purple_notify_error(gc, _("User Information"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1160 | _("Cannot get user information"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1161 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1162 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1163 | } |
|
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 | client_entry = va_arg(vp, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1166 | if (!client_entry->nickname) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1167 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1168 | (void)va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1169 | (void)va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1170 | (void)va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1171 | channels = va_arg(vp, SilcBuffer); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1172 | mode = va_arg(vp, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1173 | idle = va_arg(vp, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1174 | (void)va_arg(vp, unsigned char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1175 | user_modes = va_arg(vp, SilcBuffer); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1176 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1177 | user_info = purple_notify_user_info_new(); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1178 | tmp2 = g_markup_escape_text(client_entry->nickname, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1179 | purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1180 | g_free(tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1181 | if (client_entry->realname) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1182 | tmp2 = g_markup_escape_text(client_entry->realname, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1183 | purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1184 | g_free(tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1185 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1186 | if (client_entry->username) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1187 | tmp2 = g_markup_escape_text(client_entry->username, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1188 | if (client_entry->hostname) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1189 | gchar *tmp3; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1190 | tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1191 | purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1192 | g_free(tmp3); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1193 | } else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1194 | purple_notify_user_info_add_pair(user_info, _("Username"), tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1195 | g_free(tmp2); |
|
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 | if (client_entry->mode) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1199 | memset(tmp, 0, sizeof(tmp)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1200 | silcpurple_get_umode_string(client_entry->mode, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1201 | tmp, sizeof(tmp) - strlen(tmp)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1202 | purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1203 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1204 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1205 | silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1206 | if (moodstr) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1207 | purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1208 | g_free(moodstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1209 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1210 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1211 | if (statusstr) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1212 | tmp2 = g_markup_escape_text(statusstr, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1213 | purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1214 | g_free(statusstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1215 | g_free(tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1216 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1217 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1218 | if (contactstr) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1219 | purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1220 | g_free(contactstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1221 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1222 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1223 | if (langstr) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1224 | purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1225 | g_free(langstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1226 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1227 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1228 | if (devicestr) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1229 | purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1230 | g_free(devicestr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1231 | } |
|
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 | if (tzstr) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1234 | purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1235 | g_free(tzstr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1236 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1237 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1238 | if (geostr) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1239 | purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1240 | g_free(geostr); |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1243 | if (client_entry->server) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1244 | purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); |
|
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 | if (channels && user_modes) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1247 | SilcUInt32 *umodes; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1248 | SilcDList list = |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1249 | silc_channel_payload_parse_list(channels->data, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1250 | channels->len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1251 | if (list && silc_get_mode_list(user_modes, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1252 | silc_dlist_count(list), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1253 | &umodes)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1254 | SilcChannelPayload entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1255 | int i = 0; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1256 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1257 | memset(tmp, 0, sizeof(tmp)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1258 | silc_dlist_start(list); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1259 | while ((entry = silc_dlist_get(list)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1260 | != SILC_LIST_END) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1261 | SilcUInt32 name_len; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1262 | char *m = silc_client_chumode_char(umodes[i++]); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1263 | char *name = (char *)silc_channel_get_name(entry, &name_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1264 | if (m) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1265 | silc_strncat(tmp, sizeof(tmp) - 1, m, strlen(m)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1266 | silc_strncat(tmp, sizeof(tmp) - 1, name, name_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1267 | silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1268 | silc_free(m); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1269 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1270 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1271 | tmp2 = g_markup_escape_text(tmp, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1272 | purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1273 | g_free(tmp2); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1274 | silc_free(umodes); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1275 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1276 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1277 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1278 | if (client_entry->public_key) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1279 | char *fingerprint, *babbleprint; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1280 | unsigned char *pk; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1281 | SilcUInt32 pk_len; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1282 | pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1283 | 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
|
1284 | 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
|
1285 | purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1286 | purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1287 | silc_free(fingerprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1288 | silc_free(babbleprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1289 | silc_free(pk); |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1292 | #if 0 /* XXX for now, let's not show attrs here */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1293 | if (client_entry->attrs) |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1294 | purple_request_action(gc, _("User Information"), |
|
17674
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1295 | _("User Information"), |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1296 | buf, 1, client_entry, 2, |
|
17674
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1297 | _("OK"), G_CALLBACK(silcpurple_whois_more), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1298 | _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1299 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1300 | #endif |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1301 | purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1302 | purple_notify_user_info_destroy(user_info); |
|
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 | break; |
|
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 | case SILC_COMMAND_WHOWAS: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1307 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1308 | SilcClientEntry client_entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1309 | char *nickname, *realname, *username, *tmp; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1310 | PurpleNotifyUserInfo *user_info; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1311 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1312 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1313 | purple_notify_error(gc, _("User Information"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1314 | _("Cannot get user information"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1315 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1316 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1317 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1318 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1319 | client_entry = va_arg(vp, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1320 | nickname = va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1321 | username = va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1322 | realname = va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1323 | if (!nickname) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1324 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1325 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1326 | user_info = purple_notify_user_info_new(); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1327 | tmp = g_markup_escape_text(nickname, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1328 | purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1329 | g_free(tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1330 | if (realname) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1331 | tmp = g_markup_escape_text(realname, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1332 | purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1333 | g_free(tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1334 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1335 | if (username) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1336 | tmp = g_markup_escape_text(username, -1); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1337 | if (client_entry && client_entry->hostname) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1338 | gchar *tmp3; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1339 | tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1340 | purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1341 | g_free(tmp3); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1342 | } else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1343 | purple_notify_user_info_add_pair(user_info, _("Username"), tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1344 | g_free(tmp); |
|
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 | if (client_entry && client_entry->server) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1347 | purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); |
|
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 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1350 | if (client_entry && client_entry->public_key) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1351 | char *fingerprint, *babbleprint; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1352 | unsigned char *pk; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1353 | SilcUInt32 pk_len; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1354 | pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1355 | 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
|
1356 | 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
|
1357 | purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1358 | purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1359 | silc_free(fingerprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1360 | silc_free(babbleprint); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1361 | silc_free(pk); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1362 | } |
|
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 | purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1365 | purple_notify_user_info_destroy(user_info); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1366 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1367 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1368 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1369 | case SILC_COMMAND_DETACH: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1370 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1371 | purple_notify_error(gc, _("Detach From Server"), _("Cannot detach"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1372 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1373 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1374 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1375 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1376 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1377 | case SILC_COMMAND_TOPIC: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1378 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1379 | SilcChannelEntry channel; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1380 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1381 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1382 | purple_notify_error(gc, _("Topic"), _("Cannot set topic"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1383 | silc_get_status_message(status)); |
|
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 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1386 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1387 | channel = va_arg(vp, SilcChannelEntry); |
|
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 | 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
|
1390 | 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
|
1391 | if (!convo) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1392 | purple_debug_error("silc", "Got a topic for %s, which doesn't exist\n", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1393 | channel->channel_name); |
|
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 | /* Set topic */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1398 | if (channel->topic) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1399 | 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
|
1400 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1401 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1402 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1403 | case SILC_COMMAND_NICK: |
|
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 | /* I don't think we should need to do this because the server should |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1406 | * be sending a SILC_NOTIFY_TYPE_NICK_CHANGE when we change our own |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1407 | * nick, but it isn't, so we deal with it here instead. Stu. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1408 | SilcClientEntry local_entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1409 | SilcHashTableList htl; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1410 | SilcChannelUser chu; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1411 | const char *oldnick; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1412 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1413 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1414 | purple_notify_error(gc, _("Nick"), _("Failed to change nickname"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1415 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1416 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1417 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1418 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1419 | local_entry = va_arg(vp, SilcClientEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1420 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1421 | /* Change nick on all channels */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1422 | silc_hash_table_list(local_entry->channels, &htl); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1423 | 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
|
1424 | 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
|
1425 | chu->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
|
1426 | if (!convo) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1427 | continue; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1428 | oldnick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(convo)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1429 | if (strcmp(oldnick, purple_normalize(purple_conversation_get_account(convo), local_entry->nickname))) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1430 | purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1431 | oldnick, local_entry->nickname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1432 | purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), local_entry->nickname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1433 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1434 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1435 | 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
|
1436 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1437 | purple_connection_set_display_name(gc, local_entry->nickname); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1438 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1439 | break; |
|
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 | case SILC_COMMAND_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 | char *topic, *name; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1444 | int usercount; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1445 | PurpleRoomlistRoom *room; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1446 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1447 | if (sg->roomlist_canceled) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1448 | break; |
|
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 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1451 | purple_notify_error(gc, _("Error"), _("Error retrieving room list"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1452 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1453 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1454 | 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
|
1455 | sg->roomlist = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1456 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1457 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1458 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1459 | (void)va_arg(vp, SilcChannelEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1460 | name = va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1461 | if (!name) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1462 | purple_notify_error(gc, _("Roomlist"), _("Cannot get room list"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1463 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1464 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1465 | 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
|
1466 | sg->roomlist = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1467 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1468 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1469 | topic = va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1470 | usercount = va_arg(vp, int); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1471 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1472 | room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1473 | purple_roomlist_room_add_field(sg->roomlist, room, name); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1474 | purple_roomlist_room_add_field(sg->roomlist, room, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1475 | SILC_32_TO_PTR(usercount)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1476 | purple_roomlist_room_add_field(sg->roomlist, room, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1477 | topic ? topic : ""); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1478 | purple_roomlist_room_add(sg->roomlist, room); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1479 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1480 | if (status == SILC_STATUS_LIST_END || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1481 | status == SILC_STATUS_OK) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1482 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1483 | 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
|
1484 | sg->roomlist = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1485 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1486 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1487 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1488 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1489 | case SILC_COMMAND_GETKEY: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1490 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1491 | SilcPublicKey public_key; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1492 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1493 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1494 | purple_notify_error(gc, _("Get Public Key"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1495 | _("Cannot fetch the public key"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1496 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1497 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1498 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1499 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1500 | (void)va_arg(vp, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1501 | (void)va_arg(vp, void *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1502 | public_key = va_arg(vp, SilcPublicKey); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1503 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1504 | if (!public_key) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1505 | purple_notify_error(gc, _("Get Public Key"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1506 | _("Cannot fetch the public key"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1507 | _("No public key was received")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1508 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1509 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1510 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1511 | case SILC_COMMAND_INFO: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1512 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1513 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1514 | char *server_name; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1515 | char *server_info; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1516 | char tmp[256]; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1517 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1518 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1519 | purple_notify_error(gc, _("Server Information"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1520 | _("Cannot get server information"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1521 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1522 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1523 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1524 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1525 | (void)va_arg(vp, SilcServerEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1526 | server_name = va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1527 | server_info = va_arg(vp, char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1528 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1529 | if (server_name && server_info) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1530 | g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1531 | server_name, server_info); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1532 | purple_notify_info(gc, NULL, _("Server Information"), tmp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1533 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1534 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1535 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1536 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1537 | case SILC_COMMAND_STATS: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1538 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1539 | SilcUInt32 starttime, uptime, my_clients, my_channels, my_server_ops, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1540 | my_router_ops, cell_clients, cell_channels, cell_servers, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1541 | clients, channels, servers, routers, server_ops, router_ops; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1542 | SilcUInt32 buffer_length; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1543 | SilcBufferStruct buf; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1544 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1545 | unsigned char *server_stats; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1546 | char *msg; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1547 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1548 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1549 | purple_notify_error(gc, _("Server Statistics"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1550 | _("Cannot get server statistics"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1551 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1552 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1553 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1554 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1555 | server_stats = va_arg(vp, unsigned char *); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1556 | buffer_length = va_arg(vp, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1557 | if (!server_stats || !buffer_length) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1558 | purple_notify_error(gc, _("Server Statistics"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1559 | _("No server statistics available"), NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1560 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1561 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1562 | silc_buffer_set(&buf, server_stats, buffer_length); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1563 | silc_buffer_unformat(&buf, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1564 | SILC_STR_UI_INT(&starttime), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1565 | SILC_STR_UI_INT(&uptime), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1566 | SILC_STR_UI_INT(&my_clients), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1567 | SILC_STR_UI_INT(&my_channels), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1568 | SILC_STR_UI_INT(&my_server_ops), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1569 | SILC_STR_UI_INT(&my_router_ops), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1570 | SILC_STR_UI_INT(&cell_clients), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1571 | SILC_STR_UI_INT(&cell_channels), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1572 | SILC_STR_UI_INT(&cell_servers), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1573 | SILC_STR_UI_INT(&clients), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1574 | SILC_STR_UI_INT(&channels), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1575 | SILC_STR_UI_INT(&servers), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1576 | SILC_STR_UI_INT(&routers), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1577 | SILC_STR_UI_INT(&server_ops), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1578 | SILC_STR_UI_INT(&router_ops), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1579 | SILC_STR_END); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1580 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1581 | msg = g_strdup_printf(_("Local server start time: %s\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1582 | "Local server uptime: %s\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1583 | "Local server clients: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1584 | "Local server channels: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1585 | "Local server operators: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1586 | "Local router operators: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1587 | "Local cell clients: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1588 | "Local cell channels: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1589 | "Local cell servers: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1590 | "Total clients: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1591 | "Total channels: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1592 | "Total servers: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1593 | "Total routers: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1594 | "Total server operators: %d\n" |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1595 | "Total router operators: %d\n"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1596 | silc_get_time(starttime), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1597 | purple_str_seconds_to_string((int)uptime), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1598 | (int)my_clients, (int)my_channels, (int)my_server_ops, (int)my_router_ops, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1599 | (int)cell_clients, (int)cell_channels, (int)cell_servers, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1600 | (int)clients, (int)channels, (int)servers, (int)routers, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1601 | (int)server_ops, (int)router_ops); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1602 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1603 | purple_notify_info(gc, NULL, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1604 | _("Network Statistics"), msg); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1605 | g_free(msg); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1606 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1607 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1608 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1609 | case SILC_COMMAND_PING: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1610 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1611 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1612 | purple_notify_error(gc, _("Ping"), _("Ping failed"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1613 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1614 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1615 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1616 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1617 | purple_notify_info(gc, _("Ping"), _("Ping reply received from server"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1618 | NULL); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1619 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1620 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1621 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1622 | case SILC_COMMAND_KILL: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1623 | if (!success) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1624 | purple_notify_error(gc, _("Kill User"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1625 | _("Could not kill user"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1626 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1627 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1628 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1629 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1630 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1631 | case SILC_COMMAND_CMODE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1632 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1633 | SilcChannelEntry channel_entry; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1634 | SilcBuffer channel_pubkeys; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1635 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1636 | if (!success) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1637 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1638 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1639 | channel_entry = va_arg(vp, SilcChannelEntry); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1640 | (void)va_arg(vp, SilcUInt32); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1641 | (void)va_arg(vp, SilcPublicKey); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1642 | channel_pubkeys = va_arg(vp, SilcBuffer); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1643 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1644 | if (sg->chpk) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1645 | silcpurple_chat_chauth_show(sg, channel_entry, channel_pubkeys); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1646 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1647 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1648 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1649 | default: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1650 | if (success) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1651 | purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1652 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1653 | purple_debug_info("silc", "Unhandled command: %d (failed: %s)\n", command, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1654 | silc_get_status_message(status)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1655 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1656 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1657 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1658 | va_end(vp); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1659 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1660 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1661 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1662 | /* Called to indicate that connection was either successfully established |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1663 | or connecting failed. This is also the first time application receives |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1664 | the SilcClientConnection object which it should save somewhere. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1665 | If the `success' is FALSE the application must always call the function |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1666 | silc_client_close_connection. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1667 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1668 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1669 | silc_connected(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1670 | SilcClientConnectionStatus status) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1671 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1672 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1673 | SilcPurple sg; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1674 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1675 | if (gc == NULL) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1676 | silc_client_close_connection(client, conn); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1677 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1678 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1679 | sg = gc->proto_data; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1680 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1681 | switch (status) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1682 | case SILC_CLIENT_CONN_SUCCESS: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1683 | case SILC_CLIENT_CONN_SUCCESS_RESUME: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1684 | purple_connection_set_state(gc, PURPLE_CONNECTED); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1685 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1686 | /* Send the server our buddy list */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1687 | silcpurple_send_buddylist(gc); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1688 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1689 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1690 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1691 | /* Send any UMODEs configured for account */ |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17674
diff
changeset
|
1692 | if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { |
|
17674
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1693 | silc_client_command_call(sg->client, sg->conn, NULL, |
|
17677
c1ef813bddcf
Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17674
diff
changeset
|
1694 | "UMODE", "+P", NULL); |
|
17674
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1695 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1696 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1697 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1698 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1699 | case SILC_CLIENT_CONN_ERROR: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1700 | purple_connection_error(gc, _("Error during connecting to SILC Server")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1701 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1702 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1703 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1704 | case SILC_CLIENT_CONN_ERROR_KE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1705 | purple_connection_error(gc, _("Key Exchange failed")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1706 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1707 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1708 | case SILC_CLIENT_CONN_ERROR_AUTH: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1709 | purple_connection_error(gc, _("Authentication failed")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1710 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1711 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1712 | case SILC_CLIENT_CONN_ERROR_RESUME: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1713 | purple_connection_error(gc, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1714 | _("Resuming detached session failed. " |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1715 | "Press Reconnect to create new connection.")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1716 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1717 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1718 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1719 | case SILC_CLIENT_CONN_ERROR_TIMEOUT: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1720 | purple_connection_error(gc, _("Connection Timeout")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1721 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1722 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1723 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1724 | /* Error */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1725 | sg->conn = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1726 | silc_client_close_connection(client, conn); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1727 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1728 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1729 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1730 | /* Called to indicate that connection was disconnected to the server. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1731 | The `status' may tell the reason of the disconnection, and if the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1732 | `message' is non-NULL it may include the disconnection message |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1733 | received from server. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1734 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1735 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1736 | silc_disconnected(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1737 | SilcStatus status, const char *message) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1738 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1739 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1740 | 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
|
1741 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1742 | if (sg->resuming && !sg->detaching) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1743 | g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1744 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1745 | sg->conn = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1746 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1747 | /* Close the connection */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1748 | if (!sg->detaching) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1749 | purple_connection_error(gc, _("Disconnected by server")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1750 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1751 | /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1752 | purple_account_disconnect(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
|
1753 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1754 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1755 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1756 | typedef struct { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1757 | SilcGetAuthMeth completion; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1758 | void *context; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1759 | } *SilcPurpleGetAuthMethod; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1760 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1761 | /* Callback called when we've received the authentication method information |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1762 | from the server after we've requested it. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1763 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1764 | static void silc_get_auth_method_callback(SilcClient client, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1765 | SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1766 | SilcAuthMethod auth_meth, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1767 | void *context) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1768 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1769 | SilcPurpleGetAuthMethod internal = context; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1770 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1771 | switch (auth_meth) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1772 | case SILC_AUTH_NONE: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1773 | /* No authentication required. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1774 | (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1775 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1776 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1777 | case SILC_AUTH_PASSWORD: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1778 | /* By returning NULL here the library will ask the passphrase from us |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1779 | by calling the silc_ask_passphrase. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1780 | (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1781 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1782 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1783 | case SILC_AUTH_PUBLIC_KEY: |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1784 | /* Do not get the authentication data now, the library will generate |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1785 | it using our default key, if we do not provide it here. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1786 | (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1787 | break; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1788 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1789 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1790 | silc_free(internal); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1791 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1792 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1793 | /* Find authentication method and authentication data by hostname and |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1794 | port. The hostname may be IP address as well. When the authentication |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1795 | method has been resolved the `completion' callback with the found |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1796 | authentication method and authentication data is called. The `conn' |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1797 | may be NULL. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1798 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1799 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1800 | silc_get_auth_method(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1801 | char *hostname, SilcUInt16 port, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1802 | SilcGetAuthMeth completion, void *context) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1803 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1804 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1805 | 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
|
1806 | SilcPurpleGetAuthMethod internal; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1807 | const char *password; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1808 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1809 | /* Progress */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1810 | if (sg->resuming) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1811 | purple_connection_update_progress(gc, _("Resuming session"), 4, 5); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1812 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1813 | purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1814 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1815 | /* Check configuration if we have this connection configured. If we |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1816 | have then return that data immediately, as it's faster way. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1817 | if (purple_account_get_bool(sg->account, "pubkey-auth", FALSE)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1818 | completion(TRUE, SILC_AUTH_PUBLIC_KEY, NULL, 0, context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1819 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1820 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1821 | password = purple_connection_get_password(gc); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1822 | if (password && *password) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1823 | completion(TRUE, SILC_AUTH_PASSWORD, (unsigned char *)password, strlen(password), context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1824 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1825 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1826 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1827 | /* Resolve the authentication method from server, as we may not know it. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1828 | internal = silc_calloc(1, sizeof(*internal)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1829 | if (!internal) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1830 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1831 | internal->completion = completion; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1832 | internal->context = context; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1833 | silc_client_request_authentication_method(client, conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1834 | silc_get_auth_method_callback, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1835 | internal); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1836 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1837 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1838 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1839 | /* Verifies received public key. The `conn_type' indicates which entity |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1840 | (server, client etc.) has sent the public key. If user decides to trust |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1841 | the application may save the key as trusted public key for later |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1842 | use. The `completion' must be called after the public key has been |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1843 | verified. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1844 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1845 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1846 | silc_verify_public_key(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1847 | SilcSocketType conn_type, unsigned char *pk, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1848 | SilcUInt32 pk_len, SilcSKEPKType pk_type, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1849 | SilcVerifyPublicKey completion, void *context) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1850 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1851 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1852 | 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
|
1853 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1854 | if (!sg->conn && (conn_type == SILC_SOCKET_TYPE_SERVER || |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1855 | conn_type == SILC_SOCKET_TYPE_ROUTER)) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1856 | /* Progress */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1857 | if (sg->resuming) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1858 | purple_connection_update_progress(gc, _("Resuming session"), 3, 5); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1859 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1860 | purple_connection_update_progress(gc, _("Verifying server public key"), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1861 | 3, 5); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1862 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1863 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1864 | /* Verify public key */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1865 | silcpurple_verify_public_key(client, conn, NULL, conn_type, pk, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1866 | pk_len, pk_type, completion, context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1867 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1868 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1869 | typedef struct { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1870 | SilcAskPassphrase completion; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1871 | void *context; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1872 | } *SilcPurpleAskPassphrase; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1873 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1874 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1875 | silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1876 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1877 | if (!passphrase || !(*passphrase)) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1878 | internal->completion(NULL, 0, internal->context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1879 | else |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1880 | internal->completion((unsigned char *)passphrase, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1881 | strlen(passphrase), internal->context); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1882 | silc_free(internal); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1883 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1884 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1885 | /* Ask (interact, that is) a passphrase from user. The passphrase is |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1886 | returned to the library by calling the `completion' callback with |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1887 | the `context'. The returned passphrase SHOULD be in UTF-8 encoded, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1888 | if not then the library will attempt to encode. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1889 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1890 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1891 | silc_ask_passphrase(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1892 | SilcAskPassphrase completion, void *context) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1893 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1894 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1895 | SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1896 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1897 | if (!internal) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1898 | return; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1899 | internal->completion = completion; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1900 | internal->context = context; |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1901 | purple_request_input(gc, _("Passphrase"), NULL, |
|
17674
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1902 | _("Passphrase required"), NULL, FALSE, TRUE, NULL, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1903 | _("OK"), G_CALLBACK(silc_ask_passphrase_cb), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1904 | _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
1905 | purple_connection_get_account(gc), NULL, NULL, internal); |
|
17674
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1906 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1907 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1908 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1909 | /* Notifies application that failure packet was received. This is called |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1910 | if there is some protocol active in the client. The `protocol' is the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1911 | protocol context. The `failure' is opaque pointer to the failure |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1912 | indication. Note, that the `failure' is protocol dependant and |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1913 | application must explicitly cast it to correct type. Usually `failure' |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1914 | is 32 bit failure type (see protocol specs for all protocol failure |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1915 | types). */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1916 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1917 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1918 | silc_failure(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1919 | SilcProtocol protocol, void *failure) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1920 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1921 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1922 | char buf[128]; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1923 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1924 | memset(buf, 0, sizeof(buf)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1925 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1926 | if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_KEY_EXCHANGE) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1927 | SilcSKEStatus status = (SilcSKEStatus)SILC_PTR_TO_32(failure); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1928 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1929 | if (status == SILC_SKE_STATUS_BAD_VERSION) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1930 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1931 | _("Failure: Version mismatch, upgrade your client")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1932 | if (status == SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1933 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1934 | _("Failure: Remote does not trust/support your public key")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1935 | if (status == SILC_SKE_STATUS_UNKNOWN_GROUP) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1936 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1937 | _("Failure: Remote does not support proposed KE group")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1938 | if (status == SILC_SKE_STATUS_UNKNOWN_CIPHER) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1939 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1940 | _("Failure: Remote does not support proposed cipher")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1941 | if (status == SILC_SKE_STATUS_UNKNOWN_PKCS) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1942 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1943 | _("Failure: Remote does not support proposed PKCS")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1944 | if (status == SILC_SKE_STATUS_UNKNOWN_HASH_FUNCTION) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1945 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1946 | _("Failure: Remote does not support proposed hash function")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1947 | if (status == SILC_SKE_STATUS_UNKNOWN_HMAC) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1948 | g_snprintf(buf, sizeof(buf), |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1949 | _("Failure: Remote does not support proposed HMAC")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1950 | if (status == SILC_SKE_STATUS_INCORRECT_SIGNATURE) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1951 | g_snprintf(buf, sizeof(buf), _("Failure: Incorrect signature")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1952 | if (status == SILC_SKE_STATUS_INVALID_COOKIE) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1953 | g_snprintf(buf, sizeof(buf), _("Failure: Invalid cookie")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1954 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1955 | /* Show the error on the progress bar. A more generic error message |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1956 | is going to be showed to user after this in the silc_connected. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1957 | purple_connection_update_progress(gc, buf, 2, 5); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1958 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1959 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1960 | if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_CONNECTION_AUTH) { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1961 | SilcUInt32 err = SILC_PTR_TO_32(failure); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1962 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1963 | if (err == SILC_AUTH_FAILED) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1964 | g_snprintf(buf, sizeof(buf), _("Failure: Authentication failed")); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1965 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1966 | /* Show the error on the progress bar. A more generic error message |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1967 | is going to be showed to user after this in the silc_connected. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1968 | purple_connection_update_progress(gc, buf, 4, 5); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1969 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1970 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1971 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1972 | /* Asks whether the user would like to perform the key agreement protocol. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1973 | This is called after we have received an key agreement packet or an |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1974 | reply to our key agreement packet. This returns TRUE if the user wants |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1975 | the library to perform the key agreement protocol and FALSE if it is not |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1976 | desired (application may start it later by calling the function |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1977 | silc_client_perform_key_agreement). If TRUE is returned also the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1978 | `completion' and `context' arguments must be set by the application. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1979 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1980 | static bool |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1981 | silc_key_agreement(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1982 | SilcClientEntry client_entry, const char *hostname, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1983 | SilcUInt16 port, SilcKeyAgreementCallback *completion, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1984 | void **context) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1985 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1986 | silcpurple_buddy_keyagr_request(client, conn, client_entry, hostname, port); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1987 | *completion = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1988 | *context = NULL; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1989 | return FALSE; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1990 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1991 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1992 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1993 | /* Notifies application that file transfer protocol session is being |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1994 | requested by the remote client indicated by the `client_entry' from |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1995 | the `hostname' and `port'. The `session_id' is the file transfer |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1996 | session and it can be used to either accept or reject the file |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1997 | transfer request, by calling the silc_client_file_receive or |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1998 | silc_client_file_close, respectively. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
1999 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2000 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2001 | silc_ftp(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2002 | SilcClientEntry client_entry, SilcUInt32 session_id, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2003 | const char *hostname, SilcUInt16 port) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2004 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2005 | silcpurple_ftp_request(client, conn, client_entry, session_id, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2006 | hostname, port); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2007 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2008 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2009 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2010 | /* Delivers SILC session detachment data indicated by `detach_data' to the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2011 | application. If application has issued SILC_COMMAND_DETACH command |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2012 | the client session in the SILC network is not quit. The client remains |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2013 | in the network but is detached. The detachment data may be used later |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2014 | to resume the session in the SILC Network. The appliation is |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2015 | responsible of saving the `detach_data', to for example in a file. |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2016 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2017 | The detachment data can be given as argument to the functions |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2018 | silc_client_connect_to_server, or silc_client_add_connection when |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2019 | creating connection to remote server, inside SilcClientConnectionParams |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2020 | structure. If it is provided the client library will attempt to resume |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2021 | the session in the network. After the connection is created |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2022 | successfully, the application is responsible of setting the user |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2023 | interface for user into the same state it was before detaching (showing |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2024 | same channels, channel modes, etc). It can do this by fetching the |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2025 | information (like joined channels) from the client library. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2026 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2027 | static void |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2028 | silc_detach(SilcClient client, SilcClientConnection conn, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2029 | const unsigned char *detach_data, SilcUInt32 detach_data_len) |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2030 | { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2031 | PurpleConnection *gc = client->application; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2032 | 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
|
2033 | const char *file; |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2034 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2035 | /* Save the detachment data to file. */ |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2036 | file = silcpurple_session_file(purple_account_get_username(sg->account)); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2037 | g_unlink(file); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2038 | silc_file_writefile(file, (char *)detach_data, detach_data_len); |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2039 | } |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2040 | |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2041 | SilcClientOperations ops = { |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2042 | silc_say, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2043 | silc_channel_message, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2044 | silc_private_message, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2045 | silc_notify, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2046 | silc_command, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2047 | silc_command_reply, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2048 | silc_connected, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2049 | silc_disconnected, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2050 | silc_get_auth_method, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2051 | silc_verify_public_key, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2052 | silc_ask_passphrase, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2053 | silc_failure, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2054 | silc_key_agreement, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2055 | silc_ftp, |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2056 | silc_detach |
|
aafdd7bed36d
Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
diff
changeset
|
2057 | }; |