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