annotate libpurple/protocols/silc/ops.c @ 22463:bb7b11ca28ca

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