libpurple/protocols/silc/ops.c

Fri, 07 Aug 2015 23:56:39 -0400

author
James Geboski <jgeboski@gmail.com>
date
Fri, 07 Aug 2015 23:56:39 -0400
branch
facebook
changeset 37325
0c4c39dbe989
parent 37158
96b5ab42da00
child 38358
30ba44276e74
permissions
-rw-r--r--

Backed out changeset 0519eee7aebf

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

mercurial