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