Thu, 12 Sep 2013 19:55:22 +0530
Merged soc.2013.gobjectification branch
| 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; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
96 | PurpleChatConversation *chat = 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); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
124 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
125 | 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
|
126 | /* 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
|
127 | 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
|
128 | 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
|
129 | /* 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
|
130 | 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
|
131 | 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
|
132 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
133 | } |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
134 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
135 | 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
|
136 | /* 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
|
137 | 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
|
138 | 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
|
139 | 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
|
140 | /* 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
|
141 | 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
|
142 | 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
|
143 | 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
|
144 | 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
|
145 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
146 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
147 | } |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
148 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
149 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
150 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
151 | } |
|
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 | /* Get content type and MIME data */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
154 | type = silc_mime_get_field(mime, "Content-Type"); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
155 | if (!type) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
156 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
157 | data = silc_mime_get_data(mime, &data_len); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
158 | if (!data) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
159 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
160 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
161 | /* Process according to content type */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
162 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
163 | /* Plain text */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
164 | if (strstr(type, "text/plain")) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
165 | /* Default is UTF-8, don't check for other charsets */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
166 | if (!strstr(type, "utf-8")) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
167 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
168 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
169 | if (channel) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
170 | 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
|
171 | payload, key, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
172 | SILC_MESSAGE_FLAG_UTF8, data, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
173 | data_len); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
174 | else |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
175 | silc_private_message(client, conn, sender, payload, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
176 | SILC_MESSAGE_FLAG_UTF8, data, |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
177 | 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
|
178 | ret = TRUE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
179 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
180 | } |
|
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 | /* Image */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
183 | if (strstr(type, "image/png") || |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
184 | strstr(type, "image/jpeg") || |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
185 | strstr(type, "image/gif") || |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
186 | strstr(type, "image/tiff")) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
187 | char tmp[32]; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
188 | int imgid; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
189 | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
190 | /* Get channel chat (if message is for channel) */ |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
191 | if (key && channel) { |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
192 | GList *l; |
| 15884 | 193 | SilcPurplePrvgrp prv; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
194 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
195 | for (l = sg->grps; l; l = l->next) |
| 15884 | 196 | if (((SilcPurplePrvgrp)l->data)->key == key) { |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
197 | prv = l->data; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
198 | chat = purple_conversations_find_chat_with_account( |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
199 | prv->channel, sg->account); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
200 | break; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
201 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
202 | } |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
203 | if (channel && !chat) |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
204 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
205 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
206 | if (channel && !chat) |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
207 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
208 | |
| 33661 | 209 | 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
|
210 | if (imgid) { |
| 15884 | 211 | 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
|
212 | 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
|
213 | "<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
|
214 | 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
|
215 | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
216 | if (channel) |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
217 | serv_got_chat_in(gc, purple_chat_conversation_get_id(chat), |
|
33787
eb88fd4cbced
Remove various array comparisons to NULL because they're silly
Daniel Atallah <datallah@pidgin.im>
parents:
32063
diff
changeset
|
218 | sender->nickname, cflags, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
219 | tmp, time(NULL)); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
220 | else |
|
33787
eb88fd4cbced
Remove various array comparisons to NULL because they're silly
Daniel Atallah <datallah@pidgin.im>
parents:
32063
diff
changeset
|
221 | serv_got_im(gc, sender->nickname, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
222 | tmp, cflags, time(NULL)); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
223 | |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
224 | 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
|
225 | ret = TRUE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
226 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
227 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
228 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
229 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
230 | /* Whiteboard message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
231 | if (strstr(type, "application/x-wb") && |
| 15884 | 232 | !purple_account_get_bool(sg->account, "block-wb", FALSE)) { |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
233 | if (channel) |
| 15884 | 234 | silcpurple_wb_receive_ch(client, conn, sender, channel, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
235 | payload, flags, data, data_len); |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
236 | else |
| 15884 | 237 | 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
|
238 | 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
|
239 | ret = TRUE; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
240 | goto out; |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
241 | } |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
242 | |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
243 | out: |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
244 | if (!recursive) |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
245 | 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
|
246 | return ret; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
247 | } |
| 8849 | 248 | |
| 249 | /* Message for a channel. The `sender' is the sender of the message | |
| 250 | The `channel' is the channel. The `message' is the message. Note | |
| 251 | that `message' maybe NULL. The `flags' indicates message flags | |
| 252 | and it is used to determine how the message can be interpreted | |
| 253 | (like it may tell the message is multimedia message). */ | |
| 254 | ||
| 255 | static void | |
| 256 | silc_channel_message(SilcClient client, SilcClientConnection conn, | |
| 257 | 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
|
258 | 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
|
259 | 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
|
260 | const unsigned char *message, |
| 8849 | 261 | SilcUInt32 message_len) |
| 262 | { | |
| 15884 | 263 | 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
|
264 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
265 | PurpleChatConversation *chat = NULL; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
266 | char *msg, *tmp; |
| 8849 | 267 | |
| 268 | if (!message) | |
| 269 | return; | |
| 270 | ||
| 271 | if (key) { | |
| 272 | GList *l; | |
| 15884 | 273 | SilcPurplePrvgrp prv; |
| 8849 | 274 | |
| 275 | for (l = sg->grps; l; l = l->next) | |
| 15884 | 276 | if (((SilcPurplePrvgrp)l->data)->key == key) { |
| 8849 | 277 | prv = l->data; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
278 | chat = purple_conversations_find_chat_with_account( |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10091
diff
changeset
|
279 | prv->channel, sg->account); |
| 8849 | 280 | break; |
| 281 | } | |
| 282 | } | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
283 | if (!chat) |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
284 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
285 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
286 | if (!chat) |
| 8849 | 287 | return; |
| 288 | ||
| 289 | if (flags & SILC_MESSAGE_FLAG_SIGNED && | |
| 15884 | 290 | purple_account_get_bool(sg->account, "sign-verify", FALSE)) { |
| 8849 | 291 | /* XXX */ |
| 292 | } | |
| 293 | ||
| 294 | if (flags & SILC_MESSAGE_FLAG_DATA) { | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
295 | /* Process MIME message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
296 | 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
|
297 | mime = silc_mime_decode(NULL, message, message_len); |
| 15884 | 298 | 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
|
299 | key, flags, mime, FALSE); |
| 8849 | 300 | return; |
| 301 | } | |
| 302 | ||
| 303 | if (flags & SILC_MESSAGE_FLAG_ACTION) { | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
304 | msg = g_strdup_printf("/me %s", |
| 8849 | 305 | (const char *)message); |
| 306 | if (!msg) | |
| 307 | return; | |
| 308 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
309 | tmp = g_markup_escape_text(msg, -1); |
| 15884 | 310 | /* Send to Purple */ |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
311 | serv_got_chat_in(gc, purple_chat_conversation_get_id(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
|
312 | sender->nickname, 0, tmp, time(NULL)); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
313 | g_free(tmp); |
| 8849 | 314 | g_free(msg); |
| 315 | return; | |
| 316 | } | |
| 317 | ||
| 318 | if (flags & SILC_MESSAGE_FLAG_NOTICE) { | |
| 319 | 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
|
320 | sender->nickname, (const char *)message); |
| 8849 | 321 | if (!msg) |
| 322 | return; | |
| 323 | ||
| 15884 | 324 | /* Send to Purple */ |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
325 | purple_conversation_write(PURPLE_CONVERSATION(chat), NULL, (const char *)msg, |
| 15884 | 326 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8849 | 327 | g_free(msg); |
| 328 | return; | |
| 329 | } | |
| 330 | ||
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
331 | 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
|
332 | const char *msg = (const char *)message; |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
333 | char *salvaged = NULL; |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
334 | 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
|
335 | 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
|
336 | msg = salvaged; |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
337 | } |
|
fa8d4132d071
Fix another possible remote crash bug in SILC.
Mark Doliner <markdoliner@pidgin.im>
parents:
32045
diff
changeset
|
338 | tmp = g_markup_escape_text(msg, -1); |
| 15884 | 339 | /* Send to Purple */ |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
340 | serv_got_chat_in(gc, purple_chat_conversation_get_id(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
|
341 | 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
|
342 | g_free(salvaged); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
343 | g_free(tmp); |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
344 | } |
| 8849 | 345 | } |
| 346 | ||
| 347 | ||
| 348 | /* Private message to the client. The `sender' is the sender of the | |
| 349 | message. The message is `message'and maybe NULL. The `flags' | |
| 350 | indicates message flags and it is used to determine how the message | |
| 351 | can be interpreted (like it may tell the message is multimedia | |
| 352 | message). */ | |
| 353 | ||
| 354 | static void | |
| 355 | silc_private_message(SilcClient client, SilcClientConnection conn, | |
| 356 | SilcClientEntry sender, SilcMessagePayload payload, | |
| 357 | SilcMessageFlags flags, const unsigned char *message, | |
| 358 | SilcUInt32 message_len) | |
| 359 | { | |
| 15884 | 360 | 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
|
361 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
33787
eb88fd4cbced
Remove various array comparisons to NULL because they're silly
Daniel Atallah <datallah@pidgin.im>
parents:
32063
diff
changeset
|
362 | PurpleConversation *convo; |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
363 | char *msg, *tmp; |
| 8849 | 364 | |
| 365 | if (!message) | |
| 366 | return; | |
| 367 | ||
|
33787
eb88fd4cbced
Remove various array comparisons to NULL because they're silly
Daniel Atallah <datallah@pidgin.im>
parents:
32063
diff
changeset
|
368 | /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
369 | convo = purple_conversations_find_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
370 | sender->nickname, sg->account); |
| 8849 | 371 | |
| 372 | if (flags & SILC_MESSAGE_FLAG_SIGNED && | |
| 15884 | 373 | purple_account_get_bool(sg->account, "sign-verify", FALSE)) { |
| 8849 | 374 | /* XXX */ |
| 375 | } | |
| 376 | ||
| 377 | if (flags & SILC_MESSAGE_FLAG_DATA) { | |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
378 | /* Process MIME message */ |
|
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
379 | 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
|
380 | mime = silc_mime_decode(NULL, message, message_len); |
| 15884 | 381 | silcpurple_mime_message(client, conn, sender, NULL, payload, |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12167
diff
changeset
|
382 | NULL, flags, mime, FALSE); |
| 8849 | 383 | return; |
| 384 | } | |
| 385 | ||
| 386 | if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
387 | msg = g_strdup_printf("/me %s", |
| 8849 | 388 | (const char *)message); |
| 389 | if (!msg) | |
| 390 | return; | |
| 391 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
392 | /* Send to Purple */ |
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
393 | 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
|
394 | serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); |
| 8849 | 395 | g_free(msg); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
396 | g_free(tmp); |
| 8849 | 397 | return; |
| 398 | } | |
| 399 | ||
| 400 | if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { | |
| 401 | 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
|
402 | sender->nickname, (const char *)message); |
| 8849 | 403 | if (!msg) |
| 404 | return; | |
| 405 | ||
| 15884 | 406 | /* Send to Purple */ |
| 407 | 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
|
408 | PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8849 | 409 | g_free(msg); |
| 410 | return; | |
| 411 | } | |
| 412 | ||
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
413 | if (flags & SILC_MESSAGE_FLAG_UTF8) { |
|
32045
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
414 | const char *msg = (const char *)message; |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
415 | char *salvaged = NULL; |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
416 | 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
|
417 | salvaged = purple_utf8_salvage((const char *)message); |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
418 | msg = salvaged; |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
419 | } |
|
69372ee4f474
Salvage incoming SILC text if necessary.
Ethan Blanton <elb@pidgin.im>
parents:
30708
diff
changeset
|
420 | tmp = g_markup_escape_text(msg, -1); |
| 15884 | 421 | /* 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
|
422 | 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
|
423 | g_free(salvaged); |
|
9359
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
424 | g_free(tmp); |
|
89c40efa7f7b
[gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9353
diff
changeset
|
425 | } |
| 8849 | 426 | } |
| 427 | ||
| 428 | ||
| 429 | /* Notify message to the client. The notify arguments are sent in the | |
| 430 | same order as servers sends them. The arguments are same as received | |
| 431 | from the server except for ID's. If ID is received application receives | |
| 432 | the corresponding entry to the ID. For example, if Client ID is received | |
| 433 | application receives SilcClientEntry. Also, if the notify type is | |
| 434 | for channel the channel entry is sent to application (even if server | |
| 435 | does not send it because client library gets the channel entry from | |
| 436 | the Channel ID in the packet's header). */ | |
| 437 | ||
| 438 | static void | |
| 439 | silc_notify(SilcClient client, SilcClientConnection conn, | |
| 440 | SilcNotifyType type, ...) | |
| 441 | { | |
| 442 | va_list va; | |
| 15884 | 443 | 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
|
444 | 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
|
445 | PurpleAccount *account = purple_connection_get_account(gc); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
446 | PurpleChatConversation *chat; |
| 8849 | 447 | SilcClientEntry client_entry, client_entry2; |
| 448 | SilcChannelEntry channel; | |
| 449 | SilcServerEntry server_entry; | |
| 450 | SilcIdType idtype; | |
| 451 | void *entry; | |
| 452 | SilcUInt32 mode; | |
| 453 | SilcHashTableList htl; | |
| 454 | SilcChannelUser chu; | |
| 455 | char buf[512], buf2[512], *tmp, *name; | |
| 456 | SilcNotifyType notify; | |
| 15884 | 457 | 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
|
458 | SilcDList list; |
| 8849 | 459 | |
| 460 | va_start(va, type); | |
| 461 | memset(buf, 0, sizeof(buf)); | |
| 462 | ||
| 463 | switch (type) { | |
| 464 | ||
| 465 | case SILC_NOTIFY_TYPE_NONE: | |
| 466 | break; | |
| 467 | ||
| 468 | case SILC_NOTIFY_TYPE_INVITE: | |
| 469 | { | |
| 470 | 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
|
471 | (void)va_arg(va, SilcChannelEntry); |
| 8849 | 472 | name = va_arg(va, char *); |
| 473 | client_entry = va_arg(va, SilcClientEntry); | |
| 474 | ||
| 475 | 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
|
476 | 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
|
477 | serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); |
| 8849 | 478 | } |
| 479 | break; | |
| 480 | ||
| 481 | case SILC_NOTIFY_TYPE_JOIN: | |
| 482 | client_entry = va_arg(va, SilcClientEntry); | |
| 483 | channel = va_arg(va, SilcChannelEntry); | |
| 484 | ||
| 485 | /* If we joined channel, do nothing */ | |
| 486 | if (client_entry == conn->local_entry) | |
| 487 | break; | |
| 488 | ||
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
489 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
490 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
491 | if (!chat) |
| 8849 | 492 | break; |
| 493 | ||
| 494 | /* Join user to channel */ | |
| 8891 | 495 | g_snprintf(buf, sizeof(buf), "%s@%s", |
| 8849 | 496 | client_entry->username, client_entry->hostname); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
497 | purple_chat_conversation_add_user(chat, |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
498 | client_entry->nickname, buf, PURPLE_CHAT_USER_NONE, TRUE); |
| 8849 | 499 | |
| 500 | break; | |
| 501 | ||
| 502 | case SILC_NOTIFY_TYPE_LEAVE: | |
| 503 | client_entry = va_arg(va, SilcClientEntry); | |
| 504 | channel = va_arg(va, SilcChannelEntry); | |
| 505 | ||
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
506 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
507 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
508 | if (!chat) |
| 8849 | 509 | break; |
| 510 | ||
| 511 | /* Remove user from channel */ | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
512 | purple_chat_conversation_remove_user(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 | client_entry->nickname, NULL); |
| 8849 | 514 | |
| 515 | break; | |
| 516 | ||
| 517 | case SILC_NOTIFY_TYPE_SIGNOFF: | |
| 518 | client_entry = va_arg(va, SilcClientEntry); | |
| 519 | tmp = va_arg(va, char *); | |
| 520 | ||
| 521 | /* Remove from all channels */ | |
| 522 | silc_hash_table_list(client_entry->channels, &htl); | |
| 523 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
524 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
525 | chu->channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
526 | if (!chat) |
| 8849 | 527 | continue; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
528 | purple_chat_conversation_remove_user(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
|
529 | 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
|
530 | tmp); |
| 8849 | 531 | } |
| 532 | silc_hash_table_list_reset(&htl); | |
| 533 | ||
| 534 | break; | |
| 535 | ||
| 536 | case SILC_NOTIFY_TYPE_TOPIC_SET: | |
| 9762 | 537 | { |
| 538 | char *esc, *tmp2; | |
| 539 | idtype = va_arg(va, int); | |
| 540 | entry = va_arg(va, void *); | |
| 541 | tmp = va_arg(va, char *); | |
| 542 | channel = va_arg(va, SilcChannelEntry); | |
| 543 | ||
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
544 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
545 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
546 | if (!chat) |
| 9762 | 547 | break; |
| 548 | ||
| 549 | if (!tmp) | |
| 550 | break; | |
| 551 | ||
|
10732
5e314ab498bf
[gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
552 | esc = g_markup_escape_text(tmp, -1); |
| 15884 | 553 | tmp2 = purple_markup_linkify(esc); |
| 9762 | 554 | g_free(esc); |
| 8849 | 555 | |
| 9762 | 556 | if (idtype == SILC_ID_CLIENT) { |
| 557 | client_entry = (SilcClientEntry)entry; | |
| 558 | g_snprintf(buf, sizeof(buf), | |
| 559 | _("%s has changed the topic of <I>%s</I> to: %s"), | |
| 560 | client_entry->nickname, channel->channel_name, tmp2); | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
561 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), client_entry->nickname, |
| 15884 | 562 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
563 | purple_chat_conversation_set_topic(chat, |
| 9762 | 564 | client_entry->nickname, tmp); |
| 565 | } else if (idtype == SILC_ID_SERVER) { | |
| 566 | server_entry = (SilcServerEntry)entry; | |
| 567 | g_snprintf(buf, sizeof(buf), | |
| 568 | _("%s has changed the topic of <I>%s</I> to: %s"), | |
| 569 | server_entry->server_name, channel->channel_name, tmp2); | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
570 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), server_entry->server_name, |
| 15884 | 571 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
572 | purple_chat_conversation_set_topic(chat, |
| 9762 | 573 | server_entry->server_name, tmp); |
| 574 | } else if (idtype == SILC_ID_CHANNEL) { | |
| 575 | channel = (SilcChannelEntry)entry; | |
| 576 | g_snprintf(buf, sizeof(buf), | |
| 577 | _("%s has changed the topic of <I>%s</I> to: %s"), | |
| 578 | channel->channel_name, channel->channel_name, tmp2); | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
579 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), channel->channel_name, |
| 15884 | 580 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
581 | purple_chat_conversation_set_topic(chat, |
| 9762 | 582 | channel->channel_name, tmp); |
| 583 | } else { | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
584 | purple_chat_conversation_set_topic(chat, NULL, tmp); |
| 9762 | 585 | } |
| 8849 | 586 | |
| 9762 | 587 | g_free(tmp2); |
| 588 | ||
| 8849 | 589 | break; |
| 590 | ||
| 591 | } | |
| 592 | case SILC_NOTIFY_TYPE_NICK_CHANGE: | |
| 593 | 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
|
594 | 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
|
595 | name = va_arg(va, char *); /* New nick */ |
| 8849 | 596 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
597 | if (!strcmp(tmp, name)) |
| 8849 | 598 | break; |
| 599 | ||
| 600 | /* 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
|
601 | silc_hash_table_list(client_entry->channels, &htl); |
| 8849 | 602 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
603 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
604 | chu->channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
605 | if (!chat) |
| 8849 | 606 | continue; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
607 | if (purple_chat_conversation_has_user(chat, client_entry->nickname)) |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
608 | purple_chat_conversation_rename_user(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
|
609 | tmp, name); |
| 8849 | 610 | } |
| 611 | silc_hash_table_list_reset(&htl); | |
| 612 | ||
| 613 | break; | |
| 614 | ||
| 615 | case SILC_NOTIFY_TYPE_CMODE_CHANGE: | |
| 616 | idtype = va_arg(va, int); | |
| 617 | entry = va_arg(va, void *); | |
| 618 | mode = va_arg(va, SilcUInt32); | |
| 619 | (void)va_arg(va, char *); | |
| 620 | (void)va_arg(va, char *); | |
| 621 | (void)va_arg(va, char *); | |
| 622 | (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
|
623 | (void)va_arg(va, SilcDList); |
| 8849 | 624 | channel = va_arg(va, SilcChannelEntry); |
| 625 | ||
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
626 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
627 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
628 | if (!chat) |
| 8849 | 629 | break; |
| 630 | ||
| 631 | if (idtype == SILC_ID_CLIENT) | |
| 632 | name = ((SilcClientEntry)entry)->nickname; | |
| 633 | else if (idtype == SILC_ID_SERVER) | |
| 634 | name = ((SilcServerEntry)entry)->server_name; | |
| 635 | else | |
| 636 | name = ((SilcChannelEntry)entry)->channel_name; | |
| 637 | if (!name) | |
| 638 | break; | |
| 639 | ||
| 640 | if (mode) { | |
| 15884 | 641 | silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); |
| 8849 | 642 | g_snprintf(buf, sizeof(buf), |
| 643 | _("<I>%s</I> set channel <I>%s</I> modes to: %s"), name, | |
| 644 | channel->channel_name, buf2); | |
| 645 | } else { | |
| 646 | g_snprintf(buf, sizeof(buf), | |
| 647 | _("<I>%s</I> removed all channel <I>%s</I> modes"), name, | |
| 648 | channel->channel_name); | |
| 649 | } | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
650 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), 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
|
651 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8849 | 652 | break; |
| 653 | ||
| 654 | case SILC_NOTIFY_TYPE_CUMODE_CHANGE: | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
655 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
656 | PurpleChatUserFlags flags = PURPLE_CHAT_USER_NONE; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
657 | idtype = va_arg(va, int); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
658 | entry = va_arg(va, void *); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
659 | mode = va_arg(va, SilcUInt32); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
660 | client_entry2 = va_arg(va, SilcClientEntry); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
661 | channel = va_arg(va, SilcChannelEntry); |
| 8849 | 662 | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
663 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
664 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
665 | if (!chat) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
666 | break; |
| 8849 | 667 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
668 | if (idtype == SILC_ID_CLIENT) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
669 | name = ((SilcClientEntry)entry)->nickname; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
670 | else if (idtype == SILC_ID_SERVER) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
671 | name = ((SilcServerEntry)entry)->server_name; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
672 | else |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
673 | name = ((SilcChannelEntry)entry)->channel_name; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
674 | if (!name) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
675 | break; |
| 8849 | 676 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
677 | if (mode) { |
| 15884 | 678 | silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
679 | 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
|
680 | _("<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
|
681 | client_entry2->nickname, buf2); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
682 | if (mode & SILC_CHANNEL_UMODE_CHANFO) |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
683 | flags |= PURPLE_CHAT_USER_FOUNDER; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
684 | if (mode & SILC_CHANNEL_UMODE_CHANOP) |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
685 | flags |= PURPLE_CHAT_USER_OP; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
686 | } else { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
687 | 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
|
688 | _("<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
|
689 | client_entry2->nickname); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
690 | } |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
691 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), 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
|
692 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
693 | purple_chat_user_set_flags(purple_chat_conversation_find_user( |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
694 | chat, client_entry2->nickname), flags); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
695 | break; |
| 8849 | 696 | } |
| 697 | ||
| 698 | case SILC_NOTIFY_TYPE_MOTD: | |
| 699 | tmp = va_arg(va, char *); | |
| 700 | silc_free(sg->motd); | |
| 701 | sg->motd = silc_memdup(tmp, strlen(tmp)); | |
| 702 | break; | |
| 703 | ||
| 704 | case SILC_NOTIFY_TYPE_KICKED: | |
| 705 | client_entry = va_arg(va, SilcClientEntry); | |
| 706 | tmp = va_arg(va, char *); | |
| 707 | client_entry2 = va_arg(va, SilcClientEntry); | |
| 708 | channel = va_arg(va, SilcChannelEntry); | |
| 709 | ||
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
710 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
711 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
712 | if (!chat) |
| 8849 | 713 | break; |
| 714 | ||
| 715 | if (client_entry == conn->local_entry) { | |
| 716 | /* Remove us from channel */ | |
| 717 | g_snprintf(buf, sizeof(buf), | |
| 718 | _("You have been kicked off <I>%s</I> by <I>%s</I> (%s)"), | |
| 719 | channel->channel_name, client_entry2->nickname, | |
| 720 | tmp ? tmp : ""); | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
721 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), 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
|
722 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
723 | serv_got_chat_left(gc, purple_chat_conversation_get_id(chat)); |
| 8849 | 724 | } else { |
| 725 | /* Remove user from channel */ | |
|
12885
c0fcda07fb52
[gaim-migrate @ 15237]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12603
diff
changeset
|
726 | g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), |
| 8849 | 727 | client_entry2->nickname, tmp ? tmp : ""); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
728 | purple_chat_conversation_remove_user(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
|
729 | 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
|
730 | buf); |
| 8849 | 731 | } |
| 732 | ||
| 733 | break; | |
| 734 | ||
| 735 | case SILC_NOTIFY_TYPE_KILLED: | |
| 736 | client_entry = va_arg(va, SilcClientEntry); | |
| 737 | tmp = va_arg(va, char *); | |
| 738 | idtype = va_arg(va, int); | |
| 739 | entry = va_arg(va, SilcClientEntry); | |
| 740 | ||
| 741 | if (client_entry == conn->local_entry) { | |
| 742 | if (idtype == SILC_ID_CLIENT) { | |
| 743 | client_entry2 = (SilcClientEntry)entry; | |
| 744 | g_snprintf(buf, sizeof(buf), | |
| 745 | _("You have been killed by %s (%s)"), | |
| 746 | client_entry2->nickname, tmp ? tmp : ""); | |
| 747 | } else if (idtype == SILC_ID_SERVER) { | |
| 748 | server_entry = (SilcServerEntry)entry; | |
| 749 | g_snprintf(buf, sizeof(buf), | |
| 750 | _("You have been killed by %s (%s)"), | |
| 751 | server_entry->server_name, tmp ? tmp : ""); | |
| 752 | } else if (idtype == SILC_ID_CHANNEL) { | |
| 753 | channel = (SilcChannelEntry)entry; | |
| 754 | g_snprintf(buf, sizeof(buf), | |
| 755 | _("You have been killed by %s (%s)"), | |
| 756 | channel->channel_name, tmp ? tmp : ""); | |
| 757 | } | |
| 758 | ||
| 759 | /* Remove us from all channels */ | |
| 760 | silc_hash_table_list(client_entry->channels, &htl); | |
| 761 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
762 | chat = purple_conversations_find_chat_with_account( |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10091
diff
changeset
|
763 | chu->channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
764 | if (!chat) |
| 8849 | 765 | continue; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
766 | purple_conversation_write_message(PURPLE_CONVERSATION(chat), 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
|
767 | buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
768 | serv_got_chat_left(gc, purple_chat_conversation_get_id(chat)); |
| 8849 | 769 | } |
| 770 | silc_hash_table_list_reset(&htl); | |
| 771 | ||
| 772 | } else { | |
| 773 | if (idtype == SILC_ID_CLIENT) { | |
| 774 | client_entry2 = (SilcClientEntry)entry; | |
| 775 | g_snprintf(buf, sizeof(buf), | |
| 776 | _("Killed by %s (%s)"), | |
| 777 | client_entry2->nickname, tmp ? tmp : ""); | |
| 778 | } else if (idtype == SILC_ID_SERVER) { | |
| 779 | server_entry = (SilcServerEntry)entry; | |
| 780 | g_snprintf(buf, sizeof(buf), | |
| 781 | _("Killed by %s (%s)"), | |
| 782 | server_entry->server_name, tmp ? tmp : ""); | |
| 783 | } else if (idtype == SILC_ID_CHANNEL) { | |
| 784 | channel = (SilcChannelEntry)entry; | |
| 785 | g_snprintf(buf, sizeof(buf), | |
| 786 | _("Killed by %s (%s)"), | |
| 787 | channel->channel_name, tmp ? tmp : ""); | |
| 788 | } | |
| 789 | ||
| 790 | /* Remove user from all channels */ | |
| 791 | silc_hash_table_list(client_entry->channels, &htl); | |
| 792 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
793 | chat = purple_conversations_find_chat_with_account( |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10091
diff
changeset
|
794 | chu->channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
795 | if (!chat) |
| 8849 | 796 | continue; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
797 | purple_chat_conversation_remove_user(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
|
798 | client_entry->nickname, tmp); |
| 8849 | 799 | } |
| 800 | silc_hash_table_list_reset(&htl); | |
| 801 | } | |
| 802 | ||
| 803 | break; | |
| 804 | ||
| 805 | case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: | |
| 806 | break; | |
| 807 | ||
| 808 | 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
|
809 | (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
|
810 | list = va_arg(va, SilcDList); |
| 8849 | 811 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
812 | 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
|
813 | 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
|
814 | /* 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
|
815 | 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
|
816 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
817 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
818 | chu->channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
819 | if (!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
|
820 | continue; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
821 | purple_chat_conversation_remove_user(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
|
822 | 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
|
823 | _("Server signoff")); |
| 8849 | 824 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
825 | silc_hash_table_list_reset(&htl); |
| 8849 | 826 | } |
| 827 | break; | |
| 828 | ||
| 829 | case SILC_NOTIFY_TYPE_ERROR: | |
| 830 | { | |
| 831 | SilcStatus error = va_arg(va, int); | |
| 15884 | 832 | 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
|
833 | 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
|
834 | NULL); |
| 8849 | 835 | } |
| 836 | break; | |
| 837 | ||
| 838 | case SILC_NOTIFY_TYPE_WATCH: | |
| 839 | { | |
| 840 | SilcPublicKey public_key; | |
| 841 | unsigned char *pk; | |
| 842 | SilcUInt32 pk_len; | |
| 843 | char *fingerprint; | |
| 844 | ||
| 845 | client_entry = va_arg(va, SilcClientEntry); | |
| 846 | (void)va_arg(va, char *); | |
| 847 | mode = va_arg(va, SilcUInt32); | |
| 848 | notify = va_arg(va, int); | |
| 849 | public_key = va_arg(va, SilcPublicKey); | |
| 850 | ||
| 851 | b = NULL; | |
| 852 | if (public_key) { | |
|
27199
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
853 | GSList *buddies; |
| 8849 | 854 | const char *f; |
|
34304
faf0414a8b51
Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33899
diff
changeset
|
855 | gsize i; |
| 8849 | 856 | |
| 857 | pk = silc_pkcs_public_key_encode(public_key, &pk_len); | |
| 858 | if (!pk) | |
| 859 | break; | |
| 860 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); | |
| 861 | for (i = 0; i < strlen(fingerprint); i++) | |
| 862 | if (fingerprint[i] == ' ') | |
| 863 | fingerprint[i] = '_'; | |
| 864 | g_snprintf(buf, sizeof(buf) - 1, | |
| 865 | "%s" G_DIR_SEPARATOR_S "clientkeys" | |
| 866 | G_DIR_SEPARATOR_S "clientkey_%s.pub", | |
| 15884 | 867 | silcpurple_silcdir(), fingerprint); |
| 8849 | 868 | silc_free(fingerprint); |
| 869 | silc_free(pk); | |
| 870 | ||
| 871 | /* Find buddy by associated public key */ | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
872 | for (buddies = purple_blist_find_buddies(account, NULL); buddies; |
|
27199
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
873 | 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
|
874 | b = buddies->data; |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
875 | 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
|
876 | 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
|
877 | goto cont; |
|
ab2af9d15cba
Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <darkrain42@pidgin.im>
parents:
24946
diff
changeset
|
878 | b = NULL; |
| 8849 | 879 | } |
| 880 | } | |
| 881 | cont: | |
| 882 | if (!b) { | |
| 883 | /* Find buddy by nickname */ | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
884 | b = purple_blist_find_buddy(sg->account, client_entry->nickname); |
| 8849 | 885 | if (!b) { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17680
diff
changeset
|
886 | purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", |
| 8849 | 887 | client_entry->nickname); |
| 888 | break; | |
| 889 | } | |
| 890 | } | |
| 891 | ||
|
24946
390536329dc5
Some more PurpleBuddy::proto_data related changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24945
diff
changeset
|
892 | 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
|
893 | 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
|
894 | sizeof(client_entry->id))); |
| 8849 | 895 | if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { |
| 896 | break; | |
| 897 | } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { | |
| 898 | /* See if client was away and is now present */ | |
| 899 | if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | | |
| 900 | SILC_UMODE_BUSY | SILC_UMODE_PAGE | | |
| 901 | SILC_UMODE_DETACHED)) && | |
| 902 | (client_entry->mode & SILC_UMODE_GONE || | |
| 903 | client_entry->mode & SILC_UMODE_INDISPOSED || | |
| 904 | client_entry->mode & SILC_UMODE_BUSY || | |
| 905 | client_entry->mode & SILC_UMODE_PAGE || | |
| 906 | client_entry->mode & SILC_UMODE_DETACHED)) { | |
| 907 | client_entry->mode = mode; | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
908 | purple_protocol_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); |
| 8849 | 909 | } |
| 910 | else if ((mode & SILC_UMODE_GONE) || | |
| 911 | (mode & SILC_UMODE_INDISPOSED) || | |
| 912 | (mode & SILC_UMODE_BUSY) || | |
| 913 | (mode & SILC_UMODE_PAGE) || | |
| 914 | (mode & SILC_UMODE_DETACHED)) { | |
| 915 | client_entry->mode = mode; | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
916 | purple_protocol_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); |
| 8849 | 917 | } |
| 918 | } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || | |
| 919 | notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || | |
| 920 | notify == SILC_NOTIFY_TYPE_KILLED) { | |
| 921 | client_entry->mode = mode; | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
922 | purple_protocol_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); |
| 8849 | 923 | } else if (notify == SILC_NOTIFY_TYPE_NONE) { |
| 924 | client_entry->mode = mode; | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
925 | purple_protocol_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); |
| 8849 | 926 | } |
| 927 | } | |
| 928 | break; | |
| 929 | ||
| 930 | default: | |
| 15884 | 931 | purple_debug_info("silc", "Unhandled notification: %d\n", type); |
| 8849 | 932 | break; |
| 933 | } | |
| 934 | ||
| 935 | va_end(va); | |
| 936 | } | |
| 937 | ||
| 938 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
939 | /* 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
|
940 | 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
|
941 | 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
|
942 | 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
|
943 | 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
|
944 | 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
|
945 | 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
|
946 | 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
|
947 | command was processed. */ |
| 8849 | 948 | |
| 949 | static void | |
| 950 | 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
|
951 | 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
|
952 | SilcUInt32 argc, unsigned char **argv) |
| 8849 | 953 | { |
| 15884 | 954 | 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
|
955 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 956 | |
| 957 | switch (command) { | |
| 958 | ||
| 959 | 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
|
960 | if (argc == 3 && !strcmp((char *)argv[2], "+C")) |
| 8849 | 961 | sg->chpk = TRUE; |
| 962 | else | |
| 963 | sg->chpk = FALSE; | |
| 964 | break; | |
| 965 | ||
| 966 | default: | |
| 967 | break; | |
| 968 | } | |
| 969 | } | |
| 970 | ||
| 9024 | 971 | #if 0 |
| 8849 | 972 | static void |
| 15884 | 973 | silcpurple_whois_more(SilcClientEntry client_entry, gint id) |
| 8849 | 974 | { |
| 975 | SilcAttributePayload attr; | |
| 976 | SilcAttribute attribute; | |
| 977 | GString *s; | |
| 978 | SilcVCardStruct vcard; | |
| 979 | int i; | |
| 980 | ||
| 981 | if (id != 0) | |
| 982 | return; | |
| 983 | ||
| 984 | memset(&vcard, 0, sizeof(vcard)); | |
| 985 | ||
| 986 | s = g_string_new(""); | |
| 987 | ||
| 988 | silc_dlist_start(client_entry->attrs); | |
| 989 | while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { | |
| 990 | attribute = silc_attribute_get_attribute(attr); | |
| 991 | switch (attribute) { | |
| 992 | ||
| 993 | case SILC_ATTRIBUTE_USER_INFO: | |
| 994 | if (!silc_attribute_get_object(attr, (void *)&vcard, | |
| 995 | sizeof(vcard))) | |
| 996 | continue; | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
997 | g_string_append_printf(s, "%s:\n\n", _("Personal Information")); |
| 8849 | 998 | if (vcard.full_name) |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
999 | 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
|
1000 | _("Full Name"), |
| 8849 | 1001 | vcard.full_name); |
| 1002 | if (vcard.first_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%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1004 | _("First Name"), |
| 8849 | 1005 | vcard.first_name); |
| 1006 | if (vcard.middle_names) | |
|
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 | _("Middle Name"), |
| 8849 | 1009 | vcard.middle_names); |
| 1010 | if (vcard.family_name) | |
|
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 | _("Family Name"), |
| 8849 | 1013 | vcard.family_name); |
| 1014 | if (vcard.nickname) | |
|
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\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1016 | _("Nickname"), |
| 8849 | 1017 | vcard.nickname); |
| 1018 | if (vcard.bday) | |
|
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 | _("Birth Day"), |
| 8849 | 1021 | vcard.bday); |
| 1022 | if (vcard.title) | |
|
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 | _("Job Title"), |
| 8849 | 1025 | vcard.title); |
| 1026 | if (vcard.role) | |
|
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 Role"), |
| 8849 | 1029 | vcard.role); |
| 1030 | if (vcard.org_name) | |
|
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%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1032 | _("Organization"), |
| 8849 | 1033 | vcard.org_name); |
| 1034 | if (vcard.org_unit) | |
|
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\t%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1036 | _("Unit"), |
| 8849 | 1037 | vcard.org_unit); |
| 1038 | if (vcard.url) | |
|
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%s\n", |
|
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1040 | _("Homepage"), |
| 8849 | 1041 | vcard.url); |
| 1042 | if (vcard.label) | |
|
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 | _("Address"), |
| 8849 | 1045 | vcard.label); |
| 1046 | for (i = 0; i < vcard.num_tels; i++) { | |
| 1047 | if (vcard.tels[i].telnum) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1048 | 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
|
1049 | _("Phone"), |
| 8849 | 1050 | vcard.tels[i].telnum); |
| 1051 | } | |
| 1052 | for (i = 0; i < vcard.num_emails; i++) { | |
| 1053 | if (vcard.emails[i].address) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1054 | 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
|
1055 | _("Email"), |
| 8849 | 1056 | vcard.emails[i].address); |
| 1057 | } | |
| 1058 | if (vcard.note) | |
|
9039
2fb80b14dd95
[gaim-migrate @ 9815]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
9024
diff
changeset
|
1059 | 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
|
1060 | _("Note"), |
| 8849 | 1061 | vcard.note); |
| 1062 | break; | |
| 1063 | } | |
| 1064 | } | |
| 1065 | ||
| 15884 | 1066 | 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
|
1067 | s->str); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22600
diff
changeset
|
1068 | g_string_free(s, TRUE); |
| 8849 | 1069 | } |
| 9024 | 1070 | #endif |
| 8849 | 1071 | |
| 1072 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1073 | /* 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
|
1074 | 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
|
1075 | 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
|
1076 | 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
|
1077 | 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
|
1078 | 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
|
1079 | (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
|
1080 | 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
|
1081 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1082 | 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
|
1083 | 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
|
1084 | arguments. */ |
| 8849 | 1085 | |
| 1086 | static void | |
| 1087 | 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
|
1088 | 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
|
1089 | SilcStatus error, va_list ap) |
| 8849 | 1090 | { |
| 15884 | 1091 | 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
|
1092 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1093 | PurpleChatConversation *chat; |
| 8849 | 1094 | |
| 1095 | switch (command) { | |
| 1096 | case SILC_COMMAND_JOIN: | |
| 1097 | { | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1098 | SilcChannelEntry channel; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1099 | PurpleChatConversation *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
|
1100 | 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
|
1101 | 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
|
1102 | 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
|
1103 | char tmp[256], *topic; |
| 8849 | 1104 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1105 | if (status != SILC_STATUS_OK) { |
| 15884 | 1106 | 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
|
1107 | silc_get_status_message(error)); |
| 8849 | 1108 | return; |
| 1109 | } | |
| 1110 | ||
|
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 | (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
|
1112 | 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
|
1113 | (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
|
1114 | 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
|
1115 | 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
|
1116 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1117 | /* 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
|
1118 | 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
|
1119 | serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1120 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1121 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1122 | if (!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
|
1123 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1124 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1125 | /* 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
|
1126 | while (silc_hash_table_get(user_list, NULL, (void *)&chu)) { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
1127 | PurpleChatUserFlags f = PURPLE_CHAT_USER_NONE; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1128 | 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
|
1129 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1130 | if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
1131 | f |= PURPLE_CHAT_USER_FOUNDER; |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1132 | if (chu->mode & SILC_CHANNEL_UMODE_CHANOP) |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34653
diff
changeset
|
1133 | f |= PURPLE_CHAT_USER_OP; |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
22600
diff
changeset
|
1134 | 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
|
1135 | flags = g_list_append(flags, GINT_TO_POINTER(f)); |
| 8849 | 1136 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1137 | 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
|
1138 | 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
|
1139 | 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
|
1140 | _("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
|
1141 | 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
|
1142 | else |
|
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 | _("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
|
1145 | 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
|
1146 | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1147 | purple_conversation_write(PURPLE_CONVERSATION(chat), NULL, 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
|
1148 | 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
|
1149 | } |
|
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 | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1152 | purple_chat_conversation_add_users(chat, users, NULL, flags, FALSE); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1153 | 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
|
1154 | 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
|
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 | /* 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
|
1157 | if (topic) |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1158 | purple_chat_conversation_set_topic(chat, NULL, 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
|
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 nick */ |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1161 | purple_chat_conversation_set_nick(chat, conn->local_entry->nickname); |
| 8849 | 1162 | } |
| 1163 | break; | |
| 1164 | ||
| 1165 | case SILC_COMMAND_LEAVE: | |
| 1166 | break; | |
| 1167 | ||
| 1168 | case SILC_COMMAND_USERS: | |
| 1169 | break; | |
| 1170 | ||
| 1171 | case SILC_COMMAND_WHOIS: | |
| 1172 | { | |
|
33896
fb896f14715b
win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
1173 | SilcUInt32 *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
|
1174 | SilcDList channels; |
| 8849 | 1175 | 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
|
1176 | char tmp[1024]; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1177 | char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; |
| 15884 | 1178 | PurpleNotifyUserInfo *user_info; |
| 8849 | 1179 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1180 | if (status != SILC_STATUS_OK) { |
| 15884 | 1181 | purple_notify_error(gc, _("User Information"), |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1182 | _("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
|
1183 | silc_get_status_message(error)); |
| 8849 | 1184 | break; |
| 1185 | } | |
| 1186 | ||
|
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 | 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
|
1188 | (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
|
1189 | (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
|
1190 | (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
|
1191 | 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
|
1192 | (void)va_arg(ap, SilcUInt32); |
|
33896
fb896f14715b
win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
1193 | (void)va_arg(ap, SilcUInt32); /* idle */ |
|
17675
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, 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
|
1195 | user_modes = va_arg(ap, SilcUInt32 *); |
| 8849 | 1196 | |
| 15884 | 1197 | 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
|
1198 | 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
|
1199 | 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
|
1200 | 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
|
1201 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1202 | 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
|
1203 | 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
|
1204 | 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
|
1205 | 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
|
1206 | 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
|
1207 | } 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
|
1208 | 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
|
1209 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1210 | if (client_entry->mode) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1211 | memset(tmp, 0, sizeof(tmp)); |
| 15884 | 1212 | 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
|
1213 | 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
|
1214 | /* 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
|
1215 | 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
|
1216 | 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
|
1217 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1218 | |
| 15884 | 1219 | 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
|
1220 | 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
|
1221 | /* 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
|
1222 | 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
|
1223 | 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
|
1224 | g_free(moodstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1225 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1226 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1227 | 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
|
1228 | 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
|
1229 | g_free(statusstr); |
|
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 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1232 | 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
|
1233 | /* 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
|
1234 | 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
|
1235 | 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
|
1236 | g_free(contactstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1237 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1238 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1239 | 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
|
1240 | /* 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
|
1241 | 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
|
1242 | 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
|
1243 | g_free(langstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1244 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1245 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1246 | 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
|
1247 | /* 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
|
1248 | 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
|
1249 | 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
|
1250 | g_free(devicestr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1251 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1252 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1253 | 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
|
1254 | /* 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
|
1255 | 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
|
1256 | 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
|
1257 | g_free(tzstr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1258 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1259 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1260 | 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
|
1261 | /* 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
|
1262 | 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
|
1263 | 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
|
1264 | g_free(geostr); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1265 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1266 | |
|
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
|
1267 | 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
|
1268 | /* 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
|
1269 | 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
|
1270 | 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
|
1271 | } |
| 8849 | 1272 | |
| 1273 | 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
|
1274 | 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
|
1275 | int i = 0; |
| 8849 | 1276 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1277 | 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
|
1278 | 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
|
1279 | 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
|
1280 | 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
|
1281 | 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
|
1282 | 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
|
1283 | 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
|
1284 | 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
|
1285 | 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
|
1286 | 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
|
1287 | silc_free(m); |
| 8849 | 1288 | } |
|
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
|
1289 | purple_notify_user_info_add_pair_plaintext(user_info, _("Currently on"), tmp); |
| 8849 | 1290 | } |
| 1291 | ||
| 1292 | if (client_entry->public_key) { | |
| 1293 | char *fingerprint, *babbleprint; | |
| 1294 | unsigned char *pk; | |
| 1295 | SilcUInt32 pk_len; | |
| 1296 | 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
|
1297 | if (pk) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1298 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1299 | 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
|
1300 | 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
|
1301 | 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
|
1302 | silc_free(fingerprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1303 | silc_free(babbleprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1304 | silc_free(pk); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1305 | } |
| 8849 | 1306 | } |
| 1307 | ||
| 1308 | #if 0 /* XXX for now, let's not show attrs here */ | |
| 1309 | if (client_entry->attrs) | |
| 15884 | 1310 | purple_request_action(gc, _("User Information"), |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1311 | _("User Information"), |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1312 | buf, 1, client_entry, 2, |
| 15884 | 1313 | _("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
|
1314 | _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); |
| 8849 | 1315 | 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
|
1316 | #endif /* 0 */ |
| 15884 | 1317 | purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); |
| 1318 | purple_notify_user_info_destroy(user_info); | |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1319 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1320 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1321 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1322 | case SILC_COMMAND_WHOWAS: |
|
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 | 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
|
1325 | char *nickname, *realname, *username; |
| 15884 | 1326 | PurpleNotifyUserInfo *user_info; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1327 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1328 | if (status != SILC_STATUS_OK) { |
| 15884 | 1329 | purple_notify_error(gc, _("User Information"), |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1330 | _("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
|
1331 | silc_get_status_message(error)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1332 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1333 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1334 | |
|
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 | 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
|
1336 | 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
|
1337 | 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
|
1338 | realname = va_arg(ap, char *); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1339 | if (!nickname) |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1340 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1341 | |
| 15884 | 1342 | 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
|
1343 | 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
|
1344 | 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
|
1345 | 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
|
1346 | 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
|
1347 | 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
|
1348 | 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
|
1349 | 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
|
1350 | 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
|
1351 | g_free(tmp); |
|
15218
179fb04fbc87
[gaim-migrate @ 17942]
Mark Doliner <markdoliner@pidgin.im>
parents:
14749
diff
changeset
|
1352 | } 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
|
1353 | 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
|
1354 | } |
|
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
|
1355 | 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
|
1356 | /* 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
|
1357 | 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
|
1358 | 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
|
1359 | } |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1360 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1361 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1362 | if (client_entry && client_entry->public_key) { |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1363 | char *fingerprint, *babbleprint; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1364 | unsigned char *pk; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1365 | SilcUInt32 pk_len; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1366 | 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
|
1367 | if (pk) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1368 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1369 | 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
|
1370 | 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
|
1371 | 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
|
1372 | silc_free(fingerprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1373 | silc_free(babbleprint); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1374 | silc_free(pk); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
1375 | } |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1376 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1377 | |
| 15884 | 1378 | purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); |
| 1379 | purple_notify_user_info_destroy(user_info); | |
| 8849 | 1380 | } |
| 1381 | break; | |
| 1382 | ||
| 1383 | 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
|
1384 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1385 | 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
|
1386 | 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
|
1387 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1388 | 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
|
1389 | 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
|
1390 | 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
|
1391 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1392 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1393 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1394 | 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
|
1395 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1396 | /* 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
|
1397 | 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
|
1398 | 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
|
1399 | 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
|
1400 | silc_buffer_len(detach_data)); |
| 8849 | 1401 | } |
| 1402 | break; | |
| 1403 | ||
| 1404 | case SILC_COMMAND_TOPIC: | |
| 1405 | { | |
| 1406 | SilcChannelEntry channel; | |
| 1407 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1408 | if (status != SILC_STATUS_OK) { |
| 15884 | 1409 | 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
|
1410 | silc_get_status_message(error)); |
| 8849 | 1411 | return; |
| 1412 | } | |
| 1413 | ||
|
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 | channel = va_arg(ap, SilcChannelEntry); |
| 8849 | 1415 | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1416 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1417 | channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1418 | if (!chat) { |
| 15884 | 1419 | 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
|
1420 | channel->channel_name); |
| 8849 | 1421 | break; |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1422 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1423 | |
| 8849 | 1424 | /* Set topic */ |
| 1425 | if (channel->topic) | |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1426 | purple_chat_conversation_set_topic(chat, NULL, channel->topic); |
| 8849 | 1427 | } |
| 1428 | break; | |
| 1429 | ||
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1430 | case SILC_COMMAND_NICK: |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1431 | { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1432 | SilcClientEntry local_entry; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1433 | SilcHashTableList htl; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1434 | 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
|
1435 | const char *oldnick, *newnick; |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1436 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1437 | if (status != SILC_STATUS_OK) { |
| 15884 | 1438 | 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
|
1439 | silc_get_status_message(error)); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1440 | return; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1441 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1442 | |
|
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 | 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
|
1444 | newnick = va_arg(ap, char *); |
|
9353
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 | /* Change nick on all channels */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1447 | silc_hash_table_list(local_entry->channels, &htl); |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1448 | while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1449 | chat = purple_conversations_find_chat_with_account( |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1450 | chu->channel->channel_name, sg->account); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1451 | if (!chat) |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1452 | continue; |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1453 | oldnick = purple_chat_conversation_get_nick(chat); |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1454 | if (strcmp(oldnick, |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1455 | purple_normalize(purple_conversation_get_account |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1456 | (PURPLE_CONVERSATION(chat)), newnick))) { |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1457 | |
|
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1458 | purple_chat_conversation_rename_user(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
|
1459 | oldnick, newnick); |
|
34897
a323e8b5a090
Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
1460 | purple_chat_conversation_set_nick(chat, newnick); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1461 | } |
|
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 | silc_hash_table_list_reset(&htl); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1464 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1465 | purple_connection_set_display_name(gc, newnick); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1466 | } |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1467 | break; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1468 | |
| 8849 | 1469 | case SILC_COMMAND_LIST: |
| 1470 | { | |
| 1471 | char *topic, *name; | |
| 1472 | int usercount; | |
| 15884 | 1473 | PurpleRoomlistRoom *room; |
| 8849 | 1474 | |
|
30708
535bec1e66fb
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28981
diff
changeset
|
1475 | if (sg->roomlist_cancelled) |
| 8849 | 1476 | break; |
| 1477 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1478 | if (error != SILC_STATUS_OK) { |
| 15884 | 1479 | 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
|
1480 | silc_get_status_message(error)); |
| 15884 | 1481 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34897
diff
changeset
|
1482 | g_object_unref(sg->roomlist); |
| 8849 | 1483 | sg->roomlist = NULL; |
| 1484 | return; | |
| 1485 | } | |
| 1486 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1487 | (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
|
1488 | name = va_arg(ap, char *); |
|
10855
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1489 | if (!name) { |
| 15884 | 1490 | 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
|
1491 | _("Network is empty")); |
| 15884 | 1492 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34897
diff
changeset
|
1493 | g_object_unref(sg->roomlist); |
|
10855
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1494 | sg->roomlist = NULL; |
|
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1495 | return; |
|
9b1613e92000
[gaim-migrate @ 12530]
Pekka Riikonen <priikone@silcnet.org>
parents:
10774
diff
changeset
|
1496 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1497 | 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
|
1498 | usercount = va_arg(ap, int); |
| 8849 | 1499 | |
| 15884 | 1500 | room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); |
| 1501 | purple_roomlist_room_add_field(sg->roomlist, room, name); | |
| 1502 | 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
|
1503 | SILC_32_TO_PTR(usercount)); |
| 15884 | 1504 | 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
|
1505 | topic ? topic : ""); |
| 15884 | 1506 | purple_roomlist_room_add(sg->roomlist, room); |
| 8849 | 1507 | |
| 1508 | if (status == SILC_STATUS_LIST_END || | |
| 1509 | status == SILC_STATUS_OK) { | |
| 15884 | 1510 | purple_roomlist_set_in_progress(sg->roomlist, FALSE); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34897
diff
changeset
|
1511 | g_object_unref(sg->roomlist); |
| 8849 | 1512 | sg->roomlist = NULL; |
| 1513 | } | |
| 1514 | } | |
| 1515 | break; | |
| 1516 | ||
| 1517 | case SILC_COMMAND_GETKEY: | |
| 1518 | { | |
| 1519 | SilcPublicKey public_key; | |
| 1520 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1521 | if (status != SILC_STATUS_OK) { |
| 15884 | 1522 | 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
|
1523 | _("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
|
1524 | silc_get_status_message(error)); |
| 8849 | 1525 | return; |
| 1526 | } | |
| 1527 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1528 | (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
|
1529 | (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
|
1530 | public_key = va_arg(ap, SilcPublicKey); |
| 8849 | 1531 | |
| 1532 | if (!public_key) | |
| 15884 | 1533 | 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
|
1534 | _("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
|
1535 | _("No public key was received")); |
| 8849 | 1536 | } |
| 1537 | break; | |
| 1538 | ||
| 1539 | case SILC_COMMAND_INFO: | |
| 1540 | { | |
| 1541 | ||
| 1542 | char *server_name; | |
| 1543 | char *server_info; | |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10751
diff
changeset
|
1544 | char tmp[256]; |
| 8849 | 1545 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1546 | if (status != SILC_STATUS_OK) { |
| 15884 | 1547 | 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
|
1548 | _("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
|
1549 | silc_get_status_message(error)); |
| 8849 | 1550 | return; |
| 1551 | } | |
| 1552 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1553 | (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
|
1554 | 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
|
1555 | server_info = va_arg(ap, char *); |
| 8849 | 1556 | |
| 1557 | if (server_name && server_info) { | |
| 1558 | g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", | |
| 1559 | server_name, server_info); | |
| 15884 | 1560 | purple_notify_info(gc, NULL, _("Server Information"), tmp); |
| 8849 | 1561 | } |
| 1562 | } | |
| 1563 | break; | |
| 1564 | ||
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1565 | case SILC_COMMAND_STATS: |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1566 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1567 | SilcClientStats *stats; |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1568 | char *msg; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1569 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1570 | if (status != SILC_STATUS_OK) { |
| 15884 | 1571 | 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
|
1572 | _("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
|
1573 | silc_get_status_message(error)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1574 | return; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1575 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1576 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1577 | stats = va_arg(ap, SilcClientStats *); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1578 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1579 | 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
|
1580 | "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
|
1581 | "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
|
1582 | "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
|
1583 | "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
|
1584 | "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
|
1585 | "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
|
1586 | "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
|
1587 | "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
|
1588 | "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
|
1589 | "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
|
1590 | "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
|
1591 | "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
|
1592 | "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
|
1593 | "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
|
1594 | 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
|
1595 | 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
|
1596 | (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
|
1597 | (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
|
1598 | (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
|
1599 | (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
|
1600 | (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
|
1601 | (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
|
1602 | (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
|
1603 | (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
|
1604 | (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
|
1605 | (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
|
1606 | (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
|
1607 | (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
|
1608 | (int)stats->router_ops); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1609 | |
| 15884 | 1610 | 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
|
1611 | _("Network Statistics"), msg); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1612 | g_free(msg); |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1613 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1614 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1615 | |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1616 | case SILC_COMMAND_PING: |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1617 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1618 | if (status != SILC_STATUS_OK) { |
| 15884 | 1619 | 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
|
1620 | silc_get_status_message(error)); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1621 | return; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1622 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1623 | |
| 15884 | 1624 | 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
|
1625 | NULL); |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1626 | } |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1627 | break; |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9359
diff
changeset
|
1628 | |
| 8849 | 1629 | 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
|
1630 | if (status != SILC_STATUS_OK) { |
| 15884 | 1631 | 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
|
1632 | _("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
|
1633 | silc_get_status_message(error)); |
| 8849 | 1634 | return; |
| 1635 | } | |
| 1636 | break; | |
| 1637 | ||
| 1638 | case SILC_COMMAND_CMODE: | |
| 1639 | { | |
| 1640 | 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
|
1641 | 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
|
1642 | SilcArgumentDecodedList e; |
| 8849 | 1643 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1644 | if (status != SILC_STATUS_OK) |
| 8849 | 1645 | return; |
| 1646 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1647 | 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
|
1648 | (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
|
1649 | (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
|
1650 | 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
|
1651 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1652 | 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
|
1653 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1654 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1655 | list = silc_dlist_init(); |
| 8849 | 1656 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1657 | 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
|
1658 | 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
|
1659 | 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
|
1660 | 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
|
1661 | 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
|
1662 | 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
|
1663 | } |
|
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 | 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
|
1666 | } |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1667 | break; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1668 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1669 | 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
|
1670 | 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
|
1671 | 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
|
1672 | 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
|
1673 | return; |
| 8849 | 1674 | } |
| 1675 | break; | |
| 1676 | ||
| 1677 | 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
|
1678 | if (status == SILC_STATUS_OK) |
| 15884 | 1679 | purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9272
diff
changeset
|
1680 | else |
| 15884 | 1681 | 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
|
1682 | silc_get_status_message(error)); |
| 8849 | 1683 | break; |
| 1684 | } | |
| 1685 | } | |
| 1686 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1687 | /* 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
|
1688 | calls the default command_reply client operation callback */ |
| 8849 | 1689 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1690 | 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
|
1691 | 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
|
1692 | SilcStatus error, void *context, va_list ap) |
| 8849 | 1693 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1694 | 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
|
1695 | return TRUE; |
| 8849 | 1696 | } |
| 1697 | ||
| 1698 | ||
| 1699 | 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
|
1700 | union { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1701 | 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
|
1702 | 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
|
1703 | } u; |
| 8849 | 1704 | 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
|
1705 | } *SilcPurpleAskPassphrase; |
| 8849 | 1706 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1707 | 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
|
1708 | 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
|
1709 | 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
|
1710 | { |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1711 | SilcPurpleAskPassphrase internal = context; |
| 8849 | 1712 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1713 | 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
|
1714 | 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
|
1715 | else |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1716 | 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
|
1717 | (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
|
1718 | passphrase_len, internal->context); |
| 8849 | 1719 | silc_free(internal); |
| 1720 | } | |
| 1721 | ||
| 1722 | /* 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
|
1723 | 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
|
1724 | 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
|
1725 | 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
|
1726 | 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
|
1727 | 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
|
1728 | 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
|
1729 | 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
|
1730 | 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
|
1731 | 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
|
1732 | and data. The `conn' may be NULL. */ |
| 8849 | 1733 | |
| 1734 | static void | |
| 1735 | silc_get_auth_method(SilcClient client, SilcClientConnection conn, | |
| 1736 | 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
|
1737 | SilcAuthMethod auth_method, |
| 8849 | 1738 | SilcGetAuthMeth completion, void *context) |
| 1739 | { | |
| 15884 | 1740 | 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
|
1741 | 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
|
1742 | SilcPurpleAskPassphrase internal; |
|
10751
e15f4f5927ce
[gaim-migrate @ 12354]
Mark Doliner <markdoliner@pidgin.im>
parents:
10740
diff
changeset
|
1743 | const char *password; |
| 8849 | 1744 | |
| 1745 | /* Progress */ | |
| 1746 | if (sg->resuming) | |
| 15884 | 1747 | purple_connection_update_progress(gc, _("Resuming session"), 4, 5); |
| 8849 | 1748 | else |
| 15884 | 1749 | purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); |
| 8849 | 1750 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1751 | /* 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
|
1752 | 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
|
1753 | 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
|
1754 | completion(SILC_AUTH_PUBLIC_KEY, NULL, 0, context); |
| 10336 | 1755 | return; |
| 1756 | } | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1757 | 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
|
1758 | 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
|
1759 | 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
|
1760 | 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
|
1761 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1762 | } |
|
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 | /* 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
|
1765 | 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
|
1766 | 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
|
1767 | return; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1768 | 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
|
1769 | 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
|
1770 | 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
|
1771 | internal); |
| 8849 | 1772 | return; |
| 1773 | } | |
| 1774 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1775 | completion(SILC_AUTH_NONE, NULL, 0, context); |
| 8849 | 1776 | } |
| 1777 | ||
| 1778 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1779 | /* 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
|
1780 | 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
|
1781 | 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
|
1782 | 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
|
1783 | been verified. */ |
| 8849 | 1784 | |
| 1785 | static void | |
| 1786 | 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
|
1787 | 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
|
1788 | SilcPublicKey public_key, |
| 8849 | 1789 | SilcVerifyPublicKey completion, void *context) |
| 1790 | { | |
| 15884 | 1791 | 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
|
1792 | SilcPurple sg = purple_connection_get_protocol_data(gc); |
| 8849 | 1793 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1794 | 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
|
1795 | conn_type == SILC_CONN_ROUTER)) { |
| 8849 | 1796 | /* Progress */ |
| 1797 | if (sg->resuming) | |
| 15884 | 1798 | purple_connection_update_progress(gc, _("Resuming session"), 3, 5); |
| 8849 | 1799 | else |
| 15884 | 1800 | 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
|
1801 | 3, 5); |
| 8849 | 1802 | } |
| 1803 | ||
| 1804 | /* 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
|
1805 | 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
|
1806 | public_key, completion, context); |
| 8849 | 1807 | } |
| 1808 | ||
| 1809 | static void | |
| 15884 | 1810 | silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) |
| 8849 | 1811 | { |
| 1812 | 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
|
1813 | internal->u.ask_pass(NULL, 0, internal->context); |
| 8849 | 1814 | 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
|
1815 | internal->u.ask_pass((unsigned char *)passphrase, |
| 8849 | 1816 | strlen(passphrase), internal->context); |
| 1817 | silc_free(internal); | |
| 1818 | } | |
| 1819 | ||
| 1820 | /* Ask (interact, that is) a passphrase from user. The passphrase is | |
| 1821 | returned to the library by calling the `completion' callback with | |
| 1822 | the `context'. The returned passphrase SHOULD be in UTF-8 encoded, | |
| 1823 | if not then the library will attempt to encode. */ | |
| 1824 | ||
| 1825 | static void | |
| 1826 | silc_ask_passphrase(SilcClient client, SilcClientConnection conn, | |
| 1827 | SilcAskPassphrase completion, void *context) | |
| 1828 | { | |
|
16492
4f0dc2d16e55
Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
1829 | PurpleConnection *gc = client->application; |
| 15884 | 1830 | SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); |
| 8849 | 1831 | |
| 1832 | if (!internal) | |
| 1833 | 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
|
1834 | internal->u.ask_pass = completion; |
| 8849 | 1835 | internal->context = context; |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1836 | 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
|
1837 | _("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
|
1838 | _("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
|
1839 | _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
1840 | purple_request_cpar_from_connection(gc), internal); |
| 8849 | 1841 | } |
| 1842 | ||
| 1843 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1844 | /* 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
|
1845 | 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
|
1846 | 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
|
1847 | 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
|
1848 | 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
|
1849 | 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
|
1850 | value 0 for TCP or value 1 for UDP. */ |
| 8849 | 1851 | |
| 1852 | 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
|
1853 | 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
|
1854 | 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
|
1855 | 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
|
1856 | SilcUInt16 port) |
| 8849 | 1857 | { |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16545
diff
changeset
|
1858 | 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
|
1859 | hostname, port, protocol); |
| 8849 | 1860 | } |
| 1861 | ||
| 1862 | ||
| 1863 | /* Notifies application that file transfer protocol session is being | |
| 1864 | requested by the remote client indicated by the `client_entry' from | |
| 1865 | the `hostname' and `port'. The `session_id' is the file transfer | |
| 1866 | session and it can be used to either accept or reject the file | |
| 1867 | transfer request, by calling the silc_client_file_receive or | |
| 1868 | silc_client_file_close, respectively. */ | |
| 1869 | ||
| 1870 | static void | |
| 1871 | silc_ftp(SilcClient client, SilcClientConnection conn, | |
| 1872 | SilcClientEntry client_entry, SilcUInt32 session_id, | |
| 1873 | const char *hostname, SilcUInt16 port) | |
| 1874 | { | |
| 15884 | 1875 | 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
|
1876 | hostname, port); |
| 8849 | 1877 | } |
| 1878 | ||
| 1879 | SilcClientOperations ops = { | |
| 1880 | silc_say, | |
| 1881 | silc_channel_message, | |
| 1882 | silc_private_message, | |
| 1883 | silc_notify, | |
| 1884 | silc_command, | |
| 1885 | silc_command_reply, | |
| 1886 | silc_get_auth_method, | |
| 1887 | silc_verify_public_key, | |
| 1888 | silc_ask_passphrase, | |
| 1889 | 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
|
1890 | silc_ftp |
| 8849 | 1891 | }; |