annotate libpurple/protocols/silc10/silc.c @ 23111:718a9c287839

Use up the last padding for PurplePluginProtocolInfo in a way that allows adding newer functions without causing any major version bump. This is based on the changes from the .vv branch. I changed the PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro a little so it can be used for the old as well as the new functions. Someone should confirm this looks OK.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 05 May 2008 06:19:46 +0000
parents 3d092dd95ec1
children bb41bdce8981
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1 /*
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
2
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
3 silcpurple.c
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
4
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
5 Author: Pekka Riikonen <priikone@silcnet.org>
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
6
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
7 Copyright (C) 2004 - 2005 Pekka Riikonen
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
8
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
11 the Free Software Foundation; version 2 of the License.
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
12
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
16 GNU General Public License for more details.
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
17
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
18 */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
19
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
20 #include "silcincludes.h"
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
21 #include "silcclient.h"
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
22 #include "silcpurple.h"
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
23 #include "version.h"
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
24 #include "wb.h"
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
25
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
26 extern SilcClientOperations ops;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
27 static PurplePlugin *silc_plugin = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
28
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
29 static const char *
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
30 silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
31 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
32 return (const char *)"silc";
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
33 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
34
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
35 static GList *
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
36 silcpurple_away_states(PurpleAccount *account)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
37 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
38 PurpleStatusType *type;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
39 GList *types = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
40
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
41 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, FALSE, TRUE, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
42 types = g_list_append(types, type);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
43 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), FALSE, TRUE, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
44 types = g_list_append(types, type);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
45 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, FALSE, TRUE, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
46 types = g_list_append(types, type);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
47 type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), FALSE, TRUE, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
48 types = g_list_append(types, type);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
49 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), FALSE, TRUE, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
50 types = g_list_append(types, type);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
51 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), FALSE, TRUE, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
52 types = g_list_append(types, type);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
53 type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, FALSE, TRUE, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
54 types = g_list_append(types, type);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
55
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
56 return types;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
57 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
58
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
59 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
60 silcpurple_set_status(PurpleAccount *account, PurpleStatus *status)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
61 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
62 PurpleConnection *gc = purple_account_get_connection(account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
63 SilcPurple sg = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
64 SilcUInt32 mode;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
65 SilcBuffer idp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
66 unsigned char mb[4];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
67 const char *state;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
68
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
69 if (gc != NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
70 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
71
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
72 if (status == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
73 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
74
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
75 state = purple_status_get_id(status);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
76
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
77 if (state == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
78 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
79
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
80 if ((sg == NULL) || (sg->conn == NULL))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
81 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
82
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
83 mode = sg->conn->local_entry->mode;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
84 mode &= ~(SILC_UMODE_GONE |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
85 SILC_UMODE_HYPER |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
86 SILC_UMODE_BUSY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
87 SILC_UMODE_INDISPOSED |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
88 SILC_UMODE_PAGE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
89
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
90 if (!strcmp(state, "hyper"))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
91 mode |= SILC_UMODE_HYPER;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
92 else if (!strcmp(state, "away"))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
93 mode |= SILC_UMODE_GONE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
94 else if (!strcmp(state, "busy"))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
95 mode |= SILC_UMODE_BUSY;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
96 else if (!strcmp(state, "indisposed"))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
97 mode |= SILC_UMODE_INDISPOSED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
98 else if (!strcmp(state, "page"))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
99 mode |= SILC_UMODE_PAGE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
100
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
101 /* Send UMODE */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
102 idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
103 SILC_PUT32_MSB(mode, mb);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
104 silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
105 ++sg->conn->cmd_ident, 2,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
106 1, idp->data, idp->len,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
107 2, mb, sizeof(mb));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
108 silc_buffer_free(idp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
109 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
110
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
111
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
112 /*************************** Connection Routines *****************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
113
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
114 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
115 silcpurple_keepalive(PurpleConnection *gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
116 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
117 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
118 silc_client_send_packet(sg->client, sg->conn, SILC_PACKET_HEARTBEAT,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
119 NULL, 0);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
120 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
121
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
122 static gboolean
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
123 silcpurple_scheduler(gpointer *context)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
124 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
125 SilcPurple sg = (SilcPurple)context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
126 silc_client_run_one(sg->client);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
127 return TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
128 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
129
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
130 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
131 silcpurple_nickname_parse(const char *nickname,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
132 char **ret_nickname)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
133 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
134 silc_parse_userfqdn(nickname, ret_nickname, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
135 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
136
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
137 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
138 silcpurple_login_connected(gpointer data, gint source, const gchar *error_message)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
139 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
140 PurpleConnection *gc = data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
141 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
142 SilcClient client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
143 SilcClientConnection conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
144 PurpleAccount *account;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
145 SilcClientConnectionParams params;
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
146 SilcUInt32 mask;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
147 const char *dfile, *tmp;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
148 #ifdef SILC_ATTRIBUTE_USER_ICON
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
149 PurpleStoredImage *img;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
150 #endif
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
151 #ifdef HAVE_SYS_UTSNAME_H
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
152 struct utsname u;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
153 #endif
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
154
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
155
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
156 g_return_if_fail(gc != NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
157
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
158 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
159
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
160 if (source < 0) {
22235
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
161 purple_connection_error_reason(gc,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
162 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
163 _("Connection failed"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
164 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
165 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
166
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
167 client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
168 account = sg->account;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
169
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
170 /* Get session detachment data, if available */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
171 memset(&params, 0, sizeof(params));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
172 dfile = silcpurple_session_file(purple_account_get_username(sg->account));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
173 params.detach_data = (unsigned char *)silc_file_readfile(dfile, &params.detach_data_len);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
174 if (params.detach_data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
175 params.detach_data[params.detach_data_len] = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
176
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
177 /* Add connection to SILC client library */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
178 conn = silc_client_add_connection(
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
179 sg->client, &params,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
180 (char *)purple_account_get_string(account, "server",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
181 "silc.silcnet.org"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
182 purple_account_get_int(account, "port", 706), sg);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
183 if (!conn) {
22235
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
184 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
185 _("Cannot initialize SILC Client connection"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
186 gc->proto_data = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
187 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
188 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
189 sg->conn = conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
190
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
191 /* Progress */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
192 if (params.detach_data) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
193 purple_connection_update_progress(gc, _("Resuming session"), 2, 5);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
194 sg->resuming = TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
195 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
196 purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
197 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
198
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
199 /* Perform SILC Key Exchange. The "silc_connected" will be called
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
200 eventually. */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
201 silc_client_start_key_exchange(sg->client, sg->conn, source);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
202
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
203 /* Set default attributes */
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
204 mask = SILC_ATTRIBUTE_MOOD_NORMAL;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
205 silc_client_attribute_add(client, conn,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
206 SILC_ATTRIBUTE_STATUS_MOOD,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
207 SILC_32_TO_PTR(mask),
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
208 sizeof(SilcUInt32));
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
209 mask = SILC_ATTRIBUTE_CONTACT_CHAT;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
210 silc_client_attribute_add(client, conn,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
211 SILC_ATTRIBUTE_PREFERRED_CONTACT,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
212 SILC_32_TO_PTR(mask),
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
213 sizeof(SilcUInt32));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
214 #ifdef HAVE_SYS_UTSNAME_H
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
215 if (!uname(&u)) {
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
216 SilcAttributeObjDevice dev;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
217 memset(&dev, 0, sizeof(dev));
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
218 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
219 dev.version = u.release;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
220 dev.model = u.sysname;
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
221 silc_client_attribute_add(client, conn,
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
222 SILC_ATTRIBUTE_DEVICE_INFO,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
223 (void *)&dev, sizeof(dev));
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
224 }
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
225 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
226 #ifdef _WIN32
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
227 tmp = _tzname[0];
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
228 #else
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
229 tmp = tzname[0];
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
230 #endif
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
231 silc_client_attribute_add(client, conn,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
232 SILC_ATTRIBUTE_TIMEZONE,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
233 (void *)tmp, strlen(tmp));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
234
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
235 #ifdef SILC_ATTRIBUTE_USER_ICON
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
236 /* Set our buddy icon */
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
237 img = purple_buddy_icons_find_account_icon(account);
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
238 silcpurple_buddy_set_icon(gc, img);
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
239 purple_imgstore_unref(img);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
240 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
241
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
242 silc_free(params.detach_data);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
243 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
244
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
245 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
246 silcpurple_login(PurpleAccount *account)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
247 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
248 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
249 SilcClient client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
250 SilcClientParams params;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
251 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
252 char pkd[256], prd[256];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
253 const char *cipher, *hmac;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
254 char *realname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
255 int i;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
256
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
257 gc = account->gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
258 if (!gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
259 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
260 gc->proto_data = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
261
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
262 memset(&params, 0, sizeof(params));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
263 strcat(params.nickname_format, "%n@%h%a");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
264 params.nickname_parse = silcpurple_nickname_parse;
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
265 params.ignore_requested_attributes = FALSE;
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
266
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
267 /* Allocate SILC client */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
268 client = silc_client_alloc(&ops, &params, gc, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
269 if (!client) {
22235
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
270 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
271 _("Out of memory"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
272 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
273 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
274
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
275 /* Get username, real name and local hostname for SILC library */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
276 if (purple_account_get_username(account)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
277 const char *u = purple_account_get_username(account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
278 char **up = g_strsplit(u, "@", 2);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
279 client->username = strdup(up[0]);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
280 g_strfreev(up);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
281 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
282 client->username = silc_get_username();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
283 purple_account_set_username(account, client->username);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
284 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
285 realname = silc_get_real_name();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
286 if (purple_account_get_user_info(account)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
287 client->realname = strdup(purple_account_get_user_info(account));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
288 free(realname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
289 } else if ((silc_get_real_name() != NULL) && (*realname != '\0')) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
290 client->realname = realname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
291 purple_account_set_user_info(account, client->realname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
292 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
293 free(realname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
294 client->realname = strdup(_("John Noname"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
295 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
296 client->hostname = silc_net_localhost();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
297
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
298 purple_connection_set_display_name(gc, client->username);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
299
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
300 /* Register requested cipher and HMAC */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
301 cipher = purple_account_get_string(account, "cipher", SILC_DEFAULT_CIPHER);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
302 for (i = 0; silc_default_ciphers[i].name; i++)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
303 if (!strcmp(silc_default_ciphers[i].name, cipher)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
304 silc_cipher_register(&(silc_default_ciphers[i]));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
305 break;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
306 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
307 hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
308 for (i = 0; silc_default_hmacs[i].name; i++)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
309 if (!strcmp(silc_default_hmacs[i].name, hmac)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
310 silc_hmac_register(&(silc_default_hmacs[i]));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
311 break;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
312 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
313
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
314 /* Init SILC client */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
315 if (!silc_client_init(client)) {
22235
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
316 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
317 _("Cannot initialize SILC protocol"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
318 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
319 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
320
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
321 /* Check the ~/.silc dir and create it, and new key pair if necessary. */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
322 if (!silcpurple_check_silc_dir(gc)) {
22235
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
323 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
324 _("Error loading SILC key pair"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
325 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
326 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
327
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
328 /* Progress */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
329 purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
330
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
331 /* Load SILC key pair */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
332 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
333 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
334 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
335 (char *)purple_account_get_string(account, "private-key", prd),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
336 (gc->password == NULL) ? "" : gc->password, &client->pkcs,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
337 &client->public_key, &client->private_key)) {
21121
35b4f1dc4c8d replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents: 18081
diff changeset
338 g_snprintf(pkd, sizeof(pkd), _("Could not load SILC key pair: %s"), g_strerror(errno));
22235
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
339 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
340 _("Could not load SILC key pair"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
341 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
342 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
343
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
344 sg = silc_calloc(1, sizeof(*sg));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
345 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
346 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
347 memset(sg, 0, sizeof(*sg));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
348 sg->client = client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
349 sg->gc = gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
350 sg->account = account;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
351 gc->proto_data = sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
352
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
353 /* Connect to the SILC server */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
354 if (purple_proxy_connect(gc, account,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
355 purple_account_get_string(account, "server",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
356 "silc.silcnet.org"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
357 purple_account_get_int(account, "port", 706),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
358 silcpurple_login_connected, gc) == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
359 {
22235
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
360 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
4446de418df1 Update silc10 to use purple_connection_error_reason(), matching the uses in
Will Thompson <will.thompson@collabora.co.uk>
parents: 21560
diff changeset
361 _("Unable to create connection"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
362 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
363 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
364
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
365 /* Schedule SILC using Glib's event loop */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
366 sg->scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, sg);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
367 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
368
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
369 static int
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
370 silcpurple_close_final(gpointer *context)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
371 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
372 SilcPurple sg = (SilcPurple)context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
373 silc_client_stop(sg->client);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
374 silc_client_free(sg->client);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
375 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
376 if (sg->mimeass)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
377 silc_mime_assembler_free(sg->mimeass);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
378 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
379 silc_free(sg);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
380 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
381 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
382
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
383 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
384 silcpurple_close(PurpleConnection *gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
385 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
386 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
387
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
388 g_return_if_fail(sg != NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
389
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
390 /* Send QUIT */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
391 silc_client_command_call(sg->client, sg->conn, NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
392 "QUIT", "Download this: " PURPLE_WEBSITE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
393
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
394 if (sg->conn)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
395 silc_client_close_connection(sg->client, sg->conn);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
396
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
397 purple_timeout_remove(sg->scheduler);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
398 purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
399 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
400
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
401
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
402 /****************************** Protocol Actions *****************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
403
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
404 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
405 silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
406 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
407 /* Nothing */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
408 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
409
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
410 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
411 silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
412 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
413 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
414 SilcClient client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
415 SilcClientConnection conn = sg->conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
416 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
417 char *tmp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
418 SilcUInt32 tmp_len, mask;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
419 SilcAttributeObjService service;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
420 SilcAttributeObjDevice dev;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
421 SilcVCardStruct vcard;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
422 const char *val;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
423
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
424 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
425 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
426 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
427
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
428 memset(&service, 0, sizeof(service));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
429 memset(&dev, 0, sizeof(dev));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
430 memset(&vcard, 0, sizeof(vcard));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
431
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
432 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
433 SILC_ATTRIBUTE_USER_INFO, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
434 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
435 SILC_ATTRIBUTE_SERVICE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
436 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
437 SILC_ATTRIBUTE_STATUS_MOOD, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
438 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
439 SILC_ATTRIBUTE_STATUS_FREETEXT, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
440 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
441 SILC_ATTRIBUTE_STATUS_MESSAGE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
442 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
443 SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
444 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
445 SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
446 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
447 SILC_ATTRIBUTE_TIMEZONE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
448 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
449 SILC_ATTRIBUTE_GEOLOCATION, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
450 silc_client_attribute_del(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
451 SILC_ATTRIBUTE_DEVICE_INFO, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
452
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
453 /* Set mood */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
454 mask = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
455 f = purple_request_fields_get_field(fields, "mood_normal");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
456 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
457 mask |= SILC_ATTRIBUTE_MOOD_NORMAL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
458 f = purple_request_fields_get_field(fields, "mood_happy");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
459 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
460 mask |= SILC_ATTRIBUTE_MOOD_HAPPY;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
461 f = purple_request_fields_get_field(fields, "mood_sad");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
462 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
463 mask |= SILC_ATTRIBUTE_MOOD_SAD;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
464 f = purple_request_fields_get_field(fields, "mood_angry");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
465 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
466 mask |= SILC_ATTRIBUTE_MOOD_ANGRY;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
467 f = purple_request_fields_get_field(fields, "mood_jealous");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
468 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
469 mask |= SILC_ATTRIBUTE_MOOD_JEALOUS;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
470 f = purple_request_fields_get_field(fields, "mood_ashamed");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
471 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
472 mask |= SILC_ATTRIBUTE_MOOD_ASHAMED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
473 f = purple_request_fields_get_field(fields, "mood_invincible");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
474 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
475 mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
476 f = purple_request_fields_get_field(fields, "mood_inlove");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
477 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
478 mask |= SILC_ATTRIBUTE_MOOD_INLOVE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
479 f = purple_request_fields_get_field(fields, "mood_sleepy");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
480 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
481 mask |= SILC_ATTRIBUTE_MOOD_SLEEPY;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
482 f = purple_request_fields_get_field(fields, "mood_bored");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
483 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
484 mask |= SILC_ATTRIBUTE_MOOD_BORED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
485 f = purple_request_fields_get_field(fields, "mood_excited");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
486 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
487 mask |= SILC_ATTRIBUTE_MOOD_EXCITED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
488 f = purple_request_fields_get_field(fields, "mood_anxious");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
489 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
490 mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
491 silc_client_attribute_add(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
492 SILC_ATTRIBUTE_STATUS_MOOD,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
493 SILC_32_TO_PTR(mask),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
494 sizeof(SilcUInt32));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
495
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
496 /* Set preferred contact */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
497 mask = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
498 f = purple_request_fields_get_field(fields, "contact_chat");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
499 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
500 mask |= SILC_ATTRIBUTE_CONTACT_CHAT;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
501 f = purple_request_fields_get_field(fields, "contact_email");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
502 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
503 mask |= SILC_ATTRIBUTE_CONTACT_EMAIL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
504 f = purple_request_fields_get_field(fields, "contact_call");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
505 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
506 mask |= SILC_ATTRIBUTE_CONTACT_CALL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
507 f = purple_request_fields_get_field(fields, "contact_sms");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
508 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
509 mask |= SILC_ATTRIBUTE_CONTACT_SMS;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
510 f = purple_request_fields_get_field(fields, "contact_mms");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
511 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
512 mask |= SILC_ATTRIBUTE_CONTACT_MMS;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
513 f = purple_request_fields_get_field(fields, "contact_video");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
514 if (f && purple_request_field_bool_get_value(f))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
515 mask |= SILC_ATTRIBUTE_CONTACT_VIDEO;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
516 if (mask)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
517 silc_client_attribute_add(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
518 SILC_ATTRIBUTE_PREFERRED_CONTACT,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
519 SILC_32_TO_PTR(mask),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
520 sizeof(SilcUInt32));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
521
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
522 /* Set status text */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
523 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
524 f = purple_request_fields_get_field(fields, "status_text");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
525 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
526 val = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
527 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
528 silc_client_attribute_add(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
529 SILC_ATTRIBUTE_STATUS_FREETEXT,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
530 (void *)val, strlen(val));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
531
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
532 /* Set vcard */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
533 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
534 f = purple_request_fields_get_field(fields, "vcard");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
535 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
536 val = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
537 if (val && *val) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
538 purple_account_set_string(sg->account, "vcard", val);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
539 tmp = silc_file_readfile(val, &tmp_len);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
540 if (tmp) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
541 tmp[tmp_len] = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
542 if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
543 silc_client_attribute_add(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
544 SILC_ATTRIBUTE_USER_INFO,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
545 (void *)&vcard,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
546 sizeof(vcard));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
547 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
548 silc_vcard_free(&vcard);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
549 silc_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
550 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
551 purple_account_set_string(sg->account, "vcard", "");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
552 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
553
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
554 #ifdef HAVE_SYS_UTSNAME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
555 /* Set device info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
556 f = purple_request_fields_get_field(fields, "device");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
557 if (f && purple_request_field_bool_get_value(f)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
558 struct utsname u;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
559 if (!uname(&u)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
560 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
561 dev.version = u.release;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
562 dev.model = u.sysname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
563 silc_client_attribute_add(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
564 SILC_ATTRIBUTE_DEVICE_INFO,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
565 (void *)&dev, sizeof(dev));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
566 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
567 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
568 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
569
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
570 /* Set timezone */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
571 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
572 f = purple_request_fields_get_field(fields, "timezone");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
573 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
574 val = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
575 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
576 silc_client_attribute_add(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
577 SILC_ATTRIBUTE_TIMEZONE,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
578 (void *)val, strlen(val));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
579 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
580
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
581 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
582 silcpurple_attrs(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
583 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
584 PurpleConnection *gc = (PurpleConnection *) action->context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
585 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
586 SilcClient client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
587 SilcClientConnection conn = sg->conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
588 PurpleRequestFields *fields;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
589 PurpleRequestFieldGroup *g;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
590 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
591 SilcHashTable attrs;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
592 SilcAttributePayload attr;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
593 gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
594 mangry = FALSE, mjealous = FALSE, mashamed = FALSE,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
595 minvincible = FALSE, minlove = FALSE, msleepy = FALSE,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
596 mbored = FALSE, mexcited = FALSE, manxious = FALSE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
597 gboolean cemail = FALSE, ccall = FALSE, csms = FALSE,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
598 cmms = FALSE, cchat = TRUE, cvideo = FALSE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
599 gboolean device = TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
600 char status[1024];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
601
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
602 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
603 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
604 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
605
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
606 memset(status, 0, sizeof(status));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
607
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
608 attrs = silc_client_attributes_get(client, conn);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
609 if (attrs) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
610 if (silc_hash_table_find(attrs,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
611 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
612 NULL, (void *)&attr)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
613 SilcUInt32 mood = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
614 silc_attribute_get_object(attr, &mood, sizeof(mood));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
615 mnormal = !mood;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
616 mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
617 msad = (mood & SILC_ATTRIBUTE_MOOD_SAD);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
618 mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
619 mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
620 mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
621 minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
622 minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
623 msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
624 mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
625 mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
626 manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
627 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
628
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
629 if (silc_hash_table_find(attrs,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
630 SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
631 NULL, (void *)&attr)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
632 SilcUInt32 contact = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
633 silc_attribute_get_object(attr, &contact, sizeof(contact));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
634 cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
635 ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
636 csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
637 cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
638 cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
639 cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
640 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
641
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
642 if (silc_hash_table_find(attrs,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
643 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
644 NULL, (void *)&attr))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
645 silc_attribute_get_object(attr, &status, sizeof(status));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
646
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
647 if (!silc_hash_table_find(attrs,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
648 SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
649 NULL, (void *)&attr))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
650 device = FALSE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
651 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
652
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
653 fields = purple_request_fields_new();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
654
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
655 g = purple_request_field_group_new(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
656 f = purple_request_field_label_new("l3", _("Your Current Mood"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
657 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
658 f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
659 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
660 f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
661 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
662 f = purple_request_field_bool_new("mood_sad", _("Sad"), msad);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
663 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
664 f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
665 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
666 f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
667 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
668 f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
669 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
670 f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
671 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
672 f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
673 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
674 f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
675 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
676 f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
677 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
678 f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
679 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
680 f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
681 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
682
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
683 f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
684 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
685 f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
686 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
687 f = purple_request_field_bool_new("contact_email", _("E-mail"), cemail);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
688 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
689 f = purple_request_field_bool_new("contact_call", _("Phone"), ccall);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
690 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
691 f = purple_request_field_bool_new("contact_sms", _("SMS"), csms);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
692 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
693 f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
694 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
695 f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
696 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
697 purple_request_fields_add_group(fields, g);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
698
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
699 g = purple_request_field_group_new(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
700 f = purple_request_field_string_new("status_text", _("Your Current Status"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
701 status[0] ? status : NULL, TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
702 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
703 purple_request_fields_add_group(fields, g);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
704
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
705 g = purple_request_field_group_new(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
706 #if 0
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
707 f = purple_request_field_label_new("l2", _("Online Services"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
708 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
709 f = purple_request_field_bool_new("services",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
710 _("Let others see what services you are using"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
711 TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
712 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
713 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
714 #ifdef HAVE_SYS_UTSNAME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
715 f = purple_request_field_bool_new("device",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
716 _("Let others see what computer you are using"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
717 device);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
718 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
719 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
720 purple_request_fields_add_group(fields, g);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
721
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
722 g = purple_request_field_group_new(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
723 f = purple_request_field_string_new("vcard", _("Your VCard File"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
724 purple_account_get_string(sg->account, "vcard", ""),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
725 FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
726 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
727 #ifdef _WIN32
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
728 f = purple_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
729 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
730 f = purple_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
731 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
732 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
733 purple_request_fields_add_group(fields, g);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
734
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
735 purple_request_fields(gc, _("User Online Status Attributes"),
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
736 _("User Online Status Attributes"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
737 _("You can let other users see your online status information "
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
738 "and your personal information. Please fill the information "
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
739 "you would like other users to see about yourself."),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
740 fields,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
741 _("OK"), G_CALLBACK(silcpurple_attrs_cb),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
742 _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel),
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
743 gc->account, NULL, NULL, gc);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
744 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
745
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
746 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
747 silcpurple_detach(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
748 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
749 PurpleConnection *gc = (PurpleConnection *) action->context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
750 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
751
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
752 if (!gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
753 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
754 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
755 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
756 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
757
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
758 /* Call DETACH */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
759 silc_client_command_call(sg->client, sg->conn, "DETACH");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
760 sg->detaching = TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
761 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
762
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
763 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
764 silcpurple_view_motd(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
765 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
766 PurpleConnection *gc = (PurpleConnection *) action->context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
767 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
768 char *tmp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
769
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
770 if (!gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
771 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
772 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
773 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
774 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
775
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
776 if (!sg->motd) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
777 purple_notify_error(
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
778 gc, _("Message of the Day"), _("No Message of the Day available"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
779 _("There is no Message of the Day associated with this connection"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
780 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
781 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
782
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
783 tmp = g_markup_escape_text(sg->motd, -1);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
784 purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
785 tmp, NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
786 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
787 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
788
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
789 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
790 silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
791 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
792 /* Nothing */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
793 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
794
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
795 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
796 silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
797 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
798 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
799 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
800 const char *val, *pkfile = NULL, *prfile = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
801 const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
802 const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
803 char *identifier;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
804 int keylen = SILCPURPLE_DEF_PKCS_LEN;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
805 SilcPublicKey public_key;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
806
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
807 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
808 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
809 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
810
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
811 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
812 f = purple_request_fields_get_field(fields, "pass1");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
813 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
814 val = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
815 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
816 pass1 = val;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
817 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
818 pass1 = "";
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
819 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
820 f = purple_request_fields_get_field(fields, "pass2");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
821 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
822 val = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
823 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
824 pass2 = val;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
825 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
826 pass2 = "";
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
827
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
828 if (strcmp(pass1, pass2)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
829 purple_notify_error(
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
830 gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
831 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
832 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
833
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
834 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
835 f = purple_request_fields_get_field(fields, "key");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
836 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
837 val = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
838 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
839 keylen = atoi(val);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
840 f = purple_request_fields_get_field(fields, "pkfile");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
841 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
842 pkfile = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
843 f = purple_request_fields_get_field(fields, "prfile");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
844 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
845 prfile = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
846
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
847 f = purple_request_fields_get_field(fields, "un");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
848 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
849 un = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
850 f = purple_request_fields_get_field(fields, "hn");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
851 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
852 hn = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
853 f = purple_request_fields_get_field(fields, "rn");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
854 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
855 rn = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
856 f = purple_request_fields_get_field(fields, "e");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
857 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
858 e = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
859 f = purple_request_fields_get_field(fields, "o");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
860 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
861 o = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
862 f = purple_request_fields_get_field(fields, "c");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
863 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
864 c = purple_request_field_string_get_value(f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
865
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
866 identifier = silc_pkcs_encode_identifier((char *)un, (char *)hn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
867 (char *)rn, (char *)e, (char *)o, (char *)c);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
868
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
869 /* Create the key pair */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
870 if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
871 identifier, pass1, NULL, &public_key, NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
872 FALSE)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
873 purple_notify_error(
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
874 gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
875 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
876 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
877
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
878 silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
879
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
880 silc_pkcs_public_key_free(public_key);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
881 silc_free(identifier);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
882 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
883
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
884 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
885 silcpurple_create_keypair(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
886 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
887 PurpleConnection *gc = (PurpleConnection *) action->context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
888 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
889 PurpleRequestFields *fields;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
890 PurpleRequestFieldGroup *g;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
891 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
892 const char *username, *realname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
893 char *hostname, **u;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
894 char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
895
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
896 username = purple_account_get_username(sg->account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
897 u = g_strsplit(username, "@", 2);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
898 username = u[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
899 realname = purple_account_get_user_info(sg->account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
900 hostname = silc_net_localhost();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
901 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
902
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
903 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir());
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
904 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir());
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
905 g_snprintf(pkd, sizeof(pkd) - 1, "%s",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
906 purple_account_get_string(gc->account, "public-key", pkd2));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
907 g_snprintf(prd, sizeof(prd) - 1, "%s",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
908 purple_account_get_string(gc->account, "private-key", prd2));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
909
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
910 fields = purple_request_fields_new();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
911
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
912 g = purple_request_field_group_new(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
913 f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
914 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
915 f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
916 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
917 f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
918 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
919 purple_request_fields_add_group(fields, g);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
920
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
921 g = purple_request_field_group_new(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
922 f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
923 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
924 f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
925 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
926 f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
927 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
928 f = purple_request_field_string_new("e", _("E-mail"), tmp, FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
929 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
930 f = purple_request_field_string_new("o", _("Organization"), "", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
931 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
932 f = purple_request_field_string_new("c", _("Country"), "", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
933 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
934 purple_request_fields_add_group(fields, g);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
935
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
936 g = purple_request_field_group_new(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
937 f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
938 purple_request_field_string_set_masked(f, TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
939 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
940 f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
941 purple_request_field_string_set_masked(f, TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
942 purple_request_field_group_add_field(g, f);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
943 purple_request_fields_add_group(fields, g);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
944
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
945 purple_request_fields(gc, _("Create New SILC Key Pair"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
946 _("Create New SILC Key Pair"), NULL, fields,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
947 _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
948 _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel),
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
949 gc->account, NULL, NULL, gc);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
950
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
951 g_strfreev(u);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
952 silc_free(hostname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
953 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
954
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
955 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
956 silcpurple_change_pass(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
957 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
958 PurpleConnection *gc = (PurpleConnection *) action->context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
959 purple_account_request_change_password(purple_connection_get_account(gc));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
960 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
961
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
962 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
963 silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
964 {
22692
3d092dd95ec1 Fix for changing silc private key passphrase to or from the empty string,
Stu Tomlinson <stu@nosnilmot.com>
parents: 22235
diff changeset
965 char prd[256];
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
966 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir());
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
967 silc_change_private_key_passphrase(purple_account_get_string(gc->account,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
968 "private-key",
22692
3d092dd95ec1 Fix for changing silc private key passphrase to or from the empty string,
Stu Tomlinson <stu@nosnilmot.com>
parents: 22235
diff changeset
969 prd), old ? old : "", new ? new : "");
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
970 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
971
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
972 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
973 silcpurple_show_set_info(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
974 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
975 PurpleConnection *gc = (PurpleConnection *) action->context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
976 purple_account_request_change_user_info(purple_connection_get_account(gc));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
977 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
978
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
979 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
980 silcpurple_set_info(PurpleConnection *gc, const char *text)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
981 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
982 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
983
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
984 static GList *
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
985 silcpurple_actions(PurplePlugin *plugin, gpointer context)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
986 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
987 GList *list = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
988 PurplePluginAction *act;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
989
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
990 act = purple_plugin_action_new(_("Online Status"),
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
991 silcpurple_attrs);
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
992 list = g_list_append(list, act);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
993
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
994 act = purple_plugin_action_new(_("Detach From Server"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
995 silcpurple_detach);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
996 list = g_list_append(list, act);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
997
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
998 act = purple_plugin_action_new(_("View Message of the Day"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
999 silcpurple_view_motd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1000 list = g_list_append(list, act);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1001
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1002 act = purple_plugin_action_new(_("Create SILC Key Pair..."),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1003 silcpurple_create_keypair);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1004 list = g_list_append(list, act);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1005
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1006 act = purple_plugin_action_new(_("Change Password..."),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1007 silcpurple_change_pass);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1008 list = g_list_append(list, act);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1009
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1010 act = purple_plugin_action_new(_("Set User Info..."),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1011 silcpurple_show_set_info);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1012 list = g_list_append(list, act);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1013
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1014 return list;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1015 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1016
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1017
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1018 /******************************* IM Routines *********************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1019
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1020 typedef struct {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1021 char *nick;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1022 char *message;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1023 SilcUInt32 message_len;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1024 SilcMessageFlags flags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1025 PurpleMessageFlags gflags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1026 } *SilcPurpleIM;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1027
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1028 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1029 silcpurple_send_im_resolved(SilcClient client,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1030 SilcClientConnection conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1031 SilcClientEntry *clients,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1032 SilcUInt32 clients_count,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1033 void *context)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1034 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1035 PurpleConnection *gc = client->application;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1036 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1037 SilcPurpleIM im = context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1038 PurpleConversation *convo;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1039 char tmp[256], *nickname = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1040 SilcClientEntry client_entry;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1041 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1042 SilcDList list;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1043 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1044
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1045 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1046 sg->account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1047 if (!convo)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1048 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1049
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1050 if (!clients)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1051 goto err;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1052
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1053 if (clients_count > 1) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1054 silc_parse_userfqdn(im->nick, &nickname, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1055
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1056 /* Find the correct one. The im->nick might be a formatted nick
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1057 so this will find the correct one. */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1058 clients = silc_client_get_clients_local(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1059 nickname, im->nick,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1060 &clients_count);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1061 if (!clients)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1062 goto err;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1063 client_entry = clients[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1064 silc_free(clients);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1065 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1066 client_entry = clients[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1067 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1068
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1069 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1070 /* Check for images */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1071 if (im->gflags & PURPLE_MESSAGE_IMAGES) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1072 list = silcpurple_image_message(im->message, (SilcUInt32 *)&im->flags);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1073 if (list) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1074 /* Send one or more MIME message. If more than one, they
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1075 are MIME fragments due to over large message */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1076 SilcBuffer buf;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1077
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1078 silc_dlist_start(list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1079 while ((buf = silc_dlist_get(list)) != SILC_LIST_END)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1080 silc_client_send_private_message(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1081 client_entry, im->flags,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1082 buf->data, buf->len,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1083 TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1084 silc_mime_partial_free(list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1085 purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1086 im->message, 0, time(NULL));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1087 goto out;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1088 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1089 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1090 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1091
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1092 /* Send the message */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1093 silc_client_send_private_message(client, conn, client_entry, im->flags,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1094 (unsigned char *)im->message, im->message_len, TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1095 purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1096 im->message, 0, time(NULL));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1097 goto out;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1098
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1099 err:
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1100 g_snprintf(tmp, sizeof(tmp),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1101 _("User <I>%s</I> is not present in the network"), im->nick);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1102 purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1103
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1104 out:
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1105 g_free(im->nick);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1106 g_free(im->message);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1107 silc_free(im);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1108 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1109 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1110
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1111 static int
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1112 silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1113 PurpleMessageFlags flags)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1114 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1115 SilcPurple sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1116 SilcClient client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1117 SilcClientConnection conn = sg->conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1118 SilcClientEntry *clients;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1119 SilcUInt32 clients_count, mflags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1120 char *nickname, *msg, *tmp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1121 int ret = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1122 gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1123 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1124 SilcDList list;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1125 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1126
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1127 if (!who || !message)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1128 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1129
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1130 mflags = SILC_MESSAGE_FLAG_UTF8;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1131
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1132 tmp = msg = purple_unescape_html(message);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1133
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1134 if (!g_ascii_strncasecmp(msg, "/me ", 4)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1135 msg += 4;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1136 if (!*msg) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1137 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1138 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1139 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1140 mflags |= SILC_MESSAGE_FLAG_ACTION;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1141 } else if (strlen(msg) > 1 && msg[0] == '/') {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1142 if (!silc_client_command_call(client, conn, msg + 1))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1143 purple_notify_error(gc, _("Call Command"), _("Cannot call command"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1144 _("Unknown command"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1145 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1146 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1147 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1148
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1149
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1150 if (!silc_parse_userfqdn(who, &nickname, NULL)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1151 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1152 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1153 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1154
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1155 if (sign)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1156 mflags |= SILC_MESSAGE_FLAG_SIGNED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1157
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1158 /* Find client entry */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1159 clients = silc_client_get_clients_local(client, conn, nickname, who,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1160 &clients_count);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1161 if (!clients) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1162 /* Resolve unknown user */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1163 SilcPurpleIM im = silc_calloc(1, sizeof(*im));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1164 if (!im) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1165 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1166 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1167 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1168 im->nick = g_strdup(who);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1169 im->message = g_strdup(message);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1170 im->message_len = strlen(im->message);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1171 im->flags = mflags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1172 im->gflags = flags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1173 silc_client_get_clients(client, conn, nickname, NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1174 silcpurple_send_im_resolved, im);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1175 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1176 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1177 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1178 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1179
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1180 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1181 /* Check for images */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1182 if (flags & PURPLE_MESSAGE_IMAGES) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1183 list = silcpurple_image_message(message, &mflags);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1184 if (list) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1185 /* Send one or more MIME message. If more than one, they
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1186 are MIME fragments due to over large message */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1187 SilcBuffer buf;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1188
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1189 silc_dlist_start(list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1190 while ((buf = silc_dlist_get(list)) != SILC_LIST_END)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1191 ret =
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1192 silc_client_send_private_message(client, conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1193 clients[0], mflags,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1194 buf->data, buf->len,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1195 TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1196 silc_mime_partial_free(list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1197 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1198 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1199 silc_free(clients);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1200 return ret;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1201 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1202 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1203 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1204
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1205 /* Send private message directly */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1206 ret = silc_client_send_private_message(client, conn, clients[0],
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1207 mflags,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1208 (unsigned char *)msg,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1209 strlen(msg), TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1210
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1211 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1212 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1213 silc_free(clients);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1214 return ret;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1215 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1216
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1217
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1218 static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1219 /* split this single menu building function back into the two
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1220 original: one for buddies and one for chats */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1221
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1222 if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1223 return silcpurple_chat_menu((PurpleChat *) node);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1224 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1225 return silcpurple_buddy_menu((PurpleBuddy *) node);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1226 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1227 g_return_val_if_reached(NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1228 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1229 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1230
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1231 /********************************* Commands **********************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1232
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1233 static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1234 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1235 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1236 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1237 PurpleConversation *convo = conv;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1238 int id = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1239
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1240 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1241
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1242 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1243 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1244
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1245 if(args && args[0])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1246 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0],
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1247 gc->account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1248
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1249 if (convo != NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1250 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1251
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1252 if (id == 0)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1253 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1254
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1255 silcpurple_chat_leave(gc, id);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1256
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1257 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1258
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1259 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1260
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1261 static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1262 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1263 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1264 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1265 int id = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1266 char *buf, *tmp, *tmp2;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1267 const char *topic;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1268
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1269 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1270 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1271
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1272 if (gc == NULL || id == 0)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1273 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1274
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1275 if (!args || !args[0]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1276 topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1277 if (topic) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1278 tmp = g_markup_escape_text(topic, -1);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1279 tmp2 = purple_markup_linkify(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1280 buf = g_strdup_printf(_("current topic is: %s"), tmp2);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1281 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1282 g_free(tmp2);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1283 } else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1284 buf = g_strdup(_("No topic is set"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1285 purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1286 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1287 g_free(buf);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1288
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1289 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1290
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1291 if (args && args[0] && (strlen(args[0]) > 255)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1292 *error = g_strdup(_("Topic too long"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1293 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1294 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1295
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1296 silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1297
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1298 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1299 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1300
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1301 static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1302 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1303 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1304 GHashTable *comp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1305
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1306 if(!args || !args[0])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1307 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1308
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1309 comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1310
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1311 g_hash_table_replace(comp, "channel", args[0]);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1312 if(args[1])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1313 g_hash_table_replace(comp, "passphrase", args[1]);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1314
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1315 silcpurple_chat_join(purple_conversation_get_gc(conv), comp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1316
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1317 g_hash_table_destroy(comp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1318 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1319 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1320
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1321 static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1322 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1323 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1324 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1325 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1326 purple_roomlist_show_with_account(purple_connection_get_account(gc));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1327 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1328 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1329
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1330 static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1331 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1332 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1333 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1334
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1335 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1336
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1337 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1338 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1339
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1340 silcpurple_get_info(gc, args[0]);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1341
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1342 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1343 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1344
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1345 static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1346 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1347 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1348 int ret;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1349 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1350
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1351 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1352
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1353 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1354 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1355
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1356 ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1357
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1358 if (ret)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1359 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1360 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1361 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1362 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1363
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1364 static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1365 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1366 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1367 int ret = 1;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1368 PurpleConversation *convo;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1369 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1370 PurpleAccount *account;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1371
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1372 if (!args || !args[0]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1373 *error = g_strdup(_("You must specify a nick"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1374 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1375 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1376
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1377 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1378
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1379 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1380 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1381
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1382 account = purple_connection_get_account(gc);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1383
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1384 convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1385
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1386 if (args[1]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1387 ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1388 purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1389 args[1], PURPLE_MESSAGE_SEND, time(NULL));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1390 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1391
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1392 if (ret)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1393 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1394 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1395 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1396 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1397
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1398 static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1399 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1400 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1401 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1402 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1403 char *tmp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1404
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1405 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1406
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1407 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1408 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1409
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1410 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1411
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1412 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1413 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1414
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1415 if (!sg->motd) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1416 *error = g_strdup(_("There is no Message of the Day associated with this connection"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1417 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1418 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1419
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1420 tmp = g_markup_escape_text(sg->motd, -1);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1421 purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1422 tmp, NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1423 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1424
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1425 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1426 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1427
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1428 static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1429 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1430 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1431 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1432 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1433
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1434 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1435
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1436 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1437 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1438
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1439 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1440
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1441 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1442 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1443
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1444 silc_client_command_call(sg->client, sg->conn, "DETACH");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1445 sg->detaching = TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1446
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1447 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1448 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1449
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1450 static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1451 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1452 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1453 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1454 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1455 SilcChannelEntry channel;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1456 char *silccmd, *silcargs, *msg, tmp[256];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1457 const char *chname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1458
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1459 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1460
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1461 if (gc == NULL || !args || gc->proto_data == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1462 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1463
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1464 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1465
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1466 if (args[0])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1467 chname = args[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1468 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1469 chname = purple_conversation_get_name(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1470
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1471 if (!args[1]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1472 channel = silc_client_get_channel(sg->client, sg->conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1473 (char *)chname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1474 if (!channel) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1475 *error = g_strdup_printf(_("channel %s not found"), chname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1476 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1477 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1478 if (channel->mode) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1479 silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1480 msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1481 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1482 msg = g_strdup_printf(_("no channel modes are set on %s"), chname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1483 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1484 purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1485 msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1486 g_free(msg);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1487 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1488 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1489
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1490 silcargs = g_strjoinv(" ", args);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1491 silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1492 g_free(silcargs);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1493 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1494 g_free(silccmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1495 *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1496 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1497 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1498 g_free(silccmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1499
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1500 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1501 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1502
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1503 static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1504 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1505 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1506 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1507 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1508 char *silccmd, *silcargs;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1509
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1510 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1511
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1512 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1513 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1514
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1515 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1516
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1517 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1518 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1519
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1520 silcargs = g_strjoinv(" ", args);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1521 silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1522 g_free(silcargs);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1523 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1524 g_free(silccmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1525 *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1526 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1527 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1528 g_free(silccmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1529
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1530 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1531 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1532
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1533 static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1534 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1535 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1536 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1537 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1538
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1539 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1540
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1541 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1542 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1543
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1544 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1545
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1546 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1547 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1548
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1549 silc_client_command_call(sg->client, sg->conn, NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1550 "QUIT", (args && args[0]) ? args[0] : "Download this: " PURPLE_WEBSITE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1551
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1552 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1553 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1554
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1555 static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1556 const char *cmd, char **args, char **error, void *data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1557 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1558 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1559 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1560
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1561 gc = purple_conversation_get_gc(conv);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1562
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1563 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1564 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1565
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1566 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1567
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1568 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1569 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1570
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1571 if (!silc_client_command_call(sg->client, sg->conn, args[0])) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1572 *error = g_strdup_printf(_("Unknown command: %s"), args[0]);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1573 return PURPLE_CMD_RET_FAILED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1574 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1575
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1576 return PURPLE_CMD_RET_OK;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1577 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1578
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1579
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1580 /************************** Plugin Initialization ****************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1581
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1582 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1583 silcpurple_register_commands(void)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1584 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1585 purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1586 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1587 PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1588 "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1589 purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1590 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1591 PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1592 "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1593 purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1594 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1595 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1596 silcpurple_cmd_chat_topic, _("topic [&lt;new topic&gt;]: View or change the topic"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1597 purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1598 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1599 PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1600 "prpl-silc", silcpurple_cmd_chat_join,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1601 _("join &lt;channel&gt; [&lt;password&gt;]: Join a chat on this network"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1602 purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1603 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1604 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1605 silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1606 purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1607 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1608 "prpl-silc",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1609 silcpurple_cmd_whois, _("whois &lt;nick&gt;: View nick's information"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1610 purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1611 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1612 "prpl-silc", silcpurple_cmd_msg,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1613 _("msg &lt;nick&gt; &lt;message&gt;: Send a private message to a user"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1614 purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1615 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1616 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1617 _("query &lt;nick&gt; [&lt;message&gt;]: Send a private message to a user"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1618 purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1619 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1620 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1621 _("motd: View the server's Message Of The Day"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1622 purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1623 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1624 "prpl-silc", silcpurple_cmd_detach,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1625 _("detach: Detach this session"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1626 purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1627 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1628 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1629 _("quit [message]: Disconnect from the server, with an optional message"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1630 purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1631 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1632 "prpl-silc", silcpurple_cmd_call,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1633 _("call &lt;command&gt;: Call any silc client command"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1634 /* These below just get passed through for the silc client library to deal
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1635 * with */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1636 purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1637 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1638 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1639 _("kill &lt;nick&gt; [-pubkey|&lt;reason&gt;]: Kill nick"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1640 purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1641 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1642 "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1643 _("nick &lt;newnick&gt;: Change your nickname"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1644 purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1645 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1646 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1647 _("whowas &lt;nick&gt;: View nick's information"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1648 purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1649 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1650 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1651 _("cmode &lt;channel&gt; [+|-&lt;modes&gt;] [arguments]: Change or display channel modes"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1652 purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1653 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1654 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1655 _("cumode &lt;channel&gt; +|-&lt;modes&gt; &lt;nick&gt;: Change nick's modes on channel"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1656 purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1657 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1658 "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1659 _("umode &lt;usermodes&gt;: Set your modes in the network"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1660 purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1661 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1662 "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1663 _("oper &lt;nick&gt; [-pubkey]: Get server operator privileges"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1664 purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1665 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1666 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1667 _("invite &lt;channel&gt; [-|+]&lt;nick&gt;: invite nick or add/remove from channel invite list"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1668 purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1669 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1670 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1671 _("kick &lt;channel&gt; &lt;nick&gt; [comment]: Kick client from channel"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1672 purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1673 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1674 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1675 _("info [server]: View server administrative details"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1676 purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1677 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1678 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1679 _("ban [&lt;channel&gt; +|-&lt;nick&gt;]: Ban client from channel"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1680 purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1681 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1682 "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1683 _("getkey &lt;nick|server&gt;: Retrieve client's or server's public key"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1684 purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1685 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1686 "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1687 _("stats: View server and network statistics"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1688 purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1689 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1690 "prpl-silc", silcpurple_cmd_generic,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1691 _("ping: Send PING to the connected server"), NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1692 #if 0 /* Purple doesn't handle these yet */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1693 purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1694 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1695 "prpl-silc", silcpurple_cmd_users,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1696 _("users &lt;channel&gt;: List users in channel"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1697 purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1698 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1699 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_names,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1700 _("names [-count|-ops|-halfops|-voices|-normal] &lt;channel(s)&gt;: List specific users in channel(s)"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1701 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1702 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1703
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1704 static PurpleWhiteboardPrplOps silcpurple_wb_ops =
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1705 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1706 silcpurple_wb_start,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1707 silcpurple_wb_end,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1708 silcpurple_wb_get_dimensions,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1709 silcpurple_wb_set_dimensions,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1710 silcpurple_wb_get_brush,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1711 silcpurple_wb_set_brush,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1712 silcpurple_wb_send,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1713 silcpurple_wb_clear,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1714
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1715 /* padding */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1716 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1717 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1718 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1719 NULL
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1720 };
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1721
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1722 static PurplePluginProtocolInfo prpl_info =
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1723 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1724 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1725 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME |
18081
3162c5836fb8 Add OPT_PROTO_SLASH_COMMANDS_NATIVE support to silc10
Stu Tomlinson <stu@nosnilmot.com>
parents: 17808
diff changeset
1726 OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE |
3162c5836fb8 Add OPT_PROTO_SLASH_COMMANDS_NATIVE support to silc10
Stu Tomlinson <stu@nosnilmot.com>
parents: 17808
diff changeset
1727 OPT_PROTO_SLASH_COMMANDS_NATIVE,
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1728 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1729 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME |
18081
3162c5836fb8 Add OPT_PROTO_SLASH_COMMANDS_NATIVE support to silc10
Stu Tomlinson <stu@nosnilmot.com>
parents: 17808
diff changeset
1730 OPT_PROTO_PASSWORD_OPTIONAL |
3162c5836fb8 Add OPT_PROTO_SLASH_COMMANDS_NATIVE support to silc10
Stu Tomlinson <stu@nosnilmot.com>
parents: 17808
diff changeset
1731 OPT_PROTO_SLASH_COMMANDS_NATIVE,
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1732 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1733 NULL, /* user_splits */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1734 NULL, /* protocol_options */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1735 #ifdef SILC_ATTRIBUTE_USER_ICON
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1736 {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1737 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1738 NO_BUDDY_ICONS,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1739 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1740 silcpurple_list_icon, /* list_icon */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1741 NULL, /* list_emblems */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1742 silcpurple_status_text, /* status_text */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1743 silcpurple_tooltip_text, /* tooltip_text */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1744 silcpurple_away_states, /* away_states */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1745 silcpurple_blist_node_menu, /* blist_node_menu */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1746 silcpurple_chat_info, /* chat_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1747 silcpurple_chat_info_defaults,/* chat_info_defaults */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1748 silcpurple_login, /* login */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1749 silcpurple_close, /* close */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1750 silcpurple_send_im, /* send_im */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1751 silcpurple_set_info, /* set_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1752 NULL, /* send_typing */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1753 silcpurple_get_info, /* get_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1754 silcpurple_set_status, /* set_status */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1755 silcpurple_idle_set, /* set_idle */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1756 silcpurple_change_passwd, /* change_passwd */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1757 silcpurple_add_buddy, /* add_buddy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1758 NULL, /* add_buddies */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1759 silcpurple_remove_buddy, /* remove_buddy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1760 NULL, /* remove_buddies */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1761 NULL, /* add_permit */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1762 NULL, /* add_deny */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1763 NULL, /* rem_permit */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1764 NULL, /* rem_deny */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1765 NULL, /* set_permit_deny */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1766 silcpurple_chat_join, /* join_chat */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1767 NULL, /* reject_chat */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1768 silcpurple_get_chat_name, /* get_chat_name */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1769 silcpurple_chat_invite, /* chat_invite */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1770 silcpurple_chat_leave, /* chat_leave */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1771 NULL, /* chat_whisper */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1772 silcpurple_chat_send, /* chat_send */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1773 silcpurple_keepalive, /* keepalive */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1774 NULL, /* register_user */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1775 NULL, /* get_cb_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1776 NULL, /* get_cb_away */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1777 NULL, /* alias_buddy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1778 NULL, /* group_buddy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1779 NULL, /* rename_group */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1780 NULL, /* buddy_free */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1781 NULL, /* convo_closed */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1782 NULL, /* normalize */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1783 #ifdef SILC_ATTRIBUTE_USER_ICON
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1784 silcpurple_buddy_set_icon, /* set_buddy_icon */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1785 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1786 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1787 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1788 NULL, /* remove_group */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1789 NULL, /* get_cb_real_name */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1790 silcpurple_chat_set_topic, /* set_chat_topic */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1791 NULL, /* find_blist_chat */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1792 silcpurple_roomlist_get_list, /* roomlist_get_list */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1793 silcpurple_roomlist_cancel, /* roomlist_cancel */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1794 NULL, /* roomlist_expand_category */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1795 NULL, /* can_receive_file */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1796 silcpurple_ftp_send_file, /* send_file */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1797 silcpurple_ftp_new_xfer, /* new_xfer */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1798 NULL, /* offline_message */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1799 &silcpurple_wb_ops, /* whiteboard_prpl_ops */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1800 NULL, /* send_raw */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1801 NULL, /* roomlist_room_serialize */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1802
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1803 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1804 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1805 NULL,
23111
718a9c287839 Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22692
diff changeset
1806 sizeof(PurplePluginProtocolInfo), /* struct_size */
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1807 };
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1808
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1809 static PurplePluginInfo info =
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1810 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1811 PURPLE_PLUGIN_MAGIC,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1812 PURPLE_MAJOR_VERSION,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1813 PURPLE_MINOR_VERSION,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1814 PURPLE_PLUGIN_PROTOCOL, /**< type */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1815 NULL, /**< ui_requirement */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1816 0, /**< flags */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1817 NULL, /**< dependencies */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1818 PURPLE_PRIORITY_DEFAULT, /**< priority */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1819
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1820 "prpl-silc", /**< id */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1821 "SILC", /**< name */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1822 "1.0", /**< version */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1823 /** summary */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1824 N_("SILC Protocol Plugin"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1825 /** description */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1826 N_("Secure Internet Live Conferencing (SILC) Protocol"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1827 "Pekka Riikonen", /**< author */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1828 "http://silcnet.org/", /**< homepage */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1829
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1830 NULL, /**< load */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1831 NULL, /**< unload */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1832 NULL, /**< destroy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1833
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1834 NULL, /**< ui_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1835 &prpl_info, /**< extra_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1836 NULL, /**< prefs_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1837 silcpurple_actions,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1838
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1839 /* padding */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1840 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1841 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1842 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1843 NULL
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1844 };
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1845
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1846 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1847 init_plugin(PurplePlugin *plugin)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1848 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1849 PurpleAccountOption *option;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1850 PurpleAccountUserSplit *split;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1851 char tmp[256];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1852 int i;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1853 PurpleKeyValuePair *kvp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1854 GList *list = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1855
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1856 silc_plugin = plugin;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1857
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1858 split = purple_account_user_split_new(_("Network"), "silcnet.org", '@');
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1859 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1860
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1861 /* Account options */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1862 option = purple_account_option_string_new(_("Connect server"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1863 "server",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1864 "silc.silcnet.org");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1865 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1866 option = purple_account_option_int_new(_("Port"), "port", 706);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1867 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1868 g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1869 option = purple_account_option_string_new(_("Public Key file"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1870 "public-key", tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1871 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1872 g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1873 option = purple_account_option_string_new(_("Private Key file"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1874 "private-key", tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1875 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1876
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1877 for (i = 0; silc_default_ciphers[i].name; i++) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1878 kvp = g_new0(PurpleKeyValuePair, 1);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1879 kvp->key = g_strdup(silc_default_ciphers[i].name);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1880 kvp->value = g_strdup(silc_default_ciphers[i].name);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1881 list = g_list_append(list, kvp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1882 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1883 option = purple_account_option_list_new(_("Cipher"), "cipher", list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1884 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1885
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1886 list = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1887 for (i = 0; silc_default_hmacs[i].name; i++) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1888 kvp = g_new0(PurpleKeyValuePair, 1);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1889 kvp->key = g_strdup(silc_default_hmacs[i].name);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1890 kvp->value = g_strdup(silc_default_hmacs[i].name);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1891 list = g_list_append(list, kvp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1892 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1893 option = purple_account_option_list_new(_("HMAC"), "hmac", list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1894 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1895
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1896 option = purple_account_option_bool_new(_("Public key authentication"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1897 "pubkey-auth", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1898 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1899 option = purple_account_option_bool_new(_("Block IMs without Key Exchange"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1900 "block-ims", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1901 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1902 option = purple_account_option_bool_new(_("Block messages to whiteboard"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1903 "block-wb", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1904 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1905 option = purple_account_option_bool_new(_("Automatically open whiteboard"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1906 "open-wb", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1907 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1908 option = purple_account_option_bool_new(_("Digitally sign and verify all messages"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1909 "sign-verify", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1910 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1911
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1912 purple_prefs_remove("/plugins/prpl/silc");
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1913
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1914 silcpurple_register_commands();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1915
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1916 #ifdef _WIN32
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1917 silc_net_win32_init();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1918 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1919 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1920
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1921 PURPLE_INIT_PLUGIN(silc, init_plugin, info);