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