Tue, 22 Jan 2013 00:05:35 -0800
Rename two functions.
purple_imgstore_add --> purple_imgstore_new
purple_imgstore_add_with_id --> purple_imgstore_new_with_id
The first function was really misnamed... it doesn't actually add the
function to anything. The second function was more accurate, in that
it adds the image to a hash table. But it also allocates a new image,
so I thought it was better to be consistent, to make it more clear
that these functions are similar.
| 8849 | 1 | /* |
| 2 | ||
| 15884 | 3 | silcpurple_ops.c |
| 8849 | 4 | |
| 5 | Author: Pekka Riikonen <priikone@silcnet.org> | |
| 6 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
7 | Copyright (C) 2004 - 2007 Pekka Riikonen |
| 8849 | 8 | |
| 9 | This program is free software; you can redistribute it and/or modify | |
| 10 | it under the terms of the GNU General Public License as published by | |
| 11 | the Free Software Foundation; version 2 of the License. | |
| 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | GNU General Public License for more details. | |
| 17 | ||
| 18 | */ | |
| 19 | ||
|
28981
4e3922ab4844
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
20 | #include "internal.h" |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
21 | #include "silc.h" |
| 8849 | 22 | #include "silcclient.h" |
| 15884 | 23 | #include "silcpurple.h" |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
24 | #include "imgstore.h" |
|
12058
6d4b6e3bd0ba
[gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents:
11533
diff
changeset
|
25 | #include "wb.h" |
| 8849 | 26 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
27 | static void |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
28 | silc_channel_message(SilcClient client, SilcClientConnection conn, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
29 | SilcClientEntry sender, SilcChannelEntry channel, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
30 | SilcMessagePayload payload, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
31 | SilcChannelPrivateKey key, SilcMessageFlags flags, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
32 | const unsigned char *message, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
33 | SilcUInt32 message_len); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
34 | static void |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
35 | silc_private_message(SilcClient client, SilcClientConnection conn, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
36 | SilcClientEntry sender, SilcMessagePayload payload, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
37 | SilcMessageFlags flags, const unsigned char *message, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
38 | SilcUInt32 message_len); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
39 | static void |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
40 | silc_ask_passphrase(SilcClient client, SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
41 | SilcAskPassphrase completion, void *context); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
42 | |
| 8849 | 43 | /* Message sent to the application by library. `conn' associates the |
| 44 | message to a specific connection. `conn', however, may be NULL. | |
| 45 | The `type' indicates the type of the message sent by the library. | |
| 46 | The application can for example filter the message according the | |
| 47 | type. */ | |
| 48 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
49 | void silc_say(SilcClient client, SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
50 | SilcClientMessageType type, char *msg, ...) |
| 8849 | 51 | { |
|
22600
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
52 | char tmp[256]; |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
53 | va_list va; |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
54 | PurpleConnection *gc = NULL; |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
55 | PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
56 | |
|
22600
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
57 | va_start(va, msg); |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
58 | silc_vsnprintf(tmp, sizeof(tmp), msg, va); |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
59 | va_end(va); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
60 | |
|
22600
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
61 | if (type != SILC_CLIENT_MESSAGE_ERROR) { |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
62 | purple_debug_misc("silc", "silc_say (%d) %s\n", type, tmp); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
63 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
64 | } |
|
22600
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
65 | |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
66 | purple_debug_error("silc", "silc_say error: %s\n", tmp); |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
67 | |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
68 | if (!strcmp(tmp, "Authentication failed")) |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
69 | reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
70 | |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
71 | if (client != NULL) |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
72 | gc = client->application; |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
73 | |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
74 | if (gc != NULL) |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
30708
diff
changeset
|
75 | purple_connection_error(gc, reason, tmp); |
|
22600
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
76 | else |
|
b5aca71664d0
Make SILC errors disconnect the account and reduce unwanted notify dialogs.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
77 | purple_notify_error(NULL, _("Error"), _("Error occurred"), tmp); |
| 8849 | 78 | } |
| 79 | ||
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
80 | /* Processes incoming MIME message. Can be private message or channel |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
81 | message. Returns TRUE if the message `mime' was displayed. */ |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
82 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
83 | static SilcBool |
| 15884 | 84 | silcpurple_mime_message(SilcClient client, SilcClientConnection conn, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
85 | SilcClientEntry sender, SilcChannelEntry channel, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
86 | SilcMessagePayload payload, SilcChannelPrivateKey key, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
87 | SilcMessageFlags flags, SilcMime mime, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
88 | gboolean recursive) |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
89 | { |
| 15884 | 90 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
91 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
92 | const char *type; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
93 | const unsigned char *data; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
94 | SilcUInt32 data_len; |
| 15884 | 95 | PurpleMessageFlags cflags = 0; |
| 96 | PurpleConversation *convo = NULL; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
97 | SilcBool ret = FALSE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
98 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
99 | if (!mime) |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
100 | return FALSE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
101 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
102 | /* Check for fragmented MIME message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
103 | if (silc_mime_is_partial(mime)) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
104 | if (!sg->mimeass) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
105 | sg->mimeass = silc_mime_assembler_alloc(); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
106 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
107 | /* Defragment */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
108 | mime = silc_mime_assemble(sg->mimeass, mime); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
109 | if (!mime) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
110 | /* More fragments to come */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
111 | return FALSE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
112 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
113 | /* Process the complete message */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
114 | return silcpurple_mime_message(client, conn, sender, channel, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
115 | payload, key, flags, mime, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
116 | FALSE); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
117 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
118 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
119 | /* Check for multipart message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
120 | if (silc_mime_is_multipart(mime)) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
121 | SilcMime p; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
122 | const char *mtype; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
123 | SilcDList parts = silc_mime_get_multiparts(mime, &mtype); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
124 | SilcBool ret; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
125 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
126 | if (!strcmp(mtype, "mixed")) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
127 | /* Contains multiple messages */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
128 | silc_dlist_start(parts); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
129 | while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
130 | /* Recursively process parts */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
131 | ret = silcpurple_mime_message(client, conn, sender, channel, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
132 | payload, key, flags, p, TRUE); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
133 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
134 | } |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
135 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
136 | if (!strcmp(mtype, "alternative")) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
137 | /* Same message in alternative formats. Kopete sends |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
138 | these. Go in order from last to first. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
139 | silc_dlist_end(parts); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
140 | while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
141 | /* Go through the alternatives and display the first |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
142 | one we support. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
143 | if (silcpurple_mime_message(client, conn, sender, channel, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
144 | payload, key, flags, p, TRUE)) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
145 | ret = TRUE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
146 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
147 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
148 | } |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
149 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
150 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
151 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
152 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
153 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
154 | /* Get content type and MIME data */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
155 | type = silc_mime_get_field(mime, "Content-Type"); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
156 | if (!type) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
157 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
158 | data = silc_mime_get_data(mime, &data_len); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
159 | if (!data) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
160 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
161 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
162 | /* Process according to content type */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
163 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
164 | /* Plain text */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
165 | if (strstr(type, "text/plain")) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
166 | /* Default is UTF-8, don't check for other charsets */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
167 | if (!strstr(type, "utf-8")) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
168 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
169 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
170 | if (channel) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
171 | silc_channel_message(client, conn, sender, channel, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
172 | payload, key, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
173 | SILC_MESSAGE_FLAG_UTF8, data, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
174 | data_len); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
175 | else |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
176 | silc_private_message(client, conn, sender, payload, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
177 | SILC_MESSAGE_FLAG_UTF8, data, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
178 | data_len); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
179 | ret = TRUE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
180 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
181 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
182 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
183 | /* Image */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
184 | if (strstr(type, "image/png") || |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
185 | strstr(type, "image/jpeg") || |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
186 | strstr(type, "image/gif") || |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
187 | strstr(type, "image/tiff")) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
188 | char tmp[32]; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
189 | int imgid; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
190 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
191 | /* Get channel convo (if message is for channel) */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
192 | if (key && channel) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
193 | GList *l; |
| 15884 | 194 | SilcPurplePrvgrp prv; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
195 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
196 | for (l = sg->grps; l; l = l->next) |
| 15884 | 197 | if (((SilcPurplePrvgrp)l->data)->key == key) { |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
198 | prv = l->data; |
| 15884 | 199 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
200 | prv->channel, sg->account); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
201 | break; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
202 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
203 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
204 | if (channel && !convo) |
| 15884 | 205 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
206 | channel->channel_name, sg->account); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
207 | if (channel && !convo) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
208 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
209 | |
| 33661 | 210 | imgid = purple_imgstore_new_with_id(g_memdup(data, data_len), data_len, ""); |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
211 | if (imgid) { |
| 15884 | 212 | cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; |
|
33052
df92c3d93904
From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32763
diff
changeset
|
213 | g_snprintf(tmp, sizeof(tmp), |
|
df92c3d93904
From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32763
diff
changeset
|
214 | "<IMG SRC=\"" PURPLE_STORED_IMAGE_PROTOCOL "%d\">", |
|
df92c3d93904
From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32763
diff
changeset
|
215 | imgid); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
216 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
217 | if (channel) |
| 15884 | 218 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
219 | sender->nickname ? |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
220 | sender->nickname : |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
221 | "<unknown>", cflags, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
222 | tmp, time(NULL)); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
223 | else |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
224 | serv_got_im(gc, sender->nickname ? |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
225 | sender->nickname : "<unknown>", |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
226 | tmp, cflags, time(NULL)); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
227 | |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
228 | purple_imgstore_unref_by_id(imgid); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
229 | ret = TRUE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
230 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
231 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
232 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
233 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
234 | /* Whiteboard message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
235 | if (strstr(type, "application/x-wb") && |
| 15884 | 236 | !purple_account_get_bool(sg->account, "block-wb", FALSE)) { |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
237 | if (channel) |
| 15884 | 238 | silcpurple_wb_receive_ch(client, conn, sender, channel, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
239 | payload, flags, data, data_len); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
240 | else |
| 15884 | 241 | silcpurple_wb_receive(client, conn, sender, payload, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
242 | flags, data, data_len); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
243 | ret = TRUE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
244 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
245 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
246 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
247 | out: |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
248 | if (!recursive) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
249 | silc_mime_free(mime); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
250 | return ret; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
251 | } |
| 8849 | 252 | |
| 253 | /* Message for a channel. The `sender' is the sender of the message | |
| 254 | The `channel' is the channel. The `message' is the message. Note | |
| 255 | that `message' maybe NULL. The `flags' indicates message flags | |
| 256 | and it is used to determine how the message can be interpreted | |
| 257 | (like it may tell the message is multimedia message). */ | |
| 258 | ||
| 259 | static void | |
| 260 | silc_channel_message(SilcClient client, SilcClientConnection conn, | |
| 261 | SilcClientEntry sender, SilcChannelEntry channel, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
262 | SilcMessagePayload payload, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
263 | SilcChannelPrivateKey key, SilcMessageFlags flags, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
264 | const unsigned char *message, |
| 8849 | 265 | SilcUInt32 message_len) |
| 266 | { | |
| 15884 | 267 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
268 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 15884 | 269 | PurpleConversation *convo = NULL; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
270 | char *msg, *tmp; |
| 8849 | 271 | |
| 272 | if (!message) | |
| 273 | return; | |
| 274 | ||
| 275 | if (key) { | |
| 276 | GList *l; | |
| 15884 | 277 | SilcPurplePrvgrp prv; |
| 8849 | 278 | |
| 279 | for (l = sg->grps; l; l = l->next) | |
| 15884 | 280 | if (((SilcPurplePrvgrp)l->data)->key == key) { |
| 8849 | 281 | prv = l->data; |
| 15884 | 282 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10091
diff
changeset
|
283 | prv->channel, sg->account); |
| 8849 | 284 | break; |
| 285 | } | |
| 286 | } | |
| 287 | if (!convo) | |
| 15884 | 288 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
289 | channel->channel_name, sg->account); |
| 8849 | 290 | if (!convo) |
| 291 | return; | |
| 292 | ||
| 293 | if (flags & SILC_MESSAGE_FLAG_SIGNED && | |
| 15884 | 294 | purple_account_get_bool(sg->account, "sign-verify", FALSE)) { |
| 8849 | 295 | /* XXX */ |
| 296 | } | |
| 297 | ||
| 298 | if (flags & SILC_MESSAGE_FLAG_DATA) { | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
299 | /* Process MIME message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
300 | SilcMime mime; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
301 | mime = silc_mime_decode(NULL, message, message_len); |
| 15884 | 302 | silcpurple_mime_message(client, conn, sender, channel, payload, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
303 | key, flags, mime, FALSE); |
| 8849 | 304 | return; |
| 305 | } | |
| 306 | ||
| 307 | if (flags & SILC_MESSAGE_FLAG_ACTION) { | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
308 | msg = g_strdup_printf("/me %s", |
| 8849 | 309 | (const char *)message); |
| 310 | if (!msg) | |
| 311 | return; | |
| 312 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
313 | tmp = g_markup_escape_text(msg, -1); |
| 15884 | 314 | /* Send to Purple */ |
| 315 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
316 | sender->nickname, 0, tmp, time(NULL)); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
317 | g_free(tmp); |
| 8849 | 318 | g_free(msg); |
| 319 | return; | |
| 320 | } | |
| 321 | ||
| 322 | if (flags & SILC_MESSAGE_FLAG_NOTICE) { | |
| 323 | msg = g_strdup_printf("(notice) <I>%s</I> %s", | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
324 | sender->nickname, (const char *)message); |
| 8849 | 325 | if (!msg) |
| 326 | return; | |
| 327 | ||
| 15884 | 328 | /* Send to Purple */ |
| 329 | purple_conversation_write(convo, NULL, (const char *)msg, | |
| 330 | PURPLE_MESSAGE_SYSTEM, time(NULL)); | |
| 8849 | 331 | g_free(msg); |
| 332 | return; | |
| 333 | } | |
| 334 | ||
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
335 | if (flags & SILC_MESSAGE_FLAG_UTF8) { |
|
32063
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
336 | const char *msg = (const char *)message; |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
337 | char *salvaged = NULL; |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
338 | if (!g_utf8_validate((const char *)message, -1, NULL)) { |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
339 | salvaged = purple_utf8_salvage((const char *)message); |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
340 | msg = salvaged; |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
341 | } |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
342 | tmp = g_markup_escape_text(msg, -1); |
| 15884 | 343 | /* Send to Purple */ |
| 344 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
345 | sender->nickname, 0, tmp, time(NULL)); |
|
32063
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
346 | g_free(salvaged); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
347 | g_free(tmp); |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
348 | } |
| 8849 | 349 | } |
| 350 | ||
| 351 | ||
| 352 | /* Private message to the client. The `sender' is the sender of the | |
| 353 | message. The message is `message'and maybe NULL. The `flags' | |
| 354 | indicates message flags and it is used to determine how the message | |
| 355 | can be interpreted (like it may tell the message is multimedia | |
| 356 | message). */ | |
| 357 | ||
| 358 | static void | |
| 359 | silc_private_message(SilcClient client, SilcClientConnection conn, | |
| 360 | SilcClientEntry sender, SilcMessagePayload payload, | |
| 361 | SilcMessageFlags flags, const unsigned char *message, | |
| 362 | SilcUInt32 message_len) | |
| 363 | { | |
| 15884 | 364 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
365 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 15884 | 366 | PurpleConversation *convo = NULL; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
367 | char *msg, *tmp; |
| 8849 | 368 | |
| 369 | if (!message) | |
| 370 | return; | |
| 371 | ||
| 372 | if (sender->nickname) | |
| 15884 | 373 | /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ |
| 374 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
375 | sender->nickname, sg->account); |
| 8849 | 376 | |
| 377 | if (flags & SILC_MESSAGE_FLAG_SIGNED && | |
| 15884 | 378 | purple_account_get_bool(sg->account, "sign-verify", FALSE)) { |
| 8849 | 379 | /* XXX */ |
| 380 | } | |
| 381 | ||
| 382 | if (flags & SILC_MESSAGE_FLAG_DATA) { | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
383 | /* Process MIME message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
384 | SilcMime mime; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
385 | mime = silc_mime_decode(NULL, message, message_len); |
| 15884 | 386 | silcpurple_mime_message(client, conn, sender, NULL, payload, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
387 | NULL, flags, mime, FALSE); |
| 8849 | 388 | return; |
| 389 | } | |
| 390 | ||
| 391 | if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
392 | msg = g_strdup_printf("/me %s", |
| 8849 | 393 | (const char *)message); |
| 394 | if (!msg) | |
| 395 | return; | |
| 396 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
397 | /* Send to Purple */ |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
398 | tmp = g_markup_escape_text(msg, -1); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
399 | serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); |
| 8849 | 400 | g_free(msg); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
401 | g_free(tmp); |
| 8849 | 402 | return; |
| 403 | } | |
| 404 | ||
| 405 | if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { | |
| 406 | msg = g_strdup_printf("(notice) <I>%s</I> %s", | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
407 | sender->nickname, (const char *)message); |
| 8849 | 408 | if (!msg) |
| 409 | return; | |
| 410 | ||
| 15884 | 411 | /* Send to Purple */ |
| 412 | purple_conversation_write(convo, NULL, (const char *)msg, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
413 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8849 | 414 | g_free(msg); |
| 415 | return; | |
| 416 | } | |
| 417 | ||
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
418 | if (flags & SILC_MESSAGE_FLAG_UTF8) { |
|
32045
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
419 | const char *msg = (const char *)message; |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
420 | char *salvaged = NULL; |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
421 | if (!g_utf8_validate((const char *)message, -1, NULL)) { |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
422 | salvaged = purple_utf8_salvage((const char *)message); |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
423 | msg = salvaged; |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
424 | } |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
425 | tmp = g_markup_escape_text(msg, -1); |
| 15884 | 426 | /* Send to Purple */ |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
427 | serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); |
|
32045
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
428 | g_free(salvaged); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
429 | g_free(tmp); |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
430 | } |
| 8849 | 431 | } |
| 432 | ||
| 433 | ||
| 434 | /* Notify message to the client. The notify arguments are sent in the | |
| 435 | same order as servers sends them. The arguments are same as received | |
| 436 | from the server except for ID's. If ID is received application receives | |
| 437 | the corresponding entry to the ID. For example, if Client ID is received | |
| 438 | application receives SilcClientEntry. Also, if the notify type is | |
| 439 | for channel the channel entry is sent to application (even if server | |
| 440 | does not send it because client library gets the channel entry from | |
| 441 | the Channel ID in the packet's header). */ | |
| 442 | ||
| 443 | static void | |
| 444 | silc_notify(SilcClient client, SilcClientConnection conn, | |
| 445 | SilcNotifyType type, ...) | |
| 446 | { | |
| 447 | va_list va; | |
| 15884 | 448 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
449 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23325
diff
changeset
|
450 | PurpleAccount *account = purple_connection_get_account(gc); |
| 15884 | 451 | PurpleConversation *convo; |
| 8849 | 452 | SilcClientEntry client_entry, client_entry2; |
| 453 | SilcChannelEntry channel; | |
| 454 | SilcServerEntry server_entry; | |
| 455 | SilcIdType idtype; | |
| 456 | void *entry; | |
| 457 | SilcUInt32 mode; | |
| 458 | SilcHashTableList htl; | |
| 459 | SilcChannelUser chu; | |
| 460 | char buf[512], buf2[512], *tmp, *name; | |
| 461 | SilcNotifyType notify; | |
| 15884 | 462 | PurpleBuddy *b; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
463 | SilcDList list; |
| 8849 | 464 | int i; |
| 465 | ||
| 466 | va_start(va, type); | |
| 467 | memset(buf, 0, sizeof(buf)); | |
| 468 | ||
| 469 | switch (type) { | |
| 470 | ||
| 471 | case SILC_NOTIFY_TYPE_NONE: | |
| 472 | break; | |
| 473 | ||
| 474 | case SILC_NOTIFY_TYPE_INVITE: | |
| 475 | { | |
| 476 | GHashTable *components; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
477 | (void)va_arg(va, SilcChannelEntry); |
| 8849 | 478 | name = va_arg(va, char *); |
| 479 | client_entry = va_arg(va, SilcClientEntry); | |
| 480 | ||
| 481 | components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22600
diff
changeset
|
482 | g_hash_table_insert(components, g_strdup("channel"), g_strdup(name)); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
483 | serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); |
| 8849 | 484 | } |
| 485 | break; | |
| 486 | ||
| 487 | case SILC_NOTIFY_TYPE_JOIN: | |
| 488 | client_entry = va_arg(va, SilcClientEntry); | |
| 489 | channel = va_arg(va, SilcChannelEntry); | |
| 490 | ||
| 491 | /* If we joined channel, do nothing */ | |
| 492 | if (client_entry == conn->local_entry) | |
| 493 | break; | |
| 494 | ||
| 15884 | 495 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
496 | channel->channel_name, sg->account); |
| 8849 | 497 | if (!convo) |
| 498 | break; | |
| 499 | ||
| 500 | /* Join user to channel */ | |
| 8891 | 501 | g_snprintf(buf, sizeof(buf), "%s@%s", |
| 8849 | 502 | client_entry->username, client_entry->hostname); |
| 15884 | 503 | purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22600
diff
changeset
|
504 | client_entry->nickname, buf, PURPLE_CBFLAGS_NONE, TRUE); |
| 8849 | 505 | |
| 506 | break; | |
| 507 | ||
| 508 | case SILC_NOTIFY_TYPE_LEAVE: | |
| 509 | client_entry = va_arg(va, SilcClientEntry); | |
| 510 | channel = va_arg(va, SilcChannelEntry); | |
| 511 | ||
| 15884 | 512 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
513 | channel->channel_name, sg->account); |
| 8849 | 514 | if (!convo) |
| 515 | break; | |
| 516 | ||
| 517 | /* Remove user from channel */ | |
| 15884 | 518 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
519 | client_entry->nickname, NULL); |
| 8849 | 520 | |
| 521 | break; | |
| 522 | ||
| 523 | case SILC_NOTIFY_TYPE_SIGNOFF: | |
| 524 | client_entry = va_arg(va, SilcClientEntry); | |
| 525 | tmp = va_arg(va, char *); | |
| 526 | ||
| 527 | /* Remove from all channels */ | |
| 528 | silc_hash_table_list(client_entry->channels, &htl); | |
| 529 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
| 15884 | 530 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
531 | chu->channel->channel_name, sg->account); |
| 8849 | 532 | if (!convo) |
| 533 | continue; | |
| 15884 | 534 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
535 | client_entry->nickname, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
536 | tmp); |
| 8849 | 537 | } |
| 538 | silc_hash_table_list_reset(&htl); | |
| 539 | ||
| 540 | break; | |
| 541 | ||
| 542 | case SILC_NOTIFY_TYPE_TOPIC_SET: | |
| 9762 | 543 | { |
| 544 | char *esc, *tmp2; | |
| 545 | idtype = va_arg(va, int); | |
| 546 | entry = va_arg(va, void *); | |
| 547 | tmp = va_arg(va, char *); | |
| 548 | channel = va_arg(va, SilcChannelEntry); | |
| 549 | ||
| 15884 | 550 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
551 | channel->channel_name, sg->account); |
| 9762 | 552 | if (!convo) |
| 553 | break; | |
| 554 | ||
| 555 | if (!tmp) | |
| 556 | break; | |
| 557 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
558 | esc = g_markup_escape_text(tmp, -1); |
| 15884 | 559 | tmp2 = purple_markup_linkify(esc); |
| 9762 | 560 | g_free(esc); |
| 8849 | 561 | |
| 9762 | 562 | if (idtype == SILC_ID_CLIENT) { |
| 563 | client_entry = (SilcClientEntry)entry; | |
| 564 | g_snprintf(buf, sizeof(buf), | |
| 565 | _("%s has changed the topic of <I>%s</I> to: %s"), | |
| 566 | client_entry->nickname, channel->channel_name, tmp2); | |
| 15884 | 567 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, |
| 568 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); | |
| 569 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), | |
| 9762 | 570 | client_entry->nickname, tmp); |
| 571 | } else if (idtype == SILC_ID_SERVER) { | |
| 572 | server_entry = (SilcServerEntry)entry; | |
| 573 | g_snprintf(buf, sizeof(buf), | |
| 574 | _("%s has changed the topic of <I>%s</I> to: %s"), | |
| 575 | server_entry->server_name, channel->channel_name, tmp2); | |
| 15884 | 576 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), server_entry->server_name, |
| 577 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); | |
| 578 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), | |
| 9762 | 579 | server_entry->server_name, tmp); |
| 580 | } else if (idtype == SILC_ID_CHANNEL) { | |
| 581 | channel = (SilcChannelEntry)entry; | |
| 582 | g_snprintf(buf, sizeof(buf), | |
| 583 | _("%s has changed the topic of <I>%s</I> to: %s"), | |
| 584 | channel->channel_name, channel->channel_name, tmp2); | |
| 15884 | 585 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, |
| 586 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); | |
| 587 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), | |
| 9762 | 588 | channel->channel_name, tmp); |
| 589 | } else { | |
| 15884 | 590 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, tmp); |
| 9762 | 591 | } |
| 8849 | 592 | |
| 9762 | 593 | g_free(tmp2); |
| 594 | ||
| 8849 | 595 | break; |
| 596 | ||
| 597 | } | |
| 598 | case SILC_NOTIFY_TYPE_NICK_CHANGE: | |
| 599 | client_entry = va_arg(va, SilcClientEntry); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
600 | tmp = va_arg(va, char *); /* Old nick */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
601 | name = va_arg(va, char *); /* New nick */ |
| 8849 | 602 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
603 | if (!strcmp(tmp, name)) |
| 8849 | 604 | break; |
| 605 | ||
| 606 | /* Change nick on all channels */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
607 | silc_hash_table_list(client_entry->channels, &htl); |
| 8849 | 608 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
| 15884 | 609 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
610 | chu->channel->channel_name, sg->account); |
| 8849 | 611 | if (!convo) |
| 612 | continue; | |
| 15884 | 613 | if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), client_entry->nickname)) |
| 614 | purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
615 | tmp, name); |
| 8849 | 616 | } |
| 617 | silc_hash_table_list_reset(&htl); | |
| 618 | ||
| 619 | break; | |
| 620 | ||
| 621 | case SILC_NOTIFY_TYPE_CMODE_CHANGE: | |
| 622 | idtype = va_arg(va, int); | |
| 623 | entry = va_arg(va, void *); | |
| 624 | mode = va_arg(va, SilcUInt32); | |
| 625 | (void)va_arg(va, char *); | |
| 626 | (void)va_arg(va, char *); | |
| 627 | (void)va_arg(va, char *); | |
| 628 | (void)va_arg(va, SilcPublicKey); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
629 | (void)va_arg(va, SilcDList); |
| 8849 | 630 | channel = va_arg(va, SilcChannelEntry); |
| 631 | ||
| 15884 | 632 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
633 | channel->channel_name, sg->account); |
| 8849 | 634 | if (!convo) |
| 635 | break; | |
| 636 | ||
| 637 | if (idtype == SILC_ID_CLIENT) | |
| 638 | name = ((SilcClientEntry)entry)->nickname; | |
| 639 | else if (idtype == SILC_ID_SERVER) | |
| 640 | name = ((SilcServerEntry)entry)->server_name; | |
| 641 | else | |
| 642 | name = ((SilcChannelEntry)entry)->channel_name; | |
| 643 | if (!name) | |
| 644 | break; | |
| 645 | ||
| 646 | if (mode) { | |
| 15884 | 647 | silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); |
| 8849 | 648 | g_snprintf(buf, sizeof(buf), |
| 649 | _("<I>%s</I> set channel <I>%s</I> modes to: %s"), name, | |
| 650 | channel->channel_name, buf2); | |
| 651 | } else { | |
| 652 | g_snprintf(buf, sizeof(buf), | |
| 653 | _("<I>%s</I> removed all channel <I>%s</I> modes"), name, | |
| 654 | channel->channel_name); | |
| 655 | } | |
| 15884 | 656 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
657 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8849 | 658 | break; |
| 659 | ||
| 660 | case SILC_NOTIFY_TYPE_CUMODE_CHANGE: | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
661 | { |
| 15884 | 662 | PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
663 | idtype = va_arg(va, int); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
664 | entry = va_arg(va, void *); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
665 | mode = va_arg(va, SilcUInt32); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
666 | client_entry2 = va_arg(va, SilcClientEntry); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
667 | channel = va_arg(va, SilcChannelEntry); |
| 8849 | 668 | |
| 15884 | 669 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
670 | channel->channel_name, sg->account); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
671 | if (!convo) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
672 | break; |
| 8849 | 673 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
674 | if (idtype == SILC_ID_CLIENT) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
675 | name = ((SilcClientEntry)entry)->nickname; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
676 | else if (idtype == SILC_ID_SERVER) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
677 | name = ((SilcServerEntry)entry)->server_name; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
678 | else |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
679 | name = ((SilcChannelEntry)entry)->channel_name; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
680 | if (!name) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
681 | break; |
| 8849 | 682 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
683 | if (mode) { |
| 15884 | 684 | silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
685 | g_snprintf(buf, sizeof(buf), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
686 | _("<I>%s</I> set <I>%s's</I> modes to: %s"), name, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
687 | client_entry2->nickname, buf2); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
688 | if (mode & SILC_CHANNEL_UMODE_CHANFO) |
| 15884 | 689 | flags |= PURPLE_CBFLAGS_FOUNDER; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
690 | if (mode & SILC_CHANNEL_UMODE_CHANOP) |
| 15884 | 691 | flags |= PURPLE_CBFLAGS_OP; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
692 | } else { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
693 | g_snprintf(buf, sizeof(buf), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
694 | _("<I>%s</I> removed all <I>%s's</I> modes"), name, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
695 | client_entry2->nickname); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
696 | } |
| 15884 | 697 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
698 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 15884 | 699 | purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), client_entry2->nickname, flags); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
700 | break; |
| 8849 | 701 | } |
| 702 | ||
| 703 | case SILC_NOTIFY_TYPE_MOTD: | |
| 704 | tmp = va_arg(va, char *); | |
| 705 | silc_free(sg->motd); | |
| 706 | sg->motd = silc_memdup(tmp, strlen(tmp)); | |
| 707 | break; | |
| 708 | ||
| 709 | case SILC_NOTIFY_TYPE_KICKED: | |
| 710 | client_entry = va_arg(va, SilcClientEntry); | |
| 711 | tmp = va_arg(va, char *); | |
| 712 | client_entry2 = va_arg(va, SilcClientEntry); | |
| 713 | channel = va_arg(va, SilcChannelEntry); | |
| 714 | ||
| 15884 | 715 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
716 | channel->channel_name, sg->account); |
| 8849 | 717 | if (!convo) |
| 718 | break; | |
| 719 | ||
| 720 | if (client_entry == conn->local_entry) { | |
| 721 | /* Remove us from channel */ | |
| 722 | g_snprintf(buf, sizeof(buf), | |
| 723 | _("You have been kicked off <I>%s</I> by <I>%s</I> (%s)"), | |
| 724 | channel->channel_name, client_entry2->nickname, | |
| 725 | tmp ? tmp : ""); | |
| 15884 | 726 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
727 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 15884 | 728 | serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); |
| 8849 | 729 | } else { |
| 730 | /* Remove user from channel */ | |
|
12885
c0fcda07fb52
[gaim-migrate @ 15237]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12603
diff
changeset
|
731 | g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), |
| 8849 | 732 | client_entry2->nickname, tmp ? tmp : ""); |
| 15884 | 733 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
734 | client_entry->nickname, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
735 | buf); |
| 8849 | 736 | } |
| 737 | ||
| 738 | break; | |
| 739 | ||
| 740 | case SILC_NOTIFY_TYPE_KILLED: | |
| 741 | client_entry = va_arg(va, SilcClientEntry); | |
| 742 | tmp = va_arg(va, char *); | |
| 743 | idtype = va_arg(va, int); | |
| 744 | entry = va_arg(va, SilcClientEntry); | |
| 745 | ||
| 746 | if (client_entry == conn->local_entry) { | |
| 747 | if (idtype == SILC_ID_CLIENT) { | |
| 748 | client_entry2 = (SilcClientEntry)entry; | |
| 749 | g_snprintf(buf, sizeof(buf), | |
| 750 | _("You have been killed by %s (%s)"), | |
| 751 | client_entry2->nickname, tmp ? tmp : ""); | |
| 752 | } else if (idtype == SILC_ID_SERVER) { | |
| 753 | server_entry = (SilcServerEntry)entry; | |
| 754 | g_snprintf(buf, sizeof(buf), | |
| 755 | _("You have been killed by %s (%s)"), | |
| 756 | server_entry->server_name, tmp ? tmp : ""); | |
| 757 | } else if (idtype == SILC_ID_CHANNEL) { | |
| 758 | channel = (SilcChannelEntry)entry; | |
| 759 | g_snprintf(buf, sizeof(buf), | |
| 760 | _("You have been killed by %s (%s)"), | |
| 761 | channel->channel_name, tmp ? tmp : ""); | |
| 762 | } | |
| 763 | ||
| 764 | /* Remove us from all channels */ | |
| 765 | silc_hash_table_list(client_entry->channels, &htl); | |
| 766 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
| 15884 | 767 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10091
diff
changeset
|
768 | chu->channel->channel_name, sg->account); |
| 8849 | 769 | if (!convo) |
| 770 | continue; | |
| 15884 | 771 | purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
772 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 15884 | 773 | serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); |
| 8849 | 774 | } |
| 775 | silc_hash_table_list_reset(&htl); | |
| 776 | ||
| 777 | } else { | |
| 778 | if (idtype == SILC_ID_CLIENT) { | |
| 779 | client_entry2 = (SilcClientEntry)entry; | |
| 780 | g_snprintf(buf, sizeof(buf), | |
| 781 | _("Killed by %s (%s)"), | |
| 782 | client_entry2->nickname, tmp ? tmp : ""); | |
| 783 | } else if (idtype == SILC_ID_SERVER) { | |
| 784 | server_entry = (SilcServerEntry)entry; | |
| 785 | g_snprintf(buf, sizeof(buf), | |
| 786 | _("Killed by %s (%s)"), | |
| 787 | server_entry->server_name, tmp ? tmp : ""); | |
| 788 | } else if (idtype == SILC_ID_CHANNEL) { | |
| 789 | channel = (SilcChannelEntry)entry; | |
| 790 | g_snprintf(buf, sizeof(buf), | |
| 791 | _("Killed by %s (%s)"), | |
| 792 | channel->channel_name, tmp ? tmp : ""); | |
| 793 | } | |
| 794 | ||
| 795 | /* Remove user from all channels */ | |
| 796 | silc_hash_table_list(client_entry->channels, &htl); | |
| 797 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
| 15884 | 798 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10091
diff
changeset
|
799 | chu->channel->channel_name, sg->account); |
| 8849 | 800 | if (!convo) |
| 801 | continue; | |
| 15884 | 802 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
803 | client_entry->nickname, tmp); |
| 8849 | 804 | } |
| 805 | silc_hash_table_list_reset(&htl); | |
| 806 | } | |
| 807 | ||
| 808 | break; | |
| 809 | ||
| 810 | case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: | |
| 811 | break; | |
| 812 | ||
| 813 | case SILC_NOTIFY_TYPE_SERVER_SIGNOFF: | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
814 | (void)va_arg(va, void *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
815 | list = va_arg(va, SilcDList); |
| 8849 | 816 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
817 | silc_dlist_start(list); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
818 | while ((client_entry = silc_dlist_get(list))) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
819 | /* Remove from all channels */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
820 | silc_hash_table_list(client_entry->channels, &htl); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
821 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
822 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
823 | chu->channel->channel_name, sg->account); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
824 | if (!convo) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
825 | continue; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
826 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
827 | client_entry->nickname, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
828 | _("Server signoff")); |
| 8849 | 829 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
830 | silc_hash_table_list_reset(&htl); |
| 8849 | 831 | } |
| 832 | break; | |
| 833 | ||
| 834 | case SILC_NOTIFY_TYPE_ERROR: | |
| 835 | { | |
| 836 | SilcStatus error = va_arg(va, int); | |
| 15884 | 837 | purple_notify_error(gc, "Error Notify", |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
838 | silc_get_status_message(error), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
839 | NULL); |
| 8849 | 840 | } |
| 841 | break; | |
| 842 | ||
| 843 | case SILC_NOTIFY_TYPE_WATCH: | |
| 844 | { | |
| 845 | SilcPublicKey public_key; | |
| 846 | unsigned char *pk; | |
| 847 | SilcUInt32 pk_len; | |
| 848 | char *fingerprint; | |
| 849 | ||
| 850 | client_entry = va_arg(va, SilcClientEntry); | |
| 851 | (void)va_arg(va, char *); | |
| 852 | mode = va_arg(va, SilcUInt32); | |
| 853 | notify = va_arg(va, int); | |
| 854 | public_key = va_arg(va, SilcPublicKey); | |
| 855 | ||
| 856 | b = NULL; | |
| 857 | if (public_key) { | |
|
27199
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
858 | GSList *buddies; |
| 8849 | 859 | const char *f; |
| 860 | ||
| 861 | pk = silc_pkcs_public_key_encode(public_key, &pk_len); | |
| 862 | if (!pk) | |
| 863 | break; | |
| 864 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); | |
| 865 | for (i = 0; i < strlen(fingerprint); i++) | |
| 866 | if (fingerprint[i] == ' ') | |
| 867 | fingerprint[i] = '_'; | |
| 868 | g_snprintf(buf, sizeof(buf) - 1, | |
| 869 | "%s" G_DIR_SEPARATOR_S "clientkeys" | |
| 870 | G_DIR_SEPARATOR_S "clientkey_%s.pub", | |
| 15884 | 871 | silcpurple_silcdir(), fingerprint); |
| 8849 | 872 | silc_free(fingerprint); |
| 873 | silc_free(pk); | |
| 874 | ||
| 875 | /* Find buddy by associated public key */ | |
|
27199
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
876 | for (buddies = purple_find_buddies(account, NULL); buddies; |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
877 | buddies = g_slist_delete_link(buddies, buddies)) { |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
878 | b = buddies->data; |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
879 | f = purple_blist_node_get_string(PURPLE_BLIST_NODE(b), "public-key"); |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
880 | if (purple_strequal(f, buf)) |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
881 | goto cont; |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
882 | b = NULL; |
| 8849 | 883 | } |
| 884 | } | |
| 885 | cont: | |
| 886 | if (!b) { | |
| 887 | /* Find buddy by nickname */ | |
| 15884 | 888 | b = purple_find_buddy(sg->account, client_entry->nickname); |
| 8849 | 889 | if (!b) { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17680
diff
changeset
|
890 | purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", |
| 8849 | 891 | client_entry->nickname); |
| 892 | break; | |
| 893 | } | |
| 894 | } | |
| 895 | ||
|
24946
390536329dc5
Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24945
diff
changeset
|
896 | silc_free(purple_buddy_get_protocol_data(b)); |
|
390536329dc5
Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24945
diff
changeset
|
897 | purple_buddy_set_protocol_data(b, silc_memdup(&client_entry->id, |
|
390536329dc5
Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24945
diff
changeset
|
898 | sizeof(client_entry->id))); |
| 8849 | 899 | if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { |
| 900 | break; | |
| 901 | } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { | |
| 902 | /* See if client was away and is now present */ | |
| 903 | if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | | |
| 904 | SILC_UMODE_BUSY | SILC_UMODE_PAGE | | |
| 905 | SILC_UMODE_DETACHED)) && | |
| 906 | (client_entry->mode & SILC_UMODE_GONE || | |
| 907 | client_entry->mode & SILC_UMODE_INDISPOSED || | |
| 908 | client_entry->mode & SILC_UMODE_BUSY || | |
| 909 | client_entry->mode & SILC_UMODE_PAGE || | |
| 910 | client_entry->mode & SILC_UMODE_DETACHED)) { | |
| 911 | client_entry->mode = mode; | |
| 15884 | 912 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); |
| 8849 | 913 | } |
| 914 | else if ((mode & SILC_UMODE_GONE) || | |
| 915 | (mode & SILC_UMODE_INDISPOSED) || | |
| 916 | (mode & SILC_UMODE_BUSY) || | |
| 917 | (mode & SILC_UMODE_PAGE) || | |
| 918 | (mode & SILC_UMODE_DETACHED)) { | |
| 919 | client_entry->mode = mode; | |
| 15884 | 920 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); |
| 8849 | 921 | } |
| 922 | } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || | |
| 923 | notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || | |
| 924 | notify == SILC_NOTIFY_TYPE_KILLED) { | |
| 925 | client_entry->mode = mode; | |
| 15884 | 926 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); |
| 8849 | 927 | } else if (notify == SILC_NOTIFY_TYPE_NONE) { |
| 928 | client_entry->mode = mode; | |
| 15884 | 929 | purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); |
| 8849 | 930 | } |
| 931 | } | |
| 932 | break; | |
| 933 | ||
| 934 | default: | |
| 15884 | 935 | purple_debug_info("silc", "Unhandled notification: %d\n", type); |
| 8849 | 936 | break; |
| 937 | } | |
| 938 | ||
| 939 | va_end(va); | |
| 940 | } | |
| 941 | ||
| 942 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
943 | /* Command handler. This function is called always after application has |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
944 | called a command. It will be called to indicate that the command |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
945 | was processed. It will also be called if error occurs while processing |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
946 | the command. The `success' indicates whether the command was sent |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
947 | or if error occurred. The `status' indicates the actual error. |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
948 | The `argc' and `argv' are the command line arguments sent to the |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
949 | command by application. Note that, this is not reply to the command |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
950 | from server, this is merely and indication to application that the |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
951 | command was processed. */ |
| 8849 | 952 | |
| 953 | static void | |
| 954 | silc_command(SilcClient client, SilcClientConnection conn, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
955 | SilcBool success, SilcCommand command, SilcStatus status, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
956 | SilcUInt32 argc, unsigned char **argv) |
| 8849 | 957 | { |
| 15884 | 958 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
959 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 960 | |
| 961 | switch (command) { | |
| 962 | ||
| 963 | case SILC_COMMAND_CMODE: | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
964 | if (argc == 3 && !strcmp((char *)argv[2], "+C")) |
| 8849 | 965 | sg->chpk = TRUE; |
| 966 | else | |
| 967 | sg->chpk = FALSE; | |
| 968 | break; | |
| 969 | ||
| 970 | default: | |
| 971 | break; | |
| 972 | } | |
| 973 | } | |
| 974 | ||
| 9024 | 975 | #if 0 |
| 8849 | 976 | static void |
| 15884 | 977 | silcpurple_whois_more(SilcClientEntry client_entry, gint id) |
| 8849 | 978 | { |
| 979 | SilcAttributePayload attr; | |
| 980 | SilcAttribute attribute; | |
| 981 | GString *s; | |
| 982 | SilcVCardStruct vcard; | |
| 983 | int i; | |
| 984 | ||
| 985 | if (id != 0) | |
| 986 | return; | |
| 987 | ||
| 988 | memset(&vcard, 0, sizeof(vcard)); | |
| 989 | ||
| 990 | s = g_string_new(""); | |
| 991 | ||
| 992 | silc_dlist_start(client_entry->attrs); | |
| 993 | while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { | |
| 994 | attribute = silc_attribute_get_attribute(attr); | |
| 995 | switch (attribute) { | |
| 996 | ||
| 997 | case SILC_ATTRIBUTE_USER_INFO: | |
| 998 | if (!silc_attribute_get_object(attr, (void *)&vcard, | |
| 999 | sizeof(vcard))) | |
| 1000 | continue; | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1001 | g_string_append_printf(s, "%s:\n\n", _("Personal Information")); |
| 8849 | 1002 | if (vcard.full_name) |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1003 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1004 | _("Full Name"), |
| 8849 | 1005 | vcard.full_name); |
| 1006 | if (vcard.first_name) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1007 | g_string_append_printf(s, "%s:\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1008 | _("First Name"), |
| 8849 | 1009 | vcard.first_name); |
| 1010 | if (vcard.middle_names) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1011 | g_string_append_printf(s, "%s:\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1012 | _("Middle Name"), |
| 8849 | 1013 | vcard.middle_names); |
| 1014 | if (vcard.family_name) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1015 | g_string_append_printf(s, "%s:\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1016 | _("Family Name"), |
| 8849 | 1017 | vcard.family_name); |
| 1018 | if (vcard.nickname) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1019 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1020 | _("Nickname"), |
| 8849 | 1021 | vcard.nickname); |
| 1022 | if (vcard.bday) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1023 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1024 | _("Birth Day"), |
| 8849 | 1025 | vcard.bday); |
| 1026 | if (vcard.title) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1027 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1028 | _("Job Title"), |
| 8849 | 1029 | vcard.title); |
| 1030 | if (vcard.role) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1031 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1032 | _("Job Role"), |
| 8849 | 1033 | vcard.role); |
| 1034 | if (vcard.org_name) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1035 | g_string_append_printf(s, "%s:\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1036 | _("Organization"), |
| 8849 | 1037 | vcard.org_name); |
| 1038 | if (vcard.org_unit) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1039 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1040 | _("Unit"), |
| 8849 | 1041 | vcard.org_unit); |
| 1042 | if (vcard.url) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1043 | g_string_append_printf(s, "%s:\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1044 | _("Homepage"), |
| 8849 | 1045 | vcard.url); |
| 1046 | if (vcard.label) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1047 | g_string_append_printf(s, "%s:\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1048 | _("Address"), |
| 8849 | 1049 | vcard.label); |
| 1050 | for (i = 0; i < vcard.num_tels; i++) { | |
| 1051 | if (vcard.tels[i].telnum) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1052 | g_string_append_printf(s, "%s:\t\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1053 | _("Phone"), |
| 8849 | 1054 | vcard.tels[i].telnum); |
| 1055 | } | |
| 1056 | for (i = 0; i < vcard.num_emails; i++) { | |
| 1057 | if (vcard.emails[i].address) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1058 | g_string_append_printf(s, "%s:\t\t%s\n", |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
22972
diff
changeset
|
1059 | _("Email"), |
| 8849 | 1060 | vcard.emails[i].address); |
| 1061 | } | |
| 1062 | if (vcard.note) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1063 | g_string_append_printf(s, "\n%s:\t\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1064 | _("Note"), |
| 8849 | 1065 | vcard.note); |
| 1066 | break; | |
| 1067 | } | |
| 1068 | } | |
| 1069 | ||
| 15884 | 1070 | purple_notify_info(NULL, _("User Information"), _("User Information"), |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22600
diff
changeset
|
1071 | s->str); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22600
diff
changeset
|
1072 | g_string_free(s, TRUE); |
| 8849 | 1073 | } |
| 9024 | 1074 | #endif |
| 8849 | 1075 | |
| 1076 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1077 | /* Command reply handler. Delivers a reply to command that was sent |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1078 | earlier. The `conn' is the associated client connection. The `command' |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1079 | indicates the command reply type. If the `status' other than |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1080 | SILC_STATUS_OK an error occurred. In this case the `error' will indicate |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1081 | the error. It is possible to receive list of command replies and list |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1082 | of errors. In this case the `status' will indicate it is an list entry |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1083 | (the `status' is SILC_STATUS_LIST_START, SILC_STATUS_LIST_ITEM and/or |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1084 | SILC_STATUS_LIST_END). |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1085 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1086 | The arguments received in `ap' are command specific. See a separate |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1087 | documentation in the Toolkit Reference Manual for the command reply |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1088 | arguments. */ |
| 8849 | 1089 | |
| 1090 | static void | |
| 1091 | silc_command_reply(SilcClient client, SilcClientConnection conn, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1092 | SilcCommand command, SilcStatus status, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1093 | SilcStatus error, va_list ap) |
| 8849 | 1094 | { |
| 15884 | 1095 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1096 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 15884 | 1097 | PurpleConversation *convo; |
| 8849 | 1098 | |
| 1099 | switch (command) { | |
| 1100 | case SILC_COMMAND_JOIN: | |
| 1101 | { | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1102 | SilcChannelEntry channel; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1103 | PurpleConversation *convo; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1104 | SilcHashTableList *user_list; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1105 | SilcChannelUser chu; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1106 | GList *users = NULL, *flags = NULL; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1107 | char tmp[256], *topic; |
| 8849 | 1108 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1109 | if (status != SILC_STATUS_OK) { |
| 15884 | 1110 | purple_notify_error(gc, _("Join Chat"), _("Cannot join channel"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1111 | silc_get_status_message(error)); |
| 8849 | 1112 | return; |
| 1113 | } | |
| 1114 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1115 | (void)va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1116 | channel = va_arg(ap, SilcChannelEntry); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1117 | (void)va_arg(ap, SilcUInt32); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1118 | user_list = va_arg(ap, SilcHashTableList *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1119 | topic = va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1120 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1121 | /* Add channel to Purple */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1122 | channel->context = SILC_32_TO_PTR(++sg->channel_ids); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1123 | serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1124 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1125 | channel->channel_name, sg->account); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1126 | if (!convo) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1127 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1128 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1129 | /* Add all users to channel */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1130 | while (silc_hash_table_get(user_list, NULL, (void *)&chu)) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1131 | PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1132 | chu->context = SILC_32_TO_PTR(sg->channel_ids); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1133 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1134 | if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1135 | f |= PURPLE_CBFLAGS_FOUNDER; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1136 | if (chu->mode & SILC_CHANNEL_UMODE_CHANOP) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1137 | f |= PURPLE_CBFLAGS_OP; |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22600
diff
changeset
|
1138 | users = g_list_append(users, chu->client->nickname); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1139 | flags = g_list_append(flags, GINT_TO_POINTER(f)); |
| 8849 | 1140 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1141 | if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1142 | if (chu->client == conn->local_entry) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1143 | g_snprintf(tmp, sizeof(tmp), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1144 | _("You are channel founder on <I>%s</I>"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1145 | channel->channel_name); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1146 | else |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1147 | g_snprintf(tmp, sizeof(tmp), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1148 | _("Channel founder on <I>%s</I> is <I>%s</I>"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1149 | channel->channel_name, chu->client->nickname); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1150 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1151 | purple_conversation_write(convo, NULL, tmp, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1152 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1153 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1154 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1155 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1156 | purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1157 | g_list_free(users); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1158 | g_list_free(flags); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1159 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1160 | /* Set topic */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1161 | if (topic) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1162 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, topic); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1163 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1164 | /* Set nick */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1165 | purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), conn->local_entry->nickname); |
| 8849 | 1166 | } |
| 1167 | break; | |
| 1168 | ||
| 1169 | case SILC_COMMAND_LEAVE: | |
| 1170 | break; | |
| 1171 | ||
| 1172 | case SILC_COMMAND_USERS: | |
| 1173 | break; | |
| 1174 | ||
| 1175 | case SILC_COMMAND_WHOIS: | |
| 1176 | { | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1177 | SilcUInt32 idle, *user_modes; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1178 | SilcDList channels; |
| 8849 | 1179 | SilcClientEntry client_entry; |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1180 | char tmp[1024]; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1181 | char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; |
| 15884 | 1182 | PurpleNotifyUserInfo *user_info; |
| 8849 | 1183 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1184 | if (status != SILC_STATUS_OK) { |
| 15884 | 1185 | purple_notify_error(gc, _("User Information"), |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1186 | _("Cannot get user information"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1187 | silc_get_status_message(error)); |
| 8849 | 1188 | break; |
| 1189 | } | |
| 1190 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1191 | client_entry = va_arg(ap, SilcClientEntry); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1192 | (void)va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1193 | (void)va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1194 | (void)va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1195 | channels = va_arg(ap, SilcDList); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1196 | (void)va_arg(ap, SilcUInt32); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1197 | idle = va_arg(ap, SilcUInt32); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1198 | (void)va_arg(ap, unsigned char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1199 | user_modes = va_arg(ap, SilcUInt32 *); |
| 8849 | 1200 | |
| 15884 | 1201 | user_info = purple_notify_user_info_new(); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1202 | purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), client_entry->nickname); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1203 | if (client_entry->realname) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1204 | purple_notify_user_info_add_pair_plaintext(user_info, _("Real Name"), client_entry->realname); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1205 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1206 | if (*client_entry->hostname) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1207 | gchar *tmp2; |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1208 | tmp2 = g_strdup_printf("%s@%s", client_entry->username, client_entry->hostname); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1209 | purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), tmp2); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1210 | g_free(tmp2); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1211 | } else |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1212 | purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), client_entry->username); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1213 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1214 | if (client_entry->mode) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1215 | memset(tmp, 0, sizeof(tmp)); |
| 15884 | 1216 | silcpurple_get_umode_string(client_entry->mode, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1217 | tmp, sizeof(tmp) - strlen(tmp)); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1218 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1219 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1220 | purple_notify_user_info_add_pair_html(user_info, _("User Modes"), tmp); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1221 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1222 | |
| 15884 | 1223 | silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1224 | if (moodstr) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1225 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1226 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1227 | purple_notify_user_info_add_pair_html(user_info, _("Mood"), moodstr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1228 | g_free(moodstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1229 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1230 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1231 | if (statusstr) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1232 | purple_notify_user_info_add_pair_plaintext(user_info, _("Status Text"), statusstr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1233 | g_free(statusstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1234 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1235 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1236 | if (contactstr) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1237 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1238 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1239 | purple_notify_user_info_add_pair_html(user_info, _("Preferred Contact"), contactstr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1240 | g_free(contactstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1241 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1242 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1243 | if (langstr) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1244 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1245 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1246 | purple_notify_user_info_add_pair_html(user_info, _("Preferred Language"), langstr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1247 | g_free(langstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1248 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1249 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1250 | if (devicestr) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1251 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1252 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1253 | purple_notify_user_info_add_pair_html(user_info, _("Device"), devicestr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1254 | g_free(devicestr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1255 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1256 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1257 | if (tzstr) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1258 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1259 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1260 | purple_notify_user_info_add_pair_html(user_info, _("Timezone"), tzstr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1261 | g_free(tzstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1262 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1263 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1264 | if (geostr) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1265 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1266 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1267 | purple_notify_user_info_add_pair_html(user_info, _("Geolocation"), geostr); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1268 | g_free(geostr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1269 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1270 | |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1271 | if (*client_entry->server) { |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1272 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1273 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1274 | purple_notify_user_info_add_pair_html(user_info, _("Server"), client_entry->server); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1275 | } |
| 8849 | 1276 | |
| 1277 | if (channels && user_modes) { | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1278 | SilcChannelPayload entry; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1279 | int i = 0; |
| 8849 | 1280 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1281 | memset(tmp, 0, sizeof(tmp)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1282 | silc_dlist_start(channels); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1283 | while ((entry = silc_dlist_get(channels))) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1284 | SilcUInt32 name_len; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1285 | char *m = silc_client_chumode_char(user_modes[i++]); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1286 | char *name = (char *)silc_channel_get_name(entry, &name_len); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1287 | if (m) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1288 | silc_strncat(tmp, sizeof(tmp) - 1, m, strlen(m)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1289 | silc_strncat(tmp, sizeof(tmp) - 1, name, name_len); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1290 | silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1291 | silc_free(m); |
| 8849 | 1292 | } |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1293 | purple_notify_user_info_add_pair_plaintext(user_info, _("Currently on"), tmp); |
| 8849 | 1294 | } |
| 1295 | ||
| 1296 | if (client_entry->public_key) { | |
| 1297 | char *fingerprint, *babbleprint; | |
| 1298 | unsigned char *pk; | |
| 1299 | SilcUInt32 pk_len; | |
| 1300 | pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1301 | if (pk) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1302 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1303 | babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1304 | purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Fingerprint"), fingerprint); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1305 | purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Babbleprint"), babbleprint); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1306 | silc_free(fingerprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1307 | silc_free(babbleprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1308 | silc_free(pk); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1309 | } |
| 8849 | 1310 | } |
| 1311 | ||
| 1312 | #if 0 /* XXX for now, let's not show attrs here */ | |
| 1313 | if (client_entry->attrs) | |
| 15884 | 1314 | purple_request_action(gc, _("User Information"), |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1315 | _("User Information"), |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1316 | buf, 1, client_entry, 2, |
| 15884 | 1317 | _("OK"), G_CALLBACK(silcpurple_whois_more), |
|
16492
4f0dc2d16e55
Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
1318 | _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); |
| 8849 | 1319 | else |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1320 | #endif /* 0 */ |
| 15884 | 1321 | purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); |
| 1322 | purple_notify_user_info_destroy(user_info); | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1323 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1324 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1325 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1326 | case SILC_COMMAND_WHOWAS: |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1327 | { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1328 | SilcClientEntry client_entry; |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1329 | char *nickname, *realname, *username; |
| 15884 | 1330 | PurpleNotifyUserInfo *user_info; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1331 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1332 | if (status != SILC_STATUS_OK) { |
| 15884 | 1333 | purple_notify_error(gc, _("User Information"), |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1334 | _("Cannot get user information"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1335 | silc_get_status_message(error)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1336 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1337 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1338 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1339 | client_entry = va_arg(ap, SilcClientEntry); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1340 | nickname = va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1341 | username = va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1342 | realname = va_arg(ap, char *); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1343 | if (!nickname) |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1344 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1345 | |
| 15884 | 1346 | user_info = purple_notify_user_info_new(); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1347 | purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), nickname); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1348 | if (realname) |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1349 | purple_notify_user_info_add_pair_plaintext(user_info, _("Real Name"), realname); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1350 | if (username) { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1351 | if (client_entry && *client_entry->hostname) { |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1352 | gchar *tmp; |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1353 | tmp = g_strdup_printf("%s@%s", username, client_entry->hostname); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1354 | purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), tmp); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1355 | g_free(tmp); |
|
15218
179fb04fbc87
[gaim-migrate @ 17942]
Mark Doliner <markdoliner@pidgin.im>
parents:
14749
diff
changeset
|
1356 | } else |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1357 | purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), username); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1358 | } |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1359 | if (client_entry && *client_entry->server) { |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1360 | /* TODO: Check whether it's correct to call add_pair_html, |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1361 | or if we should be using add_pair_plaintext */ |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
32188
diff
changeset
|
1362 | purple_notify_user_info_add_pair_html(user_info, _("Server"), client_entry->server); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1363 | } |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1364 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1365 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1366 | if (client_entry && client_entry->public_key) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1367 | char *fingerprint, *babbleprint; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1368 | unsigned char *pk; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1369 | SilcUInt32 pk_len; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1370 | pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1371 | if (pk) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1372 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1373 | babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1374 | purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Fingerprint"), fingerprint); |
|
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
1375 | purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Babbleprint"), babbleprint); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1376 | silc_free(fingerprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1377 | silc_free(babbleprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1378 | silc_free(pk); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1379 | } |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1380 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1381 | |
| 15884 | 1382 | purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); |
| 1383 | purple_notify_user_info_destroy(user_info); | |
| 8849 | 1384 | } |
| 1385 | break; | |
| 1386 | ||
| 1387 | case SILC_COMMAND_DETACH: | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1388 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1389 | const char *file; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1390 | SilcBuffer detach_data; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1391 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1392 | if (status != SILC_STATUS_OK) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1393 | purple_notify_error(gc, _("Detach From Server"), _("Cannot detach"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1394 | silc_get_status_message(error)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1395 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1396 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1397 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1398 | detach_data = va_arg(ap, SilcBuffer); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1399 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1400 | /* Save the detachment data to file. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1401 | file = silcpurple_session_file(purple_account_get_username(sg->account)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1402 | g_unlink(file); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1403 | silc_file_writefile(file, (const char *)silc_buffer_data(detach_data), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1404 | silc_buffer_len(detach_data)); |
| 8849 | 1405 | } |
| 1406 | break; | |
| 1407 | ||
| 1408 | case SILC_COMMAND_TOPIC: | |
| 1409 | { | |
| 1410 | SilcChannelEntry channel; | |
| 1411 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1412 | if (status != SILC_STATUS_OK) { |
| 15884 | 1413 | purple_notify_error(gc, _("Topic"), _("Cannot set topic"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1414 | silc_get_status_message(error)); |
| 8849 | 1415 | return; |
| 1416 | } | |
| 1417 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1418 | channel = va_arg(ap, SilcChannelEntry); |
| 8849 | 1419 | |
| 15884 | 1420 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1421 | channel->channel_name, sg->account); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1422 | if (!convo) { |
| 15884 | 1423 | purple_debug_error("silc", "Got a topic for %s, which doesn't exist\n", |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1424 | channel->channel_name); |
| 8849 | 1425 | break; |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1426 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1427 | |
| 8849 | 1428 | /* Set topic */ |
| 1429 | if (channel->topic) | |
| 15884 | 1430 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); |
| 8849 | 1431 | } |
| 1432 | break; | |
| 1433 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1434 | case SILC_COMMAND_NICK: |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1435 | { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1436 | SilcClientEntry local_entry; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1437 | SilcHashTableList htl; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1438 | SilcChannelUser chu; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1439 | const char *oldnick, *newnick; |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1440 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1441 | if (status != SILC_STATUS_OK) { |
| 15884 | 1442 | purple_notify_error(gc, _("Nick"), _("Failed to change nickname"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1443 | silc_get_status_message(error)); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1444 | return; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1445 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1446 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1447 | local_entry = va_arg(ap, SilcClientEntry); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1448 | newnick = va_arg(ap, char *); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1449 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1450 | /* Change nick on all channels */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1451 | silc_hash_table_list(local_entry->channels, &htl); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1452 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
| 15884 | 1453 | convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1454 | chu->channel->channel_name, sg->account); |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10091
diff
changeset
|
1455 | if (!convo) |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1456 | continue; |
| 15884 | 1457 | oldnick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(convo)); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1458 | if (strcmp(oldnick, purple_normalize(purple_conversation_get_account(convo), newnick))) { |
| 15884 | 1459 | purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1460 | oldnick, newnick); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1461 | purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), newnick); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1462 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1463 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1464 | silc_hash_table_list_reset(&htl); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1465 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1466 | purple_connection_set_display_name(gc, newnick); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1467 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1468 | break; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1469 | |
| 8849 | 1470 | case SILC_COMMAND_LIST: |
| 1471 | { | |
| 1472 | char *topic, *name; | |
| 1473 | int usercount; | |
| 15884 | 1474 | PurpleRoomlistRoom *room; |
| 8849 | 1475 | |
|
30708
535bec1e66fb
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28981
diff
changeset
|
1476 | if (sg->roomlist_cancelled) |
| 8849 | 1477 | break; |
| 1478 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1479 | if (error != SILC_STATUS_OK) { |
| 15884 | 1480 | purple_notify_error(gc, _("Error"), _("Error retrieving room list"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1481 | silc_get_status_message(error)); |
| 15884 | 1482 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
| 1483 | purple_roomlist_unref(sg->roomlist); | |
| 8849 | 1484 | sg->roomlist = NULL; |
| 1485 | return; | |
| 1486 | } | |
| 1487 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1488 | (void)va_arg(ap, SilcChannelEntry); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1489 | name = va_arg(ap, char *); |
|
10855
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1490 | if (!name) { |
| 15884 | 1491 | purple_notify_error(gc, _("Roomlist"), _("Cannot get room list"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1492 | _("Network is empty")); |
| 15884 | 1493 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
| 1494 | purple_roomlist_unref(sg->roomlist); | |
|
10855
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1495 | sg->roomlist = NULL; |
|
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1496 | return; |
|
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1497 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1498 | topic = va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1499 | usercount = va_arg(ap, int); |
| 8849 | 1500 | |
| 15884 | 1501 | room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); |
| 1502 | purple_roomlist_room_add_field(sg->roomlist, room, name); | |
| 1503 | purple_roomlist_room_add_field(sg->roomlist, room, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1504 | SILC_32_TO_PTR(usercount)); |
| 15884 | 1505 | purple_roomlist_room_add_field(sg->roomlist, room, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1506 | topic ? topic : ""); |
| 15884 | 1507 | purple_roomlist_room_add(sg->roomlist, room); |
| 8849 | 1508 | |
| 1509 | if (status == SILC_STATUS_LIST_END || | |
| 1510 | status == SILC_STATUS_OK) { | |
| 15884 | 1511 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
| 1512 | purple_roomlist_unref(sg->roomlist); | |
| 8849 | 1513 | sg->roomlist = NULL; |
| 1514 | } | |
| 1515 | } | |
| 1516 | break; | |
| 1517 | ||
| 1518 | case SILC_COMMAND_GETKEY: | |
| 1519 | { | |
| 1520 | SilcPublicKey public_key; | |
| 1521 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1522 | if (status != SILC_STATUS_OK) { |
| 15884 | 1523 | purple_notify_error(gc, _("Get Public Key"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1524 | _("Cannot fetch the public key"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1525 | silc_get_status_message(error)); |
| 8849 | 1526 | return; |
| 1527 | } | |
| 1528 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1529 | (void)va_arg(ap, SilcUInt32); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1530 | (void)va_arg(ap, void *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1531 | public_key = va_arg(ap, SilcPublicKey); |
| 8849 | 1532 | |
| 1533 | if (!public_key) | |
| 15884 | 1534 | purple_notify_error(gc, _("Get Public Key"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1535 | _("Cannot fetch the public key"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1536 | _("No public key was received")); |
| 8849 | 1537 | } |
| 1538 | break; | |
| 1539 | ||
| 1540 | case SILC_COMMAND_INFO: | |
| 1541 | { | |
| 1542 | ||
| 1543 | char *server_name; | |
| 1544 | char *server_info; | |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
1545 | char tmp[256]; |
| 8849 | 1546 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1547 | if (status != SILC_STATUS_OK) { |
| 15884 | 1548 | purple_notify_error(gc, _("Server Information"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1549 | _("Cannot get server information"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1550 | silc_get_status_message(error)); |
| 8849 | 1551 | return; |
| 1552 | } | |
| 1553 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1554 | (void)va_arg(ap, SilcServerEntry); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1555 | server_name = va_arg(ap, char *); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1556 | server_info = va_arg(ap, char *); |
| 8849 | 1557 | |
| 1558 | if (server_name && server_info) { | |
| 1559 | g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", | |
| 1560 | server_name, server_info); | |
| 15884 | 1561 | purple_notify_info(gc, NULL, _("Server Information"), tmp); |
| 8849 | 1562 | } |
| 1563 | } | |
| 1564 | break; | |
| 1565 | ||
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1566 | case SILC_COMMAND_STATS: |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1567 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1568 | SilcClientStats *stats; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1569 | char *msg; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1570 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1571 | if (status != SILC_STATUS_OK) { |
| 15884 | 1572 | purple_notify_error(gc, _("Server Statistics"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1573 | _("Cannot get server statistics"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1574 | silc_get_status_message(error)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1575 | return; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1576 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1577 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1578 | stats = va_arg(ap, SilcClientStats *); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1579 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1580 | msg = g_strdup_printf(_("Local server start time: %s\n" |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1581 | "Local server uptime: %s\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1582 | "Local server clients: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1583 | "Local server channels: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1584 | "Local server operators: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1585 | "Local router operators: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1586 | "Local cell clients: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1587 | "Local cell channels: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1588 | "Local cell servers: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1589 | "Total clients: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1590 | "Total channels: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1591 | "Total servers: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1592 | "Total routers: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1593 | "Total server operators: %d\n" |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1594 | "Total router operators: %d\n"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1595 | silc_time_string(stats->starttime), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1596 | purple_str_seconds_to_string((int)stats->uptime), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1597 | (int)stats->my_clients, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1598 | (int)stats->my_channels, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1599 | (int)stats->my_server_ops, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1600 | (int)stats->my_router_ops, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1601 | (int)stats->cell_clients, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1602 | (int)stats->cell_channels, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1603 | (int)stats->cell_servers, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1604 | (int)stats->clients, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1605 | (int)stats->channels, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1606 | (int)stats->servers, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1607 | (int)stats->routers, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1608 | (int)stats->server_ops, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1609 | (int)stats->router_ops); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1610 | |
| 15884 | 1611 | purple_notify_info(gc, NULL, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1612 | _("Network Statistics"), msg); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1613 | g_free(msg); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1614 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1615 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1616 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1617 | case SILC_COMMAND_PING: |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1618 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1619 | if (status != SILC_STATUS_OK) { |
| 15884 | 1620 | purple_notify_error(gc, _("Ping"), _("Ping failed"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1621 | silc_get_status_message(error)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1622 | return; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1623 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1624 | |
| 15884 | 1625 | purple_notify_info(gc, _("Ping"), _("Ping reply received from server"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1626 | NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1627 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1628 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1629 | |
| 8849 | 1630 | case SILC_COMMAND_KILL: |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1631 | if (status != SILC_STATUS_OK) { |
| 15884 | 1632 | purple_notify_error(gc, _("Kill User"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1633 | _("Could not kill user"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1634 | silc_get_status_message(error)); |
| 8849 | 1635 | return; |
| 1636 | } | |
| 1637 | break; | |
| 1638 | ||
| 1639 | case SILC_COMMAND_CMODE: | |
| 1640 | { | |
| 1641 | SilcChannelEntry channel_entry; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1642 | SilcDList channel_pubkeys, list; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1643 | SilcArgumentDecodedList e; |
| 8849 | 1644 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1645 | if (status != SILC_STATUS_OK) |
| 8849 | 1646 | return; |
| 1647 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1648 | channel_entry = va_arg(ap, SilcChannelEntry); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1649 | (void)va_arg(ap, SilcUInt32); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1650 | (void)va_arg(ap, SilcPublicKey); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1651 | channel_pubkeys = va_arg(ap, SilcDList); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1652 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1653 | if (!sg->chpk) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1654 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1655 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1656 | list = silc_dlist_init(); |
| 8849 | 1657 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1658 | if (channel_pubkeys) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1659 | silc_dlist_start(channel_pubkeys); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1660 | while ((e = silc_dlist_get(channel_pubkeys))) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1661 | if (e->arg_type == 0x00 || |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1662 | e->arg_type == 0x03) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1663 | silc_dlist_add(list, silc_pkcs_public_key_copy(e->argument)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1664 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1665 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1666 | silcpurple_chat_chauth_show(sg, channel_entry, list); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1667 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1668 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1669 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1670 | case SILC_COMMAND_WATCH: |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1671 | if (status != SILC_STATUS_OK) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1672 | purple_notify_error(gc, _("WATCH"), _("Cannot watch user"), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1673 | silc_get_status_message(error)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1674 | return; |
| 8849 | 1675 | } |
| 1676 | break; | |
| 1677 | ||
| 1678 | default: | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1679 | if (status == SILC_STATUS_OK) |
| 15884 | 1680 | purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1681 | else |
| 15884 | 1682 | purple_debug_info("silc", "Unhandled command: %d (failed: %s)\n", command, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1683 | silc_get_status_message(error)); |
| 8849 | 1684 | break; |
| 1685 | } | |
| 1686 | } | |
| 1687 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1688 | /* Generic command reply callback for silc_client_command_send. Simply |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1689 | calls the default command_reply client operation callback */ |
| 8849 | 1690 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1691 | SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1692 | SilcCommand command, SilcStatus status, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1693 | SilcStatus error, void *context, va_list ap) |
| 8849 | 1694 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1695 | silc_command_reply(client, conn, command, status, error, ap); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1696 | return TRUE; |
| 8849 | 1697 | } |
| 1698 | ||
| 1699 | ||
| 1700 | typedef struct { | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1701 | union { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1702 | SilcAskPassphrase ask_pass; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1703 | SilcGetAuthMeth get_auth; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1704 | } u; |
| 8849 | 1705 | void *context; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1706 | } *SilcPurpleAskPassphrase; |
| 8849 | 1707 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1708 | static void |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1709 | silc_ask_auth_password_cb(const unsigned char *passphrase, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1710 | SilcUInt32 passphrase_len, void *context) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1711 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1712 | SilcPurpleAskPassphrase internal = context; |
| 8849 | 1713 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1714 | if (!passphrase || !(*passphrase)) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1715 | internal->u.get_auth(SILC_AUTH_NONE, NULL, 0, internal->context); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1716 | else |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1717 | internal->u.get_auth(SILC_AUTH_PASSWORD, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1718 | (unsigned char *)passphrase, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1719 | passphrase_len, internal->context); |
| 8849 | 1720 | silc_free(internal); |
| 1721 | } | |
| 1722 | ||
| 1723 | /* Find authentication method and authentication data by hostname and | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1724 | port. The hostname may be IP address as well. The `auth_method' is |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1725 | the authentication method the remote connection requires. It is |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1726 | however possible that remote accepts also some other authentication |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1727 | method. Application should use the method that may have been |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1728 | configured for this connection. If none has been configured it should |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1729 | use the required `auth_method'. If the `auth_method' is |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1730 | SILC_AUTH_NONE, server does not require any authentication or the |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1731 | required authentication method is not known. The `completion' |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1732 | callback must be called to deliver the chosen authentication method |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1733 | and data. The `conn' may be NULL. */ |
| 8849 | 1734 | |
| 1735 | static void | |
| 1736 | silc_get_auth_method(SilcClient client, SilcClientConnection conn, | |
| 1737 | char *hostname, SilcUInt16 port, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1738 | SilcAuthMethod auth_method, |
| 8849 | 1739 | SilcGetAuthMeth completion, void *context) |
| 1740 | { | |
| 15884 | 1741 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1742 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1743 | SilcPurpleAskPassphrase internal; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
1744 | const char *password; |
| 8849 | 1745 | |
| 1746 | /* Progress */ | |
| 1747 | if (sg->resuming) | |
| 15884 | 1748 | purple_connection_update_progress(gc, _("Resuming session"), 4, 5); |
| 8849 | 1749 | else |
| 15884 | 1750 | purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); |
| 8849 | 1751 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1752 | /* Check configuration if we have this connection configured. */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1753 | if (auth_method == SILC_AUTH_PUBLIC_KEY && |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1754 | purple_account_get_bool(sg->account, "pubkey-auth", FALSE)) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1755 | completion(SILC_AUTH_PUBLIC_KEY, NULL, 0, context); |
| 10336 | 1756 | return; |
| 1757 | } | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1758 | if (auth_method == SILC_AUTH_PASSWORD) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1759 | password = purple_connection_get_password(gc); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1760 | if (password && *password) { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1761 | completion(SILC_AUTH_PASSWORD, (unsigned char *)password, strlen(password), context); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1762 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1763 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1764 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1765 | /* Ask password from user */ |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1766 | internal = silc_calloc(1, sizeof(*internal)); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1767 | if (!internal) |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1768 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1769 | internal->u.get_auth = completion; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1770 | internal->context = context; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1771 | silc_ask_passphrase(client, conn, silc_ask_auth_password_cb, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1772 | internal); |
| 8849 | 1773 | return; |
| 1774 | } | |
| 1775 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1776 | completion(SILC_AUTH_NONE, NULL, 0, context); |
| 8849 | 1777 | } |
| 1778 | ||
| 1779 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1780 | /* Called to verify received public key. The `conn_type' indicates which |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1781 | entity (server or client) has sent the public key. If user decides to |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1782 | trust the key the application may save the key as trusted public key for |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1783 | later use. The `completion' must be called after the public key has |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1784 | been verified. */ |
| 8849 | 1785 | |
| 1786 | static void | |
| 1787 | silc_verify_public_key(SilcClient client, SilcClientConnection conn, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1788 | SilcConnectionType conn_type, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1789 | SilcPublicKey public_key, |
| 8849 | 1790 | SilcVerifyPublicKey completion, void *context) |
| 1791 | { | |
| 15884 | 1792 | PurpleConnection *gc = client->application; |
|
32281
0ef1a6d8ca53
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32191
diff
changeset
|
1793 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1794 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1795 | if (!sg->conn && (conn_type == SILC_CONN_SERVER || |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1796 | conn_type == SILC_CONN_ROUTER)) { |
| 8849 | 1797 | /* Progress */ |
| 1798 | if (sg->resuming) | |
| 15884 | 1799 | purple_connection_update_progress(gc, _("Resuming session"), 3, 5); |
| 8849 | 1800 | else |
| 15884 | 1801 | purple_connection_update_progress(gc, _("Verifying server public key"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1802 | 3, 5); |
| 8849 | 1803 | } |
| 1804 | ||
| 1805 | /* Verify public key */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1806 | silcpurple_verify_public_key(client, conn, NULL, conn_type, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1807 | public_key, completion, context); |
| 8849 | 1808 | } |
| 1809 | ||
| 1810 | static void | |
| 15884 | 1811 | silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) |
| 8849 | 1812 | { |
| 1813 | if (!passphrase || !(*passphrase)) | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1814 | internal->u.ask_pass(NULL, 0, internal->context); |
| 8849 | 1815 | else |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1816 | internal->u.ask_pass((unsigned char *)passphrase, |
| 8849 | 1817 | strlen(passphrase), internal->context); |
| 1818 | silc_free(internal); | |
| 1819 | } | |
| 1820 | ||
| 1821 | /* Ask (interact, that is) a passphrase from user. The passphrase is | |
| 1822 | returned to the library by calling the `completion' callback with | |
| 1823 | the `context'. The returned passphrase SHOULD be in UTF-8 encoded, | |
| 1824 | if not then the library will attempt to encode. */ | |
| 1825 | ||
| 1826 | static void | |
| 1827 | silc_ask_passphrase(SilcClient client, SilcClientConnection conn, | |
| 1828 | SilcAskPassphrase completion, void *context) | |
| 1829 | { | |
|
16492
4f0dc2d16e55
Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
1830 | PurpleConnection *gc = client->application; |
| 15884 | 1831 | SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); |
| 8849 | 1832 | |
| 1833 | if (!internal) | |
| 1834 | return; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1835 | internal->u.ask_pass = completion; |
| 8849 | 1836 | internal->context = context; |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1837 | purple_request_input(gc, _("Passphrase"), NULL, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1838 | _("Passphrase required"), NULL, FALSE, TRUE, NULL, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1839 | _("OK"), G_CALLBACK(silc_ask_passphrase_cb), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1840 | _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1841 | purple_connection_get_account(gc), NULL, NULL, internal); |
| 8849 | 1842 | } |
| 1843 | ||
| 1844 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1845 | /* Called to indicate that incoming key agreement request has been |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1846 | received. If the application wants to perform key agreement it may |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1847 | call silc_client_perform_key_agreement to initiate key agreement or |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1848 | silc_client_send_key_agreement to provide connection point to the |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1849 | remote client in case the `hostname' is NULL. If key agreement is |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1850 | not desired this request can be ignored. The `protocol' is either |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1851 | value 0 for TCP or value 1 for UDP. */ |
| 8849 | 1852 | |
| 1853 | static void | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1854 | silc_key_agreement(SilcClient client, SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1855 | SilcClientEntry client_entry, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1856 | const char *hostname, SilcUInt16 protocol, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1857 | SilcUInt16 port) |
| 8849 | 1858 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1859 | silcpurple_buddy_keyagr_request(client, conn, client_entry, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1860 | hostname, port, protocol); |
| 8849 | 1861 | } |
| 1862 | ||
| 1863 | ||
| 1864 | /* Notifies application that file transfer protocol session is being | |
| 1865 | requested by the remote client indicated by the `client_entry' from | |
| 1866 | the `hostname' and `port'. The `session_id' is the file transfer | |
| 1867 | session and it can be used to either accept or reject the file | |
| 1868 | transfer request, by calling the silc_client_file_receive or | |
| 1869 | silc_client_file_close, respectively. */ | |
| 1870 | ||
| 1871 | static void | |
| 1872 | silc_ftp(SilcClient client, SilcClientConnection conn, | |
| 1873 | SilcClientEntry client_entry, SilcUInt32 session_id, | |
| 1874 | const char *hostname, SilcUInt16 port) | |
| 1875 | { | |
| 15884 | 1876 | silcpurple_ftp_request(client, conn, client_entry, session_id, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1877 | hostname, port); |
| 8849 | 1878 | } |
| 1879 | ||
| 1880 | SilcClientOperations ops = { | |
| 1881 | silc_say, | |
| 1882 | silc_channel_message, | |
| 1883 | silc_private_message, | |
| 1884 | silc_notify, | |
| 1885 | silc_command, | |
| 1886 | silc_command_reply, | |
| 1887 | silc_get_auth_method, | |
| 1888 | silc_verify_public_key, | |
| 1889 | silc_ask_passphrase, | |
| 1890 | silc_key_agreement, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1891 | silc_ftp |
| 8849 | 1892 | }; |